From 87ce104931e86f1507f16dc83fbd5a85e9bed6c8 Mon Sep 17 00:00:00 2001 From: goulustis Date: Wed, 29 Oct 2025 18:53:39 +0800 Subject: [PATCH] add thread id as inp --- lang_agent/pipeline.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lang_agent/pipeline.py b/lang_agent/pipeline.py index 566ba88..7c69ca6 100644 --- a/lang_agent/pipeline.py +++ b/lang_agent/pipeline.py @@ -121,7 +121,7 @@ class Pipeline: return f"ws://{self.config.host}:{self.config.port}" - def chat(self, inp:str, as_stream:bool=False, as_raw:bool=False)->str: + def chat(self, inp:str, as_stream:bool=False, as_raw:bool=False, thread_id:int = None)->str: u = """ 你叫小盏,是一个点餐助手,你的回复要简洁明了,不需要给用户提供选择。对话过程中不要出现提示用户下一步的操作,用可爱的语气进行交流,根据用户的语言使用对应的语言回答 @@ -143,8 +143,9 @@ class Pipeline: 返回数据库中 status=1 并且时间是最新的数据。 """ + thread_id = thread_id if thread_id is not None else 3 inp = {"messages":[SystemMessage(u), - HumanMessage(inp)]}, {"configurable": {"thread_id": 3}} + HumanMessage(inp)]}, {"configurable": {"thread_id": thread_id}} out = self.invoke(*inp, as_stream=as_stream, as_raw=as_raw)