mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-27 07:54:19 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8af401eea4 | |||
| 446546b69f | |||
| 8a6d9d76da |
+1
-1
@@ -38,5 +38,5 @@ botpy.log*
|
|||||||
/poc
|
/poc
|
||||||
/libs/wecom_api/test.py
|
/libs/wecom_api/test.py
|
||||||
/venv
|
/venv
|
||||||
/jp-tyo-churros-05.rockchin.top
|
|
||||||
test.py
|
test.py
|
||||||
|
/web_ui
|
||||||
@@ -65,7 +65,7 @@ class OpenAIChatCompletions(requester.LLMAPIRequester):
|
|||||||
|
|
||||||
# deepseek的reasoner模型
|
# deepseek的reasoner模型
|
||||||
if reasoning_content is not None:
|
if reasoning_content is not None:
|
||||||
chatcmpl_message['content'] = "<think>\n" + reasoning_content + "\n</think>\n\n"+ chatcmpl_message['content']
|
chatcmpl_message['content'] = "<think>\n" + reasoning_content + "\n</think>\n"+ chatcmpl_message['content']
|
||||||
|
|
||||||
message = llm_entities.Message(**chatcmpl_message)
|
message = llm_entities.Message(**chatcmpl_message)
|
||||||
|
|
||||||
|
|||||||
@@ -164,12 +164,14 @@ class DifyServiceAPIRunner(runner.RequestRunner):
|
|||||||
for image_id in image_ids
|
for image_id in image_ids
|
||||||
]
|
]
|
||||||
|
|
||||||
ignored_events = ["agent_message"]
|
ignored_events = []
|
||||||
|
|
||||||
inputs = {}
|
inputs = {}
|
||||||
|
|
||||||
inputs.update(query.variables)
|
inputs.update(query.variables)
|
||||||
|
|
||||||
|
pending_agent_message = ''
|
||||||
|
|
||||||
async for chunk in self.dify_client.chat_messages(
|
async for chunk in self.dify_client.chat_messages(
|
||||||
inputs=inputs,
|
inputs=inputs,
|
||||||
query=plain_text,
|
query=plain_text,
|
||||||
@@ -183,18 +185,23 @@ class DifyServiceAPIRunner(runner.RequestRunner):
|
|||||||
|
|
||||||
if chunk["event"] in ignored_events:
|
if chunk["event"] in ignored_events:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if chunk['event'] == 'agent_message':
|
||||||
|
pending_agent_message += chunk['answer']
|
||||||
|
else:
|
||||||
|
if pending_agent_message.strip() != '':
|
||||||
|
pending_agent_message = pending_agent_message.replace('</details>Action:', '</details>')
|
||||||
|
yield llm_entities.Message(
|
||||||
|
role="assistant",
|
||||||
|
content=self._try_convert_thinking(pending_agent_message),
|
||||||
|
)
|
||||||
|
pending_agent_message = ''
|
||||||
|
|
||||||
if chunk["event"] == "agent_thought":
|
if chunk["event"] == "agent_thought":
|
||||||
|
|
||||||
if chunk['tool'] != '' and chunk['observation'] != '': # 工具调用结果,跳过
|
if chunk['tool'] != '' and chunk['observation'] != '': # 工具调用结果,跳过
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if chunk['thought'].strip() != '': # 文字回复内容
|
|
||||||
msg = llm_entities.Message(
|
|
||||||
role="assistant",
|
|
||||||
content=chunk["thought"],
|
|
||||||
)
|
|
||||||
yield msg
|
|
||||||
|
|
||||||
if chunk['tool']:
|
if chunk['tool']:
|
||||||
msg = llm_entities.Message(
|
msg = llm_entities.Message(
|
||||||
role="assistant",
|
role="assistant",
|
||||||
@@ -303,11 +310,11 @@ class DifyServiceAPIRunner(runner.RequestRunner):
|
|||||||
|
|
||||||
msg = llm_entities.Message(
|
msg = llm_entities.Message(
|
||||||
role="assistant",
|
role="assistant",
|
||||||
content=chunk["data"]["outputs"][
|
content=self._try_convert_thinking(chunk["data"]["outputs"][
|
||||||
self.ap.provider_cfg.data["dify-service-api"]["workflow"][
|
self.ap.provider_cfg.data["dify-service-api"]["workflow"][
|
||||||
"output-key"
|
"output-key"
|
||||||
]
|
]
|
||||||
],
|
]),
|
||||||
)
|
)
|
||||||
|
|
||||||
yield msg
|
yield msg
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
semantic_version = "v3.4.14.1"
|
semantic_version = "v3.4.14.2"
|
||||||
|
|
||||||
debug_mode = False
|
debug_mode = False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user