feat: 添加飞书机器人集成 (#13)

* feat: add Feishu bot integration

- Add fsapp.py: Feishu bot webhook handler (root directory)
- Add assets/SETUP_FEISHU.md: Setup guide for Feishu integration
- Add assets/install_python_windows.bat: Windows Python installer script

* fix: 历史注入仅在飞书场景生效,避免混入本地CLI历史

* fix: fsapp调用put_task时传source='feishu'以触发历史注入

---------

Co-authored-by: 张洲嘉 <zhangzhoujia@zhangzhoujiadeMacBook-Air.local>
This commit is contained in:
AspasZhang
2026-03-09 08:45:11 +08:00
committed by GitHub
parent 14f1009ddc
commit 7d444d065e
4 changed files with 521 additions and 1 deletions

View File

@@ -102,7 +102,12 @@ class GeneraticAgent:
handler.key_info += '\n[SYSTEM] 若开始新任务,先更新或清除工作记忆\n'
self.handler = handler
self.llmclient.backend = self.llmclient.backends[self.llm_no]
gen = agent_runner_loop(self.llmclient, sys_prompt, raw_query,
# 如果有历史记录且来自飞书,注入到首轮 user_input 中(支持/restore恢复上下文
user_input = raw_query
if source == 'feishu' and len(self.history) > 1: # 飞书场景且有之前的对话记录
h_str = "\n".join(self.history[-20:])
user_input = f"### [WORKING MEMORY]\n<history>\n{h_str}\n</history>\n\n### 用户当前消息\n{raw_query}"
gen = agent_runner_loop(self.llmclient, sys_prompt, user_input,
handler, TOOLS_SCHEMA, max_turns=40, verbose=self.verbose)
try:
full_resp = ""; last_pos = 0