mirror of
https://github.com/open-webui/open-webui.git
synced 2026-06-04 07:47:12 -05:00
[GH-ISSUE #11750] issue: The pipe function reports an error when calling __event_emitter__ #136071
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @wangyufeng-empty on GitHub (Mar 17, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/11750
Check Existing Issues
Installation Method
Pip Install
Open WebUI Version
0.5.19
Ollama Version (if applicable)
No response
Operating System
ManjaroLinux
Browser (if applicable)
Chrome
Confirmation
README.md.Expected Behavior
BUG Report
Description: While using the site package in the open_webui module, the following error occurred:
ERROR | open_webui.functions:stream_content:280 - Error: 'NoneType' object has no attribute 'get' - {}
Code Information:
File Path: Anaconda3\envs\pipeline\Lib\site-packages\open_webui\socket\main.py
Function Location: Line 296
Function Code:
if "type" in event_data and event_data["type"] == "message":
message = Chats.get_message_by_id_and_message_id(
request_info["chat_id"],
request_info["message_id"],
)
Calling Flow:
Initialization Code:
async def pipe(
self, body: dict, event_emitter: Callabledict], Awaitable[None = None
):
self.current_event_emitter = event_emitter
# ...
Calling Code:
async def emit_message(self, message: str):
await self.current_event_emitter(
{"type": "message", "data": {"content": message}}
)
await self.llm.emit_message("Thinking:\n ")
Error Description:
When running on the server, the application throws the error: 'NoneType' object has no attribute 'get'. This error occurs in the line message.get("content", ""), indicating that the Chats.get_message_by_id_and_message_id function returned None, causing a None value for message and failing when .get() is called.
Steps to Reproduce:
Call the emit_message method with a message.
Trigger the get_message_by_id_and_message_id function, which fails to find the message and returns None.
The error happens when trying to access message.get("content", "").
Actual Behavior
When the emit_message method is called (e.g., with the string "Thinking:\n "), the server logs an error:
ERROR | open_webui.functions:stream_content:280 - Error: 'NoneType' object has no attribute 'get' - {}
This indicates that the function Chats.get_message_by_id_and_message_id returned None instead of a valid message object. Consequently, when the code attempts to execute message.get("content", ""), it fails because None does not have a get method, and the error disrupts the intended message processing flow.
Steps to Reproduce
Set Up Environment:
Ensure you are using the Anaconda3\envs\pipeline environment with the open_webui module installed.
Locate the Code:
Open the file at Anaconda3\envs\pipeline\Lib\site-packages\open_webui\socket\main.py and navigate to line 296 where the error occurs.
Initialize the Pipeline:
Call the pipe function with a valid body dictionary and provide an event emitter function via the event_emitter parameter.
async def pipe(self, body: dict, event_emitter: Callabledict], Awaitable[None = None):
self.current_event_emitter = event_emitter
# ...
Invoke the Emit Message Function:
From your code, call the emit_message function with a message string, for example:
async def emit_message(self, message: str):
await self.current_event_emitter(
{"type": "message", "data": {"content": message}}
)
await self.llm.emit_message("Thinking:\n ")
Trigger Message Processing:
The event emitter sends the message to the module, triggering the block of code in open_webui\socket\main.py which calls:
message = Chats.get_message_by_id_and_message_id(
request_info["chat_id"],
request_info["message_id"],
)
content = message.get("content", "")
content += event_data.get("data", {}).get("content", "")
Observe the Error:
Since Chats.get_message_by_id_and_message_id returns None (because it cannot find the specified message), attempting to call .get("content", "") on a NoneType results in the following error:
ERROR | open_webui.functions:stream_content:280 - Error: 'NoneType' object has no attribute 'get' - {}
Following these steps should consistently reproduce the error.
Logs & Screenshots
2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 开始执行 MCTS 算法...
2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 正在进行default_max_iterations迭代: 1/2...
2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 开始搜索...
2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 正在选择节点...
2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 正在对节点 8ff4d 进行扩展...
2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 正在处理: 正在对节点 8ff4d 进行深度思考...
2025-03-17 10:40:09,729 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 思考...
2025-03-17 10:40:09.731 | ERROR | open_webui.functions:stream_content:280 - Error: 'NoneType' object has no attribute 'get' - {}
2025-03-17 10:40:09.760 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 172.18.103.88:59182 - "POST /api/chat/completed HTTP/1.1" 200 - {}
Additional Information