mirror of
https://github.com/open-webui/open-webui
synced 2024-11-17 22:12:51 +00:00
refac
This commit is contained in:
parent
3d6f5f418d
commit
049b3136e8
@ -284,6 +284,7 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
|
|||||||
context = ""
|
context = ""
|
||||||
|
|
||||||
for tool_id in data["tool_ids"]:
|
for tool_id in data["tool_ids"]:
|
||||||
|
print(tool_id)
|
||||||
response = await get_function_call_response(
|
response = await get_function_call_response(
|
||||||
prompt=prompt,
|
prompt=prompt,
|
||||||
tool_id=tool_id,
|
tool_id=tool_id,
|
||||||
@ -291,10 +292,9 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
|
|||||||
task_model_id=task_model_id,
|
task_model_id=task_model_id,
|
||||||
user=user,
|
user=user,
|
||||||
)
|
)
|
||||||
print(response)
|
|
||||||
|
|
||||||
if response:
|
if response:
|
||||||
context = ("\n" if context != "" else "") + response
|
context += ("\n" if context != "" else "") + response
|
||||||
|
|
||||||
if context != "":
|
if context != "":
|
||||||
system_prompt = rag_template(
|
system_prompt = rag_template(
|
||||||
@ -304,7 +304,7 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
|
|||||||
print(system_prompt)
|
print(system_prompt)
|
||||||
|
|
||||||
data["messages"] = add_or_update_system_message(
|
data["messages"] = add_or_update_system_message(
|
||||||
f"\n{system_prompt}", data["messages"]
|
f"\n{system_prompt}", data["messages"]
|
||||||
)
|
)
|
||||||
|
|
||||||
del data["tool_ids"]
|
del data["tool_ids"]
|
||||||
|
Loading…
Reference in New Issue
Block a user