Commit 8f23df57 authored by Michael Poluektov's avatar Michael Poluektov
Browse files

fix: outlet __event_emitter__

parent 144581a7
...@@ -226,7 +226,7 @@ async def get_body_and_model_and_user(request): ...@@ -226,7 +226,7 @@ async def get_body_and_model_and_user(request):
model_id = body["model"] model_id = body["model"]
if model_id not in app.state.MODELS: if model_id not in app.state.MODELS:
raise "Model not found" raise Exception("Model not found")
model = app.state.MODELS[model_id] model = app.state.MODELS[model_id]
user = get_current_user( user = get_current_user(
...@@ -1107,21 +1107,21 @@ async def chat_completed(form_data: dict, user=Depends(get_verified_user)): ...@@ -1107,21 +1107,21 @@ async def chat_completed(form_data: dict, user=Depends(get_verified_user)):
else: else:
pass pass
async def __event_emitter__(data): async def __event_emitter__(event_data):
await sio.emit( await sio.emit(
"chat-events", "chat-events",
{ {
"chat_id": data["chat_id"], "chat_id": data["chat_id"],
"message_id": data["id"], "message_id": data["id"],
"data": data, "data": event_data,
}, },
to=data["session_id"], to=data["session_id"],
) )
async def __event_call__(data): async def __event_call__(event_data):
response = await sio.call( response = await sio.call(
"chat-events", "chat-events",
{"chat_id": data["chat_id"], "message_id": data["id"], "data": data}, {"chat_id": data["chat_id"], "message_id": data["id"], "data": event_data},
to=data["session_id"], to=data["session_id"],
) )
return response return response
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment