From 69713b3977b3afb57f24deb16cc721ea6dd94f6a Mon Sep 17 00:00:00 2001 From: goulustis Date: Tue, 30 Dec 2025 22:44:21 +0800 Subject: [PATCH] pass in device_id --- lang_agent/pipeline.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lang_agent/pipeline.py b/lang_agent/pipeline.py index 350e9e7..ed89d7f 100644 --- a/lang_agent/pipeline.py +++ b/lang_agent/pipeline.py @@ -153,8 +153,15 @@ class Pipeline: # NOTE: this prompt will be overwritten by 'configs/route_sys_prompts/chat_prompt.txt' for route graph u = DEFAULT_PROMPT + device_id = "0" + spl_ls = thread_id.split("_") + assert len(spl_ls) <= 2, "something wrong!" + if len(spl_ls) == 2: + thread_id, device_id = spl_ls + inp = {"messages":[SystemMessage(u), - HumanMessage(inp)]}, {"configurable": {"thread_id": thread_id}} + HumanMessage(inp)]}, {"configurable": {"thread_id": thread_id, + "device_id":device_id}} out = self.invoke(*inp, as_stream=as_stream, as_raw=as_raw) @@ -197,8 +204,16 @@ class Pipeline: # NOTE: this prompt will be overwritten by 'configs/route_sys_prompts/chat_prompt.txt' for route graph u = DEFAULT_PROMPT + device_id = "0" + spl_ls = thread_id.split("_") + assert len(spl_ls) <= 2, "something wrong!" + if len(spl_ls) == 2: + thread_id, device_id = spl_ls + print(f"\033[32m====================DEVICE ID: {device_id}=============================\033[0m") + inp_data = {"messages":[SystemMessage(u), - HumanMessage(inp)]}, {"configurable": {"thread_id": thread_id}} + HumanMessage(inp)]}, {"configurable": {"thread_id": thread_id, + "device_id":device_id}} if as_stream: # Return async generator for streaming