mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-22 00:31:30 +00:00
fix: handle None chat_id in get_event_emitter channel-mode check
Direct API callers to /api/chat/completions pass no chat_id, so
metadata['chat_id'] ends up None. dict.get('chat_id', '') returns None
(not '') when the key is present-with-None, so the channels-streaming
branch added in v0.9.5 (0037baeb2) crashed with 'NoneType' object has
no attribute 'startswith', surfacing as HTTP 400 to the caller.
Fixes #24553.
This commit is contained in:
parent
18ff358c15
commit
06f8ee0e42
1 changed files with 3 additions and 2 deletions
|
|
@ -898,8 +898,9 @@ async def _make_channel_emitter(request_info):
|
|||
|
||||
|
||||
async def get_event_emitter(request_info, update_db=True):
|
||||
# Channel mode: route pipeline output to channel message updates
|
||||
if request_info.get('chat_id', '').startswith('channel:'):
|
||||
# Channel mode: route pipeline output to channel message updates.
|
||||
# `or ''` (not the .get default) because chat_id may be present as None.
|
||||
if (request_info.get('chat_id') or '').startswith('channel:'):
|
||||
return await _make_channel_emitter(request_info)
|
||||
|
||||
async def __event_emitter__(event_data):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue