From 547c897f8340a2bd3990d7ebbe13e58918620815 Mon Sep 17 00:00:00 2001 From: martsforever Date: Thu, 4 Sep 2025 21:25:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8D=A2=E4=B8=80=E4=B8=AA=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=EF=BC=9Ahuoshan-think-pro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/config/ai_configs.py | 5 +++++ app/controller/add_langgraph_chat_route.py | 20 +++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/config/ai_configs.py b/app/config/ai_configs.py index 071de55..ccb34c4 100644 --- a/app/config/ai_configs.py +++ b/app/config/ai_configs.py @@ -44,6 +44,11 @@ ai_configs = { 'url': 'https://ark.cn-beijing.volces.com/api/v3/chat/completions', 'key': env.llm_key_huoshan, }, + 'huoshan-think-pro': { + 'model': 'doubao-1-5-thinking-pro-250415', + 'url': 'https://ark.cn-beijing.volces.com/api/v3/chat/completions', + 'key': env.llm_key_huoshan, + }, 'huoshan-doubao-seed': { 'model': 'doubao-seed-1-6-250615', 'url': 'https://ark.cn-beijing.volces.com/api/v3/chat/completions', diff --git a/app/controller/add_langgraph_chat_route.py b/app/controller/add_langgraph_chat_route.py index 688daf7..f40ffbf 100644 --- a/app/controller/add_langgraph_chat_route.py +++ b/app/controller/add_langgraph_chat_route.py @@ -98,8 +98,18 @@ async def tool_book_hotel(config: RunnableConfig) -> str: response_data = response.json() # print("================ response_data ================") # print(response_data) + approve_id = response_data.get('graph_state').get('input_approve_id') - return "预定成功," + response_data.get('message') + return [ + "预定成功," + response_data.get('message'), + { + "component": "Link", + "props": { + "to": f"/pages/approve/approve-detail?id={approve_id}", + "children": "点击查看审批进度" + } + } + ] class ChatMessage(BaseModel): @@ -121,7 +131,7 @@ class ChatAgent: async def get_agent() -> CompiledStateGraph: if not ChatAgent.agent: ChatAgent.agent = create_react_agent( - model=create_llm(), + model=create_llm("huoshan-think-pro"), tools=[ tool_book_hotel, tool_get_datetime, @@ -130,9 +140,9 @@ class ChatAgent: ], checkpointer=await PostgresCheckpointerManager.get_instance(), prompt=""" - 你是一名擅长使用工具的智能助手,你需要根据用户问题来进行回答,请使用中文进行回答。 - 当用户问题需要调用工具时再调用工具,否则按照你的知识来回答问题。 - 某些工具会触发中断让用户来编辑工具执行参数,这些工具会将新的执行参数作为信息返回,你需要回复用户最新的信息 + - 你是一名擅长使用工具的智能助手,你需要根据用户问题来进行回答,请使用中文进行回答。 + - 当用户问题需要调用工具时再调用工具,否则按照你的知识来回答问题。 + - 特别注意,特别注意,特别注意,如果工具的返回结果是一个数组,你只能回复“工具已经执行完毕” """ ) return ChatAgent.agent