Преглед изворни кода

style(飞书): 联系人补充、_init_等

tanjingyu пре 3 недеља
родитељ
комит
1b0c99e9a4

+ 6 - 0
agent/core/runner.py

@@ -96,6 +96,12 @@ BUILTIN_TOOLS = [
     "browser_ensure_login_with_cookies",
     "browser_wait_for_user_action",
     "browser_done",
+
+    # 飞书工具
+    "feishu_get_chat_history",
+    "feishu_get_contact_replies",
+    "feishu_send_message_to_contact",
+    "feishu_get_contact_list",
 ]
 
 

+ 2 - 6
agent/tools/builtin/__init__.py

@@ -18,12 +18,12 @@ from agent.tools.builtin.subagent import subagent
 from agent.tools.builtin.search import search_posts, get_search_suggestions
 from agent.tools.builtin.sandbox import (sandbox_create_environment, sandbox_run_shell,
                                          sandbox_rebuild_with_ports,sandbox_destroy_environment)
-from agent.tools.builtin.feishu.chat import (feishu_get_chat_history, feishu_get_contact_replies,
-                                         feishu_send_message_to_contact,feishu_get_contact_list)
 
 # 导入浏览器工具以触发注册
 import agent.tools.builtin.browser  # noqa: F401
 
+import agent.tools.builtin.feishu
+
 __all__ = [
     # 文件操作
     "read_file",
@@ -42,8 +42,4 @@ __all__ = [
     "sandbox_run_shell",
     "sandbox_rebuild_with_ports",
     "sandbox_destroy_environment",
-    "feishu_get_chat_history",
-    "feishu_get_contact_replies",
-    "feishu_send_message_to_contact",
-    "feishu_get_contact_list"
 ]

+ 9 - 0
agent/tools/builtin/feishu/__init__.py

@@ -0,0 +1,9 @@
+from agent.tools.builtin.feishu.chat import (feishu_get_chat_history, feishu_get_contact_replies,
+                                         feishu_send_message_to_contact,feishu_get_contact_list)
+
+__all__ = [
+    "feishu_get_chat_history",
+    "feishu_get_contact_replies",
+    "feishu_send_message_to_contact",
+    "feishu_get_contact_list"
+]

+ 1 - 1
agent/tools/builtin/feishu/chat.py

@@ -12,7 +12,7 @@ from agent.tools import tool, ToolResult, ToolContext
 FEISHU_APP_ID = os.getenv("FEISHU_APP_ID", "cli_a90fe317987a9cc9")
 FEISHU_APP_SECRET = os.getenv("FEISHU_APP_SECRET", "nn2dWuXTiRA2N6xodbm4g0qz1AfM2ayi")
 
-CONTACTS_FILE = os.path.join(os.path.dirname(__file__), "contacts.json")
+CONTACTS_FILE = os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..", "..")), "config", "feishu_contacts.json")
 CHAT_HISTORY_DIR = os.path.join(os.path.dirname(__file__), "chat_history")
 UNREAD_SUMMARY_FILE = os.path.join(CHAT_HISTORY_DIR, "chat_summary.json")
 

+ 0 - 8
agent/tools/builtin/feishu/contacts.json

@@ -1,8 +0,0 @@
-[
-  {
-    "name": "谭景玉",
-    "description": "开发工程师",
-    "open_id": "ou_11fdbd559cc6513ab53ff06d6c63413d",
-    "chat_id": "oc_56e85f0e2c97405d176729b62d8f56e5"
-  }
-]

+ 28 - 0
config/feishu_contacts.json

@@ -0,0 +1,28 @@
+[
+    {
+        "name": "谭景玉",
+        "description": "",
+        "open_id": "ou_11fdbd559cc6513ab53ff06d6c63413d",
+        "chat_id": "oc_56e85f0e2c97405d176729b62d8f56e5"
+    },
+    {
+        "name": "王华东",
+        "description": "",
+        "open_id": "ou_82340312cf9d215f49a41b67fa9c02c2"
+    },
+    {
+        "name": "孙若天",
+        "description": "",
+        "open_id": "ou_ede69f28c2617bf80a7574f059879c8d"
+    },
+    {
+        "name": "刘斌",
+        "description": "",
+        "open_id": "ou_50c2307c3531e6293b3d5533d14592e9"
+    },
+    {
+        "name": "关涛",
+        "description": "",
+        "open_id": "ou_90b80ed994fe41b7f038a63cb9182f72"
+    }
+]