This commit is contained in:
Typer_Body
2026-06-07 02:38:05 +08:00
parent fd896c6974
commit 07b90f12a2
5 changed files with 19 additions and 48 deletions
+1
View File
@@ -2,6 +2,7 @@
参考 astrbot 的 deerflow_api_client 实现,使用 httpx 适配 LangBot 风格。
"""
from __future__ import annotations
import codecs
+1 -4
View File
@@ -26,8 +26,5 @@ class DeerFlowAPIError(Exception):
msg = f'DeerFlow {operation} failed: status={status}, url={url}, body={body}'
if thread_id is not None:
msg = (
f'DeerFlow {operation} failed: thread_id={thread_id}, '
f'status={status}, url={url}, body={body}'
)
msg = f'DeerFlow {operation} failed: thread_id={thread_id}, status={status}, url={url}, body={body}'
super().__init__(msg)
@@ -2,6 +2,7 @@
参考 astrbot 实现的 deerflow_stream_utils。
"""
from __future__ import annotations
import typing
@@ -60,9 +61,7 @@ def is_ai_message(message: dict[str, typing.Any]) -> bool:
msg_type = str(message.get('type', '')).lower()
if msg_type in {'ai', 'assistant', 'aimessage', 'aimessagechunk'}:
return True
if 'ai' in msg_type and all(
token not in msg_type for token in ('human', 'tool', 'system')
):
if 'ai' in msg_type and all(token not in msg_type for token in ('human', 'tool', 'system')):
return True
return False