mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
refac: get event emitter/caller
Some checks failed
Deploy to HuggingFace Spaces / check-secret (push) Waiting to run
Deploy to HuggingFace Spaces / deploy (push) Blocked by required conditions
Create and publish Docker images with specific build args / build-main-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-main-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda126-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda126-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-slim-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-slim-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / merge-main-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda126-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-ollama-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-slim-images (push) Blocked by required conditions
Python CI / Format Backend (push) Waiting to run
Frontend Build / Format & Build Frontend (push) Has been cancelled
Frontend Build / Frontend Unit Tests (push) Has been cancelled
Some checks failed
Deploy to HuggingFace Spaces / check-secret (push) Waiting to run
Deploy to HuggingFace Spaces / deploy (push) Blocked by required conditions
Create and publish Docker images with specific build args / build-main-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-main-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda126-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda126-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-slim-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-slim-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / merge-main-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda126-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-ollama-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-slim-images (push) Blocked by required conditions
Python CI / Format Backend (push) Waiting to run
Frontend Build / Format & Build Frontend (push) Has been cancelled
Frontend Build / Frontend Unit Tests (push) Has been cancelled
This commit is contained in:
parent
62073d3b7f
commit
b2667470cd
1 changed files with 20 additions and 5 deletions
|
|
@ -284,6 +284,7 @@ async def connect(sid, environ, auth):
|
||||||
|
|
||||||
await sio.enter_room(sid, f"user:{user.id}")
|
await sio.enter_room(sid, f"user:{user.id}")
|
||||||
|
|
||||||
|
|
||||||
@sio.on("user-join")
|
@sio.on("user-join")
|
||||||
async def user_join(sid, data):
|
async def user_join(sid, data):
|
||||||
|
|
||||||
|
|
@ -651,9 +652,8 @@ async def disconnect(sid):
|
||||||
def get_event_emitter(request_info, update_db=True):
|
def get_event_emitter(request_info, update_db=True):
|
||||||
async def __event_emitter__(event_data):
|
async def __event_emitter__(event_data):
|
||||||
user_id = request_info["user_id"]
|
user_id = request_info["user_id"]
|
||||||
|
chat_id = request_info["chat_id"]
|
||||||
chat_id = request_info.get("chat_id", None)
|
message_id = request_info["message_id"]
|
||||||
message_id = request_info.get("message_id", None)
|
|
||||||
|
|
||||||
await sio.emit(
|
await sio.emit(
|
||||||
"events",
|
"events",
|
||||||
|
|
@ -669,6 +669,7 @@ def get_event_emitter(request_info, update_db=True):
|
||||||
and message_id
|
and message_id
|
||||||
and not request_info.get("chat_id", "").startswith("local:")
|
and not request_info.get("chat_id", "").startswith("local:")
|
||||||
):
|
):
|
||||||
|
|
||||||
if "type" in event_data and event_data["type"] == "status":
|
if "type" in event_data and event_data["type"] == "status":
|
||||||
Chats.add_message_status_to_chat_by_id_and_message_id(
|
Chats.add_message_status_to_chat_by_id_and_message_id(
|
||||||
request_info["chat_id"],
|
request_info["chat_id"],
|
||||||
|
|
@ -758,7 +759,14 @@ def get_event_emitter(request_info, update_db=True):
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
return __event_emitter__
|
if (
|
||||||
|
"user_id" in request_info
|
||||||
|
and "chat_id" in request_info
|
||||||
|
and "message_id" in request_info
|
||||||
|
):
|
||||||
|
return __event_emitter__
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_event_call(request_info):
|
def get_event_call(request_info):
|
||||||
|
|
@ -774,7 +782,14 @@ def get_event_call(request_info):
|
||||||
)
|
)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
return __event_caller__
|
if (
|
||||||
|
"session_id" in request_info
|
||||||
|
and "chat_id" in request_info
|
||||||
|
and "message_id" in request_info
|
||||||
|
):
|
||||||
|
return __event_caller__
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
get_event_caller = get_event_call
|
get_event_caller = get_event_call
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue