|
@@ -262,6 +262,13 @@ async def get_function_call_response(
|
|
file_handler = True
|
|
file_handler = True
|
|
print("file_handler: ", file_handler)
|
|
print("file_handler: ", file_handler)
|
|
|
|
|
|
|
|
+ if hasattr(toolkit_module, "valves") and hasattr(
|
|
|
|
+ toolkit_module, "Valves"
|
|
|
|
+ ):
|
|
|
|
+ toolkit_module.valves = toolkit_module.Valves(
|
|
|
|
+ **Tools.get_tool_valves_by_id(tool_id)
|
|
|
|
+ )
|
|
|
|
+
|
|
function = getattr(toolkit_module, result["name"])
|
|
function = getattr(toolkit_module, result["name"])
|
|
function_result = None
|
|
function_result = None
|
|
try:
|
|
try:
|
|
@@ -402,6 +409,13 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
|
|
if hasattr(function_module, "file_handler"):
|
|
if hasattr(function_module, "file_handler"):
|
|
skip_files = function_module.file_handler
|
|
skip_files = function_module.file_handler
|
|
|
|
|
|
|
|
+ if hasattr(function_module, "valves") and hasattr(
|
|
|
|
+ function_module, "Valves"
|
|
|
|
+ ):
|
|
|
|
+ function_module.valves = function_module.Valves(
|
|
|
|
+ **Functions.get_function_valves_by_id(filter_id)
|
|
|
|
+ )
|
|
|
|
+
|
|
try:
|
|
try:
|
|
if hasattr(function_module, "inlet"):
|
|
if hasattr(function_module, "inlet"):
|
|
inlet = function_module.inlet
|
|
inlet = function_module.inlet
|
|
@@ -884,6 +898,13 @@ async def generate_chat_completions(form_data: dict, user=Depends(get_verified_u
|
|
else:
|
|
else:
|
|
function_module = webui_app.state.FUNCTIONS[pipe_id]
|
|
function_module = webui_app.state.FUNCTIONS[pipe_id]
|
|
|
|
|
|
|
|
+ if hasattr(function_module, "valves") and hasattr(
|
|
|
|
+ function_module, "Valves"
|
|
|
|
+ ):
|
|
|
|
+ function_module.valves = function_module.Valves(
|
|
|
|
+ **Functions.get_function_valves_by_id(pipe_id)
|
|
|
|
+ )
|
|
|
|
+
|
|
pipe = function_module.pipe
|
|
pipe = function_module.pipe
|
|
|
|
|
|
# Get the signature of the function
|
|
# Get the signature of the function
|
|
@@ -1105,6 +1126,13 @@ async def chat_completed(form_data: dict, user=Depends(get_verified_user)):
|
|
)
|
|
)
|
|
webui_app.state.FUNCTIONS[filter_id] = function_module
|
|
webui_app.state.FUNCTIONS[filter_id] = function_module
|
|
|
|
|
|
|
|
+ if hasattr(function_module, "valves") and hasattr(
|
|
|
|
+ function_module, "Valves"
|
|
|
|
+ ):
|
|
|
|
+ function_module.valves = function_module.Valves(
|
|
|
|
+ **Functions.get_function_valves_by_id(filter_id)
|
|
|
|
+ )
|
|
|
|
+
|
|
try:
|
|
try:
|
|
if hasattr(function_module, "outlet"):
|
|
if hasattr(function_module, "outlet"):
|
|
outlet = function_module.outlet
|
|
outlet = function_module.outlet
|