mirror of
https://git.mirrors.martin98.com/https://github.com/open-webui/open-webui
synced 2025-08-15 18:25:59 +08:00
remove files from message for tasks
This commit is contained in:
parent
b34401a087
commit
cf5201aada
@ -977,6 +977,20 @@ async def process_chat_response(
|
|||||||
if message:
|
if message:
|
||||||
messages = get_message_list(message_map, message.get("id"))
|
messages = get_message_list(message_map, message.get("id"))
|
||||||
|
|
||||||
|
# Remove reasoning details and files from the messages.
|
||||||
|
# as get_message_list creates a new list, it does not affect
|
||||||
|
# the original messages outside of this handler
|
||||||
|
for message in messages:
|
||||||
|
message["content"] = re.sub(
|
||||||
|
r"<details\s+type=\"reasoning\"[^>]*>.*?<\/details>",
|
||||||
|
"",
|
||||||
|
message["content"],
|
||||||
|
flags=re.S,
|
||||||
|
).strip()
|
||||||
|
|
||||||
|
if message.get('files'):
|
||||||
|
message['files'] = []
|
||||||
|
|
||||||
if tasks and messages:
|
if tasks and messages:
|
||||||
if TASKS.TITLE_GENERATION in tasks:
|
if TASKS.TITLE_GENERATION in tasks:
|
||||||
if tasks[TASKS.TITLE_GENERATION]:
|
if tasks[TASKS.TITLE_GENERATION]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user