feat(agent): upgrade langchain to v1.0+

This commit is contained in:
jxxghp
2026-03-22 21:41:12 +08:00
parent ea4e0dd764
commit 5cded77387
5 changed files with 31 additions and 17 deletions

View File

@@ -11,7 +11,6 @@ from typing import Optional, List, Tuple
from PIL import Image
from app.chain.message import MessageChain
from app.core.cache import FileCache
from app.core.context import MediaInfo, Context
from app.core.metainfo import MetaInfo
@@ -101,11 +100,12 @@ class QQBot:
"""直接调用消息链处理,避免 HTTP 开销"""
def _run():
try:
MessageChain().process(
# FIXME
"""MessageChain().process(
body=payload,
form={},
args={"source": self._config_name},
)
)"""
except Exception as e:
logger.error(f"QQ Bot 转发消息失败: {e}")

View File

@@ -83,8 +83,8 @@ class Telegram:
# 发送正在输入状态
try:
_bot.send_chat_action(message.chat.id, 'typing')
except Exception as e:
logger.error(f"发送Telegram正在输入状态失败{e}")
except Exception as err:
logger.error(f"发送Telegram正在输入状态失败{err}")
RequestUtils(timeout=15).post_res(self._ds_url, json=message.json)
@_bot.callback_query_handler(func=lambda call: True)

View File

@@ -9,12 +9,11 @@ from typing import Optional, List, Dict, Tuple, Set
import websocket
from app.chain.message import MessageChain
from app.core.cache import FileCache
from app.core.config import settings
from app.core.context import MediaInfo, Context
from app.core.metainfo import MetaInfo
from app.log import logger
from app.schemas.types import MessageChannel
from app.utils.string import StringUtils
@@ -27,6 +26,7 @@ class WeChatBot:
"""
_default_ws_url = "wss://openws.work.weixin.qq.com"
_ds_url = f"http://127.0.0.1:{settings.PORT}/api/v1/message?token={settings.API_TOKEN}"
_heartbeat_interval = 30
_ack_timeout = 10
@@ -361,13 +361,14 @@ class WeChatBot:
def _forward_to_message_chain(self, userid: str, text: str) -> None:
def _run():
try:
MessageChain().handle_message(
# FIXME
"""MessageChain().handle_message(
channel=MessageChannel.Wechat,
source=self._config_name,
userid=userid,
username=userid,
text=text,
)
)"""
except Exception as err:
logger.error(f"企业微信智能机器人转发消息失败:{err}")