@lobehub/lobehub 2.0.0-next.160 → 2.0.0-next.161
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +10 -0
- package/CHANGELOG.md +25 -0
- package/changelog/v1.json +9 -0
- package/e2e/src/steps/hooks.ts +1 -0
- package/locales/ar/setting.json +25 -0
- package/locales/bg-BG/setting.json +25 -0
- package/locales/de-DE/setting.json +25 -0
- package/locales/en-US/setting.json +25 -0
- package/locales/es-ES/setting.json +25 -0
- package/locales/fa-IR/setting.json +25 -0
- package/locales/fr-FR/setting.json +25 -0
- package/locales/it-IT/setting.json +25 -0
- package/locales/ja-JP/setting.json +25 -0
- package/locales/ko-KR/setting.json +25 -0
- package/locales/nl-NL/setting.json +25 -0
- package/locales/pl-PL/setting.json +25 -0
- package/locales/pt-BR/setting.json +25 -0
- package/locales/ru-RU/setting.json +25 -0
- package/locales/tr-TR/setting.json +25 -0
- package/locales/vi-VN/setting.json +25 -0
- package/locales/zh-CN/setting.json +25 -0
- package/locales/zh-TW/setting.json +25 -0
- package/next.config.ts +13 -1
- package/package.json +3 -1
- package/packages/const/src/index.ts +1 -0
- package/packages/const/src/klavis.ts +163 -0
- package/packages/database/migrations/meta/_journal.json +1 -1
- package/packages/database/src/core/migrations.json +1 -1
- package/packages/database/src/models/plugin.ts +1 -1
- package/packages/types/src/message/common/tools.ts +9 -0
- package/packages/types/src/serverConfig.ts +1 -0
- package/packages/types/src/tool/plugin.ts +10 -0
- package/src/config/klavis.ts +41 -0
- package/src/features/ChatInput/ActionBar/Tools/KlavisServerItem.tsx +351 -0
- package/src/features/ChatInput/ActionBar/Tools/index.tsx +56 -4
- package/src/features/ChatInput/ActionBar/Tools/useControls.tsx +174 -6
- package/src/features/ChatInput/ActionBar/components/ActionDropdown.tsx +3 -1
- package/src/helpers/toolEngineering/index.test.ts +3 -0
- package/src/helpers/toolEngineering/index.ts +13 -2
- package/src/libs/klavis/index.ts +36 -0
- package/src/locales/default/setting.ts +25 -0
- package/src/server/globalConfig/index.ts +2 -0
- package/src/server/routers/lambda/index.ts +2 -0
- package/src/server/routers/lambda/klavis.ts +249 -0
- package/src/server/routers/tools/index.ts +2 -0
- package/src/server/routers/tools/klavis.ts +80 -0
- package/src/server/services/mcp/index.ts +61 -15
- package/src/services/import/index.test.ts +658 -0
- package/src/services/mcp.test.ts +1 -1
- package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +2 -3
- package/src/store/chat/slices/plugin/action.test.ts +0 -1
- package/src/store/chat/slices/plugin/actions/internals.ts +22 -2
- package/src/store/chat/slices/plugin/actions/pluginTypes.ts +108 -0
- package/src/store/serverConfig/index.ts +1 -1
- package/src/store/serverConfig/selectors.ts +1 -0
- package/src/store/tool/initialState.ts +4 -1
- package/src/store/tool/selectors/index.ts +1 -0
- package/src/store/tool/slices/builtin/selectors.ts +25 -3
- package/src/store/tool/slices/klavisStore/action.test.ts +512 -0
- package/src/store/tool/slices/klavisStore/action.ts +375 -0
- package/src/store/tool/slices/klavisStore/index.ts +4 -0
- package/src/store/tool/slices/klavisStore/initialState.ts +25 -0
- package/src/store/tool/slices/klavisStore/selectors.test.ts +371 -0
- package/src/store/tool/slices/klavisStore/selectors.ts +123 -0
- package/src/store/tool/slices/klavisStore/types.ts +100 -0
- package/src/store/tool/slices/plugin/selectors.ts +16 -13
- package/src/store/tool/store.ts +4 -1
|
@@ -775,12 +775,37 @@
|
|
|
775
775
|
"groupName": "Mở rộng tích hợp sẵn"
|
|
776
776
|
},
|
|
777
777
|
"disabled": "Mô hình hiện tại không hỗ trợ gọi hàm, không thể sử dụng plugin",
|
|
778
|
+
"klavis": {
|
|
779
|
+
"addServer": "Thêm máy chủ",
|
|
780
|
+
"authCompleted": "Xác thực hoàn tất",
|
|
781
|
+
"authFailed": "Xác thực thất bại",
|
|
782
|
+
"authRequired": "Yêu cầu xác thực",
|
|
783
|
+
"connected": "Đã kết nối",
|
|
784
|
+
"error": "Lỗi",
|
|
785
|
+
"groupName": "Công cụ Klavis",
|
|
786
|
+
"manage": "Quản lý Klavis",
|
|
787
|
+
"manageTitle": "Quản lý tích hợp Klavis",
|
|
788
|
+
"noServers": "Chưa có máy chủ nào được kết nối",
|
|
789
|
+
"notEnabled": "Dịch vụ Klavis chưa được kích hoạt",
|
|
790
|
+
"oauthRequired": "Vui lòng hoàn tất xác thực OAuth trong cửa sổ mới",
|
|
791
|
+
"pendingAuth": "Đang chờ xác thực",
|
|
792
|
+
"serverCreated": "Tạo máy chủ thành công",
|
|
793
|
+
"serverCreatedFailed": "Tạo máy chủ thất bại",
|
|
794
|
+
"serverRemoved": "Máy chủ đã bị xóa",
|
|
795
|
+
"servers": "máy chủ",
|
|
796
|
+
"tools": "công cụ",
|
|
797
|
+
"verifyAuth": "Tôi đã hoàn tất xác thực"
|
|
798
|
+
},
|
|
778
799
|
"plugins": {
|
|
779
800
|
"enabled": "Đã kích hoạt {{num}}",
|
|
780
801
|
"groupName": "Tiện ích",
|
|
781
802
|
"noEnabled": "Chưa có tiện ích nào được kích hoạt",
|
|
782
803
|
"store": "Cửa hàng tiện ích"
|
|
783
804
|
},
|
|
805
|
+
"tabs": {
|
|
806
|
+
"all": "Tất cả",
|
|
807
|
+
"installed": "Đã bật"
|
|
808
|
+
},
|
|
784
809
|
"title": "Công cụ mở rộng"
|
|
785
810
|
}
|
|
786
811
|
}
|
|
@@ -775,12 +775,37 @@
|
|
|
775
775
|
"groupName": "内置插件"
|
|
776
776
|
},
|
|
777
777
|
"disabled": "当前模型不支持函数调用,无法使用插件",
|
|
778
|
+
"klavis": {
|
|
779
|
+
"addServer": "添加服务器",
|
|
780
|
+
"authCompleted": "认证完成",
|
|
781
|
+
"authFailed": "认证失败",
|
|
782
|
+
"authRequired": "需要认证",
|
|
783
|
+
"connected": "已连接",
|
|
784
|
+
"error": "错误",
|
|
785
|
+
"groupName": "Klavis 工具",
|
|
786
|
+
"manage": "管理 Klavis",
|
|
787
|
+
"manageTitle": "管理 Klavis 集成",
|
|
788
|
+
"noServers": "暂无连接的服务器",
|
|
789
|
+
"notEnabled": "Klavis 服务未启用",
|
|
790
|
+
"oauthRequired": "请在新窗口中完成 OAuth 认证",
|
|
791
|
+
"pendingAuth": "待认证",
|
|
792
|
+
"serverCreated": "服务器创建成功",
|
|
793
|
+
"serverCreatedFailed": "服务器创建失败",
|
|
794
|
+
"serverRemoved": "服务器已删除",
|
|
795
|
+
"servers": "个服务器",
|
|
796
|
+
"tools": "个工具",
|
|
797
|
+
"verifyAuth": "我已完成认证"
|
|
798
|
+
},
|
|
778
799
|
"plugins": {
|
|
779
800
|
"enabled": "已启用 {{num}}",
|
|
780
801
|
"groupName": "三方插件",
|
|
781
802
|
"noEnabled": "暂无启用插件",
|
|
782
803
|
"store": "插件商店"
|
|
783
804
|
},
|
|
805
|
+
"tabs": {
|
|
806
|
+
"installed": "已启用",
|
|
807
|
+
"all": "全部"
|
|
808
|
+
},
|
|
784
809
|
"title": "扩展插件"
|
|
785
810
|
}
|
|
786
811
|
}
|
|
@@ -775,12 +775,37 @@
|
|
|
775
775
|
"groupName": "內置"
|
|
776
776
|
},
|
|
777
777
|
"disabled": "當前模型不支持函數調用,無法使用插件",
|
|
778
|
+
"klavis": {
|
|
779
|
+
"addServer": "新增伺服器",
|
|
780
|
+
"authCompleted": "驗證完成",
|
|
781
|
+
"authFailed": "驗證失敗",
|
|
782
|
+
"authRequired": "需要驗證",
|
|
783
|
+
"connected": "已連線",
|
|
784
|
+
"error": "錯誤",
|
|
785
|
+
"groupName": "Klavis 工具",
|
|
786
|
+
"manage": "管理 Klavis",
|
|
787
|
+
"manageTitle": "管理 Klavis 整合",
|
|
788
|
+
"noServers": "尚未連線任何伺服器",
|
|
789
|
+
"notEnabled": "Klavis 服務未啟用",
|
|
790
|
+
"oauthRequired": "請在新視窗中完成 OAuth 驗證",
|
|
791
|
+
"pendingAuth": "待驗證",
|
|
792
|
+
"serverCreated": "伺服器建立成功",
|
|
793
|
+
"serverCreatedFailed": "伺服器建立失敗",
|
|
794
|
+
"serverRemoved": "伺服器已刪除",
|
|
795
|
+
"servers": "個伺服器",
|
|
796
|
+
"tools": "個工具",
|
|
797
|
+
"verifyAuth": "我已完成驗證"
|
|
798
|
+
},
|
|
778
799
|
"plugins": {
|
|
779
800
|
"enabled": "已啟用 {{num}}",
|
|
780
801
|
"groupName": "插件",
|
|
781
802
|
"noEnabled": "暫無啟用插件",
|
|
782
803
|
"store": "插件商店"
|
|
783
804
|
},
|
|
805
|
+
"tabs": {
|
|
806
|
+
"all": "全部",
|
|
807
|
+
"installed": "已啟用"
|
|
808
|
+
},
|
|
784
809
|
"title": "擴展工具"
|
|
785
810
|
}
|
|
786
811
|
}
|
package/next.config.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import analyzer from '@next/bundle-analyzer';
|
|
2
2
|
import withSerwistInit from '@serwist/next';
|
|
3
|
+
import { codeInspectorPlugin } from 'code-inspector-plugin';
|
|
3
4
|
import type { NextConfig } from 'next';
|
|
4
5
|
import ReactComponentName from 'react-scan/react-component-name/webpack';
|
|
5
6
|
|
|
@@ -10,6 +11,9 @@ const enableReactScan = !!process.env.REACT_SCAN_MONITOR_API_KEY;
|
|
|
10
11
|
const isUsePglite = process.env.NEXT_PUBLIC_CLIENT_DB === 'pglite';
|
|
11
12
|
const shouldUseCSP = process.env.ENABLED_CSP === '1';
|
|
12
13
|
|
|
14
|
+
const isTest =
|
|
15
|
+
process.env.NODE_ENV === 'test' || process.env.TEST === '1' || process.env.E2E === '1';
|
|
16
|
+
|
|
13
17
|
// if you need to proxy the api endpoint to remote server
|
|
14
18
|
|
|
15
19
|
const isStandaloneMode = buildWithDocker || isDesktop;
|
|
@@ -268,8 +272,16 @@ const nextConfig: NextConfig = {
|
|
|
268
272
|
|
|
269
273
|
// when external packages in dev mode with turbopack, this config will lead to bundle error
|
|
270
274
|
serverExternalPackages: isProd ? ['@electric-sql/pglite', 'pdfkit'] : ['pdfkit'],
|
|
275
|
+
|
|
271
276
|
transpilePackages: ['pdfjs-dist', 'mermaid', 'better-auth-harmony'],
|
|
272
|
-
turbopack: {
|
|
277
|
+
turbopack: {
|
|
278
|
+
rules: isTest
|
|
279
|
+
? void 0
|
|
280
|
+
: codeInspectorPlugin({
|
|
281
|
+
bundler: 'turbopack',
|
|
282
|
+
hotKeys: ['altKey'],
|
|
283
|
+
}),
|
|
284
|
+
},
|
|
273
285
|
|
|
274
286
|
typescript: {
|
|
275
287
|
ignoreBuildErrors: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/lobehub",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.161",
|
|
4
4
|
"description": "LobeHub - an open-source,comprehensive AI Agent framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -229,6 +229,7 @@
|
|
|
229
229
|
"jose": "^5.10.0",
|
|
230
230
|
"js-sha256": "^0.11.1",
|
|
231
231
|
"jsonl-parse-stringify": "^1.0.3",
|
|
232
|
+
"klavis": "^2.13.2",
|
|
232
233
|
"langchain": "^0.3.36",
|
|
233
234
|
"langfuse": "^3.38.6",
|
|
234
235
|
"langfuse-core": "^3.38.6",
|
|
@@ -359,6 +360,7 @@
|
|
|
359
360
|
"@typescript/native-preview": "7.0.0-dev.20251102.1",
|
|
360
361
|
"@vitest/coverage-v8": "^3.2.4",
|
|
361
362
|
"ajv-keywords": "^5.1.0",
|
|
363
|
+
"code-inspector-plugin": "1.3.0",
|
|
362
364
|
"commitlint": "^19.8.1",
|
|
363
365
|
"consola": "^3.4.2",
|
|
364
366
|
"cross-env": "^10.1.0",
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { IconType, SiCaldotcom, SiGithub, SiLinear } from '@icons-pack/react-simple-icons';
|
|
2
|
+
import { Klavis } from 'klavis';
|
|
3
|
+
|
|
4
|
+
export interface KlavisServerType {
|
|
5
|
+
icon: string | IconType;
|
|
6
|
+
/**
|
|
7
|
+
* Identifier used for storage in database (e.g., 'google-calendar')
|
|
8
|
+
* Format: lowercase, spaces replaced with hyphens
|
|
9
|
+
*/
|
|
10
|
+
identifier: string;
|
|
11
|
+
label: string;
|
|
12
|
+
/**
|
|
13
|
+
* Server name used to call Klavis API (e.g., 'Google Calendar')
|
|
14
|
+
*/
|
|
15
|
+
serverName: Klavis.McpServerName;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const KLAVIS_SERVER_TYPES: KlavisServerType[] = [
|
|
19
|
+
{
|
|
20
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/gmail.svg',
|
|
21
|
+
identifier: 'gmail',
|
|
22
|
+
label: 'Gmail',
|
|
23
|
+
serverName: Klavis.McpServerName.Gmail,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/googlecalendar.svg',
|
|
27
|
+
identifier: 'google-calendar',
|
|
28
|
+
label: 'Google Calendar',
|
|
29
|
+
serverName: Klavis.McpServerName.GoogleCalendar,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/notion.svg',
|
|
33
|
+
identifier: 'notion',
|
|
34
|
+
label: 'Notion',
|
|
35
|
+
serverName: Klavis.McpServerName.Notion,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/airtable.svg',
|
|
39
|
+
identifier: 'airtable',
|
|
40
|
+
label: 'Airtable',
|
|
41
|
+
serverName: Klavis.McpServerName.Airtable,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
icon: SiLinear,
|
|
45
|
+
identifier: 'linear',
|
|
46
|
+
label: 'Linear',
|
|
47
|
+
serverName: Klavis.McpServerName.Linear,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/googlesheets.svg',
|
|
51
|
+
identifier: 'google-sheets',
|
|
52
|
+
label: 'Google Sheets',
|
|
53
|
+
serverName: Klavis.McpServerName.GoogleSheets,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/googledocs.svg',
|
|
57
|
+
identifier: 'google-docs',
|
|
58
|
+
label: 'Google Docs',
|
|
59
|
+
serverName: Klavis.McpServerName.GoogleDocs,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
icon: SiGithub,
|
|
63
|
+
identifier: 'github',
|
|
64
|
+
label: 'GitHub',
|
|
65
|
+
serverName: Klavis.McpServerName.Github,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/supabase.svg',
|
|
69
|
+
identifier: 'supabase',
|
|
70
|
+
label: 'Supabase',
|
|
71
|
+
serverName: Klavis.McpServerName.Supabase,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/googledrive.svg',
|
|
75
|
+
identifier: 'google-drive',
|
|
76
|
+
label: 'Google Drive',
|
|
77
|
+
serverName: Klavis.McpServerName.GoogleDrive,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/slack.svg',
|
|
81
|
+
identifier: 'slack',
|
|
82
|
+
label: 'Slack',
|
|
83
|
+
serverName: Klavis.McpServerName.Slack,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/confluence.svg',
|
|
87
|
+
identifier: 'confluence',
|
|
88
|
+
label: 'Confluence',
|
|
89
|
+
serverName: Klavis.McpServerName.Confluence,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/jira.svg',
|
|
93
|
+
identifier: 'jira',
|
|
94
|
+
label: 'Jira',
|
|
95
|
+
serverName: Klavis.McpServerName.Jira,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/clickup.svg',
|
|
99
|
+
identifier: 'clickup',
|
|
100
|
+
label: 'ClickUp',
|
|
101
|
+
serverName: Klavis.McpServerName.Clickup,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/dropbox.svg',
|
|
105
|
+
identifier: 'dropbox',
|
|
106
|
+
label: 'Dropbox',
|
|
107
|
+
serverName: Klavis.McpServerName.Dropbox,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/figma.svg',
|
|
111
|
+
identifier: 'figma',
|
|
112
|
+
label: 'Figma',
|
|
113
|
+
serverName: Klavis.McpServerName.Figma,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/hubspot.svg',
|
|
117
|
+
identifier: 'hubspot',
|
|
118
|
+
label: 'HubSpot',
|
|
119
|
+
serverName: Klavis.McpServerName.Hubspot,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/onedrive.svg',
|
|
123
|
+
identifier: 'onedrive',
|
|
124
|
+
label: 'OneDrive',
|
|
125
|
+
serverName: Klavis.McpServerName.Onedrive,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/outlook.svg',
|
|
129
|
+
identifier: 'outlook-mail',
|
|
130
|
+
label: 'Outlook Mail',
|
|
131
|
+
serverName: Klavis.McpServerName.OutlookMail,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/salesforce.svg',
|
|
135
|
+
identifier: 'salesforce',
|
|
136
|
+
label: 'Salesforce',
|
|
137
|
+
serverName: Klavis.McpServerName.Salesforce,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/whatsapp.svg',
|
|
141
|
+
identifier: 'whatsapp',
|
|
142
|
+
label: 'WhatsApp',
|
|
143
|
+
serverName: Klavis.McpServerName.Whatsapp,
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/youtube.svg',
|
|
147
|
+
identifier: 'youtube',
|
|
148
|
+
label: 'YouTube',
|
|
149
|
+
serverName: Klavis.McpServerName.Youtube,
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/zendesk.svg',
|
|
153
|
+
identifier: 'zendesk',
|
|
154
|
+
label: 'Zendesk',
|
|
155
|
+
serverName: Klavis.McpServerName.Zendesk,
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
icon: SiCaldotcom,
|
|
159
|
+
identifier: 'cal-com',
|
|
160
|
+
label: 'Cal.com',
|
|
161
|
+
serverName: Klavis.McpServerName.CalCom,
|
|
162
|
+
},
|
|
163
|
+
];
|
|
@@ -16,7 +16,7 @@ export class PluginModel {
|
|
|
16
16
|
create = async (
|
|
17
17
|
params: Pick<
|
|
18
18
|
NewInstalledPlugin,
|
|
19
|
-
'type' | 'identifier' | 'manifest' | 'customParams' | 'settings'
|
|
19
|
+
'type' | 'identifier' | 'manifest' | 'customParams' | 'settings' | 'source'
|
|
20
20
|
>,
|
|
21
21
|
) => {
|
|
22
22
|
const [result] = await this.db
|
|
@@ -23,6 +23,11 @@ export interface ChatPluginPayload {
|
|
|
23
23
|
type: LobeToolRenderType;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Tool source indicates where the tool comes from
|
|
28
|
+
*/
|
|
29
|
+
export type ToolSource = 'builtin' | 'plugin' | 'mcp' | 'klavis';
|
|
30
|
+
|
|
26
31
|
export interface ChatToolPayload {
|
|
27
32
|
apiName: string;
|
|
28
33
|
arguments: string;
|
|
@@ -30,6 +35,10 @@ export interface ChatToolPayload {
|
|
|
30
35
|
identifier: string;
|
|
31
36
|
intervention?: ToolIntervention;
|
|
32
37
|
result_msg_id?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Tool source indicates where the tool comes from
|
|
40
|
+
*/
|
|
41
|
+
source?: ToolSource;
|
|
33
42
|
thoughtSignature?: string;
|
|
34
43
|
type: LobeToolRenderType;
|
|
35
44
|
}
|
|
@@ -25,6 +25,7 @@ export type ServerLanguageModel = Partial<Record<GlobalLLMProviderKey, ServerMod
|
|
|
25
25
|
export interface GlobalServerConfig {
|
|
26
26
|
aiProvider: ServerLanguageModel;
|
|
27
27
|
defaultAgent?: PartialDeep<UserDefaultAgent>;
|
|
28
|
+
enableKlavis?: boolean;
|
|
28
29
|
enableUploadFileToServer?: boolean;
|
|
29
30
|
enabledAccessCode?: boolean;
|
|
30
31
|
/**
|
|
@@ -37,6 +37,16 @@ export interface CustomPluginParams {
|
|
|
37
37
|
// Added headers configuration support
|
|
38
38
|
headers?: Record<string, string>;
|
|
39
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Klavis integration parameters
|
|
42
|
+
*/
|
|
43
|
+
klavis?: {
|
|
44
|
+
instanceId: string;
|
|
45
|
+
isAuthenticated: boolean;
|
|
46
|
+
oauthUrl?: string;
|
|
47
|
+
serverName: string;
|
|
48
|
+
serverUrl: string;
|
|
49
|
+
};
|
|
40
50
|
avatar?: string;
|
|
41
51
|
description?: string;
|
|
42
52
|
/* eslint-enable */
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createEnv } from '@t3-oss/env-nextjs';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Klavis Service Configuration
|
|
6
|
+
*
|
|
7
|
+
* Architecture:
|
|
8
|
+
* - Server-side: KLAVIS_API_KEY is stored and used only on the server
|
|
9
|
+
* - Client-side: Klavis enabled status is provided via serverConfig store (enableKlavis)
|
|
10
|
+
* - Client calls server APIs which use the API key
|
|
11
|
+
*
|
|
12
|
+
* Security:
|
|
13
|
+
* - API key is NEVER exposed to the client
|
|
14
|
+
* - Client gets enabled status from server config
|
|
15
|
+
*/
|
|
16
|
+
export const getKlavisConfig = () => {
|
|
17
|
+
return createEnv({
|
|
18
|
+
client: {},
|
|
19
|
+
runtimeEnv: {
|
|
20
|
+
// Server-side API key (never exposed to client)
|
|
21
|
+
KLAVIS_API_KEY: process.env.KLAVIS_API_KEY,
|
|
22
|
+
},
|
|
23
|
+
server: {
|
|
24
|
+
KLAVIS_API_KEY: z.string().optional(),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const klavisEnv = getKlavisConfig();
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get Klavis API Key (server-side only)
|
|
33
|
+
* IMPORTANT: This should only be called from server-side code
|
|
34
|
+
*/
|
|
35
|
+
export const getServerKlavisApiKey = (): string | undefined => {
|
|
36
|
+
if (typeof window !== 'undefined') {
|
|
37
|
+
console.error('[Klavis] Attempted to access API key from client-side!');
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
return klavisEnv.KLAVIS_API_KEY;
|
|
41
|
+
};
|