Add chat app adapters for QQ, Feishu, WeCom, and DingTalk

This commit is contained in:
Vivi 8n24
2026-03-13 15:55:49 +08:00
parent 3f66368689
commit 6fe93e9cb4
10 changed files with 1752 additions and 79 deletions

View File

@@ -45,10 +45,10 @@ def get_pretty_json(data):
data["script"] = data["script"].replace("; ", ";\n ")
return json.dumps(data, indent=2, ensure_ascii=False).replace('\\n', '\n')
def agent_runner_loop(client, system_prompt, user_input, handler, tools_schema, max_turns=15, verbose=True):
def agent_runner_loop(client, system_prompt, user_input, handler, tools_schema, max_turns=15, verbose=True, initial_user_content=None):
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_input}
{"role": "user", "content": initial_user_content if initial_user_content is not None else user_input}
]
for turn in range(max_turns):
yield f"**LLM Running (Turn {turn+1}) ...**\n\n"
@@ -93,4 +93,4 @@ def agent_runner_loop(client, system_prompt, user_input, handler, tools_schema,
next_prompt += outcome.next_prompt
next_prompt = handler.next_prompt_patcher(next_prompt, outcome, turn+1)
messages = [{"role": "user", "content": next_prompt}]
return {'result': 'MAX_TURNS_EXCEEDED'}
return {'result': 'MAX_TURNS_EXCEEDED'}