Skip to content

Commit 586d9d5

Browse files
authored
feat: add lark (#842)
2 parents b9d2468 + f6c6395 commit 586d9d5

11 files changed

Lines changed: 86 additions & 34 deletions

File tree

backend/app/utils/agent.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
from app.utils.toolkit.linkedin_toolkit import LinkedInToolkit
4848
from app.utils.toolkit.reddit_toolkit import RedditToolkit
4949
from app.utils.toolkit.slack_toolkit import SlackToolkit
50+
from app.utils.toolkit.lark_toolkit import LarkToolkit
5051
from camel.types import ModelPlatformType, ModelType
5152
from camel.toolkits import MCPToolkit, ToolkitMessageIntegration
5253
import datetime
@@ -1598,6 +1599,7 @@ async def get_toolkits(tools: list[str], agent_name: str, api_task_id: str):
15981599
"google_gmail_mcp_toolkit": GoogleGmailMCPToolkit,
15991600
"image_analysis_toolkit": ImageAnalysisToolkit,
16001601
"linkedin_toolkit": LinkedInToolkit,
1602+
"lark_toolkit": LarkToolkit,
16011603
"mcp_search_toolkit": McpSearchToolkit,
16021604
"notion_mcp_toolkit": NotionMCPToolkit,
16031605
"pptx_toolkit": PPTXToolkit,
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from camel.toolkits import LarkToolkit as BaseLarkToolkit
2+
from camel.toolkits.function_tool import FunctionTool
3+
4+
from app.component.environment import env
5+
from app.utils.listen.toolkit_listen import auto_listen_toolkit
6+
from app.utils.toolkit.abstract_toolkit import AbstractToolkit
7+
8+
9+
@auto_listen_toolkit(BaseLarkToolkit)
10+
class LarkToolkit(BaseLarkToolkit, AbstractToolkit):
11+
12+
def __init__(self, api_task_id: str, timeout: float | None = None):
13+
super().__init__(timeout=timeout)
14+
self.api_task_id = api_task_id
15+
16+
@classmethod
17+
def get_can_use_tools(cls, api_task_id: str) -> list[FunctionTool]:
18+
if env("LARK_APP_ID") and env("LARK_APP_SECRET"):
19+
return LarkToolkit(api_task_id).get_tools()
20+
return []

backend/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ readme = "README.md"
66
requires-python = ">=3.10,<3.11"
77
dependencies = [
88
"pip>=23.0",
9-
"camel-ai[eigent]==0.2.83a5",
9+
"camel-ai[eigent]==0.2.83a7",
1010
"fastapi>=0.115.12",
1111
"fastapi-babel>=1.0.0",
1212
"uvicorn[standard]>=0.34.2",

backend/uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/app/model/config/config.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,18 @@ class ConfigInfo:
3939
# "env_vars": [],
4040
# "toolkit": "",
4141
# },
42-
ConfigGroup.SLACK.value: {
43-
"env_vars": ["SLACK_BOT_TOKEN"],
44-
"toolkit": "slack_toolkit",
45-
},
46-
ConfigGroup.NOTION.value: {
47-
"env_vars": ["MCP_REMOTE_CONFIG_DIR"],
48-
"toolkit": "notion_mcp_toolkit",
49-
},
42+
ConfigGroup.SLACK.value: {
43+
"env_vars": ["SLACK_BOT_TOKEN"],
44+
"toolkit": "slack_toolkit",
45+
},
46+
ConfigGroup.LARK.value: {
47+
"env_vars": ["LARK_APP_ID", "LARK_APP_SECRET"],
48+
"toolkit": "lark_toolkit",
49+
},
50+
ConfigGroup.NOTION.value: {
51+
"env_vars": ["MCP_REMOTE_CONFIG_DIR"],
52+
"toolkit": "notion_mcp_toolkit",
53+
},
5054
ConfigGroup.TWITTER.value: {
5155
"env_vars": [
5256
"TWITTER_CONSUMER_KEY",

server/app/type/config_group.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
from enum import Enum
22

33

4-
class ConfigGroup(str, Enum):
5-
WHATSAPP = "WhatsApp"
6-
TWITTER = "X(Twitter)"
7-
LINKEDIN = "LinkedIn"
8-
REDDIT = "Reddit"
9-
SLACK = "Slack"
10-
NOTION = "Notion"
11-
GOOGLE_SUITE = "GoogleSuite"
12-
DISCORD = "Discord"
4+
class ConfigGroup(str, Enum):
5+
WHATSAPP = "WhatsApp"
6+
TWITTER = "X(Twitter)"
7+
LINKEDIN = "LinkedIn"
8+
REDDIT = "Reddit"
9+
SLACK = "Slack"
10+
LARK = "Lark"
11+
NOTION = "Notion"
12+
GOOGLE_SUITE = "GoogleSuite"
13+
DISCORD = "Discord"
1314
SEARCH = "Search"
1415
AUDIO_ANALYSIS = "Audio Analysis"
1516
CODE_EXECUTION = "Code Execution"

server/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ requires-python = ">=3.12,<3.13"
77
dependencies = [
88
"alembic>=1.15.2",
99
"openai>=1.99.3,<2",
10-
"camel-ai==0.2.83a5",
10+
"camel-ai==0.2.83a7",
1111
"pydantic[email]>=2.11.1",
1212
"click>=8.1.8",
1313
"fastapi>=0.115.12",

server/uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/AddWorker/ToolSelect.tsx

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,31 @@ const ToolSelect = forwardRef<
337337
// Continue anyway to trigger installation
338338
}
339339

340-
// Trigger instantiation for Google Calendar
341-
if (activeMcp.key === "Google Calendar") {
342-
console.log("[ToolSelect installMcp] Starting Google Calendar installation");
343-
try {
340+
if (activeMcp.key !== "Google Calendar") {
341+
const integrationItem = integrations.find(
342+
(item) => item.key === activeMcp.key
343+
);
344+
addOption(
345+
{
346+
id: activeMcp.id,
347+
key: activeMcp.key,
348+
name: activeMcp.name ?? activeMcp.key,
349+
description:
350+
typeof integrationItem?.desc === "string"
351+
? integrationItem.desc
352+
: "",
353+
toolkit: integrationItem?.toolkit,
354+
isLocal: true,
355+
},
356+
true
357+
);
358+
return;
359+
}
360+
361+
// Trigger instantiation for Google Calendar
362+
if (activeMcp.key === "Google Calendar") {
363+
console.log("[ToolSelect installMcp] Starting Google Calendar installation");
364+
try {
344365
const response = await fetchPost("/install/tool/google_calendar");
345366

346367
if (response.success) {

src/components/AddWorker/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,11 @@ export function AddWorker({
164164
// call ToolSelect's install method
165165
if (toolSelectRef.current) {
166166
try {
167-
if (activeMcp.key === "EXA Search" || activeMcp.key === "Google Calendar") {
167+
if (
168+
activeMcp.key === "EXA Search" ||
169+
activeMcp.key === "Google Calendar" ||
170+
activeMcp.key === "Lark"
171+
) {
168172
await toolSelectRef.current.installMcp(
169173
activeMcp.id,
170174
{ ...envValues },

0 commit comments

Comments
 (0)