mirror of
https://github.com/open-webui/open-webui
synced 2025-04-19 05:47:22 +00:00
refac
This commit is contained in:
parent
1b7ff1c5df
commit
0a08a4d2fb
@ -1188,6 +1188,14 @@ async def chat_completed(form_data: dict, user=Depends(get_verified_user)):
|
|||||||
to=data["session_id"],
|
to=data["session_id"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
async def __event_call__(data):
|
||||||
|
response = await sio.call(
|
||||||
|
"chat-events",
|
||||||
|
{"chat_id": data["chat_id"], "message_id": data["id"], "data": data},
|
||||||
|
to=data["session_id"],
|
||||||
|
)
|
||||||
|
return response
|
||||||
|
|
||||||
def get_priority(function_id):
|
def get_priority(function_id):
|
||||||
function = Functions.get_function_by_id(function_id)
|
function = Functions.get_function_by_id(function_id)
|
||||||
if function is not None and hasattr(function, "valves"):
|
if function is not None and hasattr(function, "valves"):
|
||||||
@ -1275,6 +1283,12 @@ async def chat_completed(form_data: dict, user=Depends(get_verified_user)):
|
|||||||
"__event_emitter__": __event_emitter__,
|
"__event_emitter__": __event_emitter__,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if "__event_call__" in sig.parameters:
|
||||||
|
params = {
|
||||||
|
**params,
|
||||||
|
"__event_call__": __event_call__,
|
||||||
|
}
|
||||||
|
|
||||||
if inspect.iscoroutinefunction(outlet):
|
if inspect.iscoroutinefunction(outlet):
|
||||||
data = await outlet(**params)
|
data = await outlet(**params)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user