@lobehub/chat 1.29.6 → 1.31.0

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.
Files changed (47) hide show
  1. package/.env.example +5 -0
  2. package/CHANGELOG.md +50 -0
  3. package/Dockerfile +2 -0
  4. package/Dockerfile.database +2 -0
  5. package/docs/usage/features/database.zh-CN.mdx +3 -3
  6. package/locales/ar/modelProvider.json +12 -0
  7. package/locales/bg-BG/modelProvider.json +12 -0
  8. package/locales/de-DE/modelProvider.json +12 -0
  9. package/locales/en-US/modelProvider.json +12 -0
  10. package/locales/es-ES/modelProvider.json +12 -0
  11. package/locales/fr-FR/modelProvider.json +12 -0
  12. package/locales/it-IT/modelProvider.json +12 -0
  13. package/locales/ja-JP/modelProvider.json +12 -0
  14. package/locales/ko-KR/modelProvider.json +12 -0
  15. package/locales/nl-NL/modelProvider.json +12 -0
  16. package/locales/pl-PL/modelProvider.json +12 -0
  17. package/locales/pt-BR/modelProvider.json +12 -0
  18. package/locales/ru-RU/modelProvider.json +12 -0
  19. package/locales/tr-TR/modelProvider.json +12 -0
  20. package/locales/vi-VN/modelProvider.json +12 -0
  21. package/locales/zh-CN/modelProvider.json +12 -0
  22. package/locales/zh-TW/modelProvider.json +12 -0
  23. package/package.json +2 -2
  24. package/src/app/(main)/settings/llm/ProviderList/Cloudflare/index.tsx +43 -0
  25. package/src/app/(main)/settings/llm/ProviderList/providers.tsx +6 -0
  26. package/src/config/llm.ts +17 -0
  27. package/src/config/modelProviders/cloudflare.ts +89 -0
  28. package/src/config/modelProviders/index.ts +8 -0
  29. package/src/config/modelProviders/xai.ts +29 -0
  30. package/src/const/auth.ts +2 -0
  31. package/src/const/settings/llm.ts +10 -0
  32. package/src/libs/agent-runtime/AgentRuntime.ts +14 -1
  33. package/src/libs/agent-runtime/cloudflare/index.test.ts +648 -0
  34. package/src/libs/agent-runtime/cloudflare/index.ts +123 -0
  35. package/src/libs/agent-runtime/types/type.ts +2 -0
  36. package/src/libs/agent-runtime/utils/cloudflareHelpers.test.ts +339 -0
  37. package/src/libs/agent-runtime/utils/cloudflareHelpers.ts +134 -0
  38. package/src/libs/agent-runtime/xai/index.test.ts +255 -0
  39. package/src/libs/agent-runtime/xai/index.ts +10 -0
  40. package/src/locales/default/modelProvider.ts +13 -1
  41. package/src/server/globalConfig/index.ts +16 -0
  42. package/src/server/modules/AgentRuntime/index.ts +18 -0
  43. package/src/services/_auth.ts +9 -0
  44. package/src/services/chat.ts +7 -0
  45. package/src/store/user/slices/modelList/selectors/keyVaults.ts +2 -0
  46. package/src/store/user/slices/modelList/selectors/modelConfig.ts +2 -0
  47. package/src/types/user/settings/keyVaults.ts +7 -0
package/.env.example CHANGED
@@ -112,6 +112,11 @@ OPENAI_API_KEY=sk-xxxxxxxxx
112
112
 
113
113
  # QWEN_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
114
114
 
115
+ ### Cloudflare Workers AI ####
116
+
117
+ # CLOUDFLARE_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
118
+ # CLOUDFLARE_BASE_URL_OR_ACCOUNT_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
119
+
115
120
  ### SiliconCloud AI ####
116
121
 
117
122
  # SILICONCLOUD_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 1.31.0](https://github.com/lobehub/lobe-chat/compare/v1.30.0...v1.31.0)
6
+
7
+ <sup>Released on **2024-11-11**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **misc**: Add support xAI provider.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **misc**: Add support xAI provider, closes [#4627](https://github.com/lobehub/lobe-chat/issues/4627) ([49e1e08](https://github.com/lobehub/lobe-chat/commit/49e1e08))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
30
+ ## [Version 1.30.0](https://github.com/lobehub/lobe-chat/compare/v1.29.6...v1.30.0)
31
+
32
+ <sup>Released on **2024-11-11**</sup>
33
+
34
+ #### ✨ Features
35
+
36
+ - **misc**: Support Cloudflare Workers AI.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's improved
44
+
45
+ - **misc**: Support Cloudflare Workers AI, closes [#3402](https://github.com/lobehub/lobe-chat/issues/3402) [/github.com/vercel/next.js/issues/38736#issuecomment-1278917422](https://github.com//github.com/vercel/next.js/issues/38736/issues/issuecomment-1278917422) ([efb7adf](https://github.com/lobehub/lobe-chat/commit/efb7adf))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ### [Version 1.29.6](https://github.com/lobehub/lobe-chat/compare/v1.29.5...v1.29.6)
6
56
 
7
57
  <sup>Released on **2024-11-10**</sup>
package/Dockerfile CHANGED
@@ -200,6 +200,8 @@ ENV \
200
200
  UPSTAGE_API_KEY="" UPSTAGE_MODEL_LIST="" \
201
201
  # Wenxin
202
202
  WENXIN_ACCESS_KEY="" WENXIN_SECRET_KEY="" WENXIN_MODEL_LIST="" \
203
+ # xAI
204
+ XAI_API_KEY="" XAI_MODEL_LIST="" \
203
205
  # 01.AI
204
206
  ZEROONE_API_KEY="" ZEROONE_MODEL_LIST="" \
205
207
  # Zhipu
@@ -235,6 +235,8 @@ ENV \
235
235
  UPSTAGE_API_KEY="" UPSTAGE_MODEL_LIST="" \
236
236
  # Wenxin
237
237
  WENXIN_ACCESS_KEY="" WENXIN_SECRET_KEY="" WENXIN_MODEL_LIST="" \
238
+ # xAI
239
+ XAI_API_KEY="" XAI_MODEL_LIST="" \
238
240
  # 01.AI
239
241
  ZEROONE_API_KEY="" ZEROONE_MODEL_LIST="" \
240
242
  # Zhipu
@@ -32,12 +32,12 @@ tags:
32
32
 
33
33
  ## 服务端数据库:便捷与高效的使用体验
34
34
 
35
- 对于追求便捷使用体验的用户,LobeChat 支持 PostgreSQL 作为服务端数据库。通过 Dirzzle ORM 管理数据,结合 Clerk 进行身份验证,LobeChat 能够为用户提供高效、可靠的服务端数据管理方案。
35
+ 对于追求便捷使用体验的用户,LobeChat 支持 PostgreSQL 作为服务端数据库。通过 Drizzle ORM 管理数据,结合 Clerk 进行身份验证,LobeChat 能够为用户提供高效、可靠的服务端数据管理方案。
36
36
 
37
37
  ### 服务端数据库技术栈
38
38
 
39
39
  - **DB**: PostgreSQL(默认使用 Neon)
40
- - **ORM**: Dirzzle ORM
40
+ - **ORM**: Drizzle ORM
41
41
  - **Auth**: Clerk
42
42
  - **Server Router**: tRPC
43
43
 
@@ -51,4 +51,4 @@ tags:
51
51
 
52
52
  服务端数据库方案则适合那些希望简化数据管理流程,享受便捷使用体验的用户。通过服务端数据库与用户身份验证,LobeChat 能够确保数据的安全性与高效性。如果您希望了解如何配置服务端数据库,请参考我们的[详细文档](/zh/docs/self-hosting/advanced/server-database)。
53
53
 
54
- 无论选择本地数据库还是服务端数据库,LobeChat 都能为你提供卓越的用户体验。
54
+ 无论选择本地数据库还是服务端数据库,LobeChat 都能为你提供卓越的用户体验。
@@ -51,6 +51,18 @@
51
51
  "title": "استخدام معلومات المصادقة الخاصة بـ Bedrock المخصصة"
52
52
  }
53
53
  },
54
+ "cloudflare": {
55
+ "apiKey": {
56
+ "desc": "يرجى ملء Cloudflare API Key",
57
+ "placeholder": "Cloudflare API Key",
58
+ "title": "Cloudflare API Key"
59
+ },
60
+ "baseURLOrAccountID": {
61
+ "desc": "أدخل رقم حساب Cloudflare أو عنوان URL API المخصص",
62
+ "placeholder": "رقم حساب Cloudflare / عنوان URL API المخصص",
63
+ "title": "رقم حساب Cloudflare / عنوان URL API"
64
+ }
65
+ },
54
66
  "github": {
55
67
  "personalAccessToken": {
56
68
  "desc": "أدخل رمز الوصول الشخصي الخاص بك على Github، انقر [هنا](https://github.com/settings/tokens) لإنشاء واحد",
@@ -51,6 +51,18 @@
51
51
  "title": "Използване на персонализирана информация за удостоверяване на Bedrock"
52
52
  }
53
53
  },
54
+ "cloudflare": {
55
+ "apiKey": {
56
+ "desc": "Моля, въведете Cloudflare API Key",
57
+ "placeholder": "Cloudflare API Key",
58
+ "title": "Cloudflare API Key"
59
+ },
60
+ "baseURLOrAccountID": {
61
+ "desc": "Въведете ID на Cloudflare или личен API адрес",
62
+ "placeholder": "ID на Cloudflare / личен API адрес",
63
+ "title": "ID на Cloudflare / API адрес"
64
+ }
65
+ },
54
66
  "github": {
55
67
  "personalAccessToken": {
56
68
  "desc": "Въведете вашия GitHub PAT, кликнете [тук](https://github.com/settings/tokens), за да създадете",
@@ -51,6 +51,18 @@
51
51
  "title": "Verwenden Sie benutzerdefinierte Bedrock-Authentifizierungsinformationen"
52
52
  }
53
53
  },
54
+ "cloudflare": {
55
+ "apiKey": {
56
+ "desc": "Bitte füllen Sie die Cloudflare API Key",
57
+ "placeholder": "Cloudflare API Key",
58
+ "title": "Cloudflare API Key"
59
+ },
60
+ "baseURLOrAccountID": {
61
+ "desc": "Eingeben Sie die Cloudflare-Kundenkennung oder die benutzerdefinierte API-Adresse",
62
+ "placeholder": "Cloudflare-Kundenkennung / benutzerdefinierte API-Adresse",
63
+ "title": "Cloudflare-Kundenkennung / API-Adresse"
64
+ }
65
+ },
54
66
  "github": {
55
67
  "personalAccessToken": {
56
68
  "desc": "Geben Sie Ihr GitHub-PAT ein und klicken Sie [hier](https://github.com/settings/tokens), um eines zu erstellen.",
@@ -51,6 +51,18 @@
51
51
  "title": "Use Custom Bedrock Authentication Information"
52
52
  }
53
53
  },
54
+ "cloudflare": {
55
+ "apiKey": {
56
+ "desc": "Please enter Cloudflare API Key",
57
+ "placeholder": "Cloudflare API Key",
58
+ "title": "Cloudflare API Key"
59
+ },
60
+ "baseURLOrAccountID": {
61
+ "desc": "Enter your Cloudflare account ID or custom API address",
62
+ "placeholder": "Cloudflare Account ID / custom API URL",
63
+ "title": "Cloudflare Account ID / API Address"
64
+ }
65
+ },
54
66
  "github": {
55
67
  "personalAccessToken": {
56
68
  "desc": "Enter your GitHub PAT. Click [here](https://github.com/settings/tokens) to create one.",
@@ -51,6 +51,18 @@
51
51
  "title": "Usar información de autenticación de Bedrock personalizada"
52
52
  }
53
53
  },
54
+ "cloudflare": {
55
+ "apiKey": {
56
+ "desc": "Por favor complete la Cloudflare API Key",
57
+ "placeholder": "Cloudflare API Key",
58
+ "title": "Cloudflare API Key"
59
+ },
60
+ "baseURLOrAccountID": {
61
+ "desc": "Ingrese el ID de cuenta de Cloudflare o la dirección URL personalizada de API",
62
+ "placeholder": "ID de cuenta de Cloudflare / URL de API personalizada",
63
+ "title": "ID de cuenta de Cloudflare / dirección URL de API"
64
+ }
65
+ },
54
66
  "github": {
55
67
  "personalAccessToken": {
56
68
  "desc": "Introduce tu PAT de Github, haz clic [aquí](https://github.com/settings/tokens) para crear uno",
@@ -51,6 +51,18 @@
51
51
  "title": "Utiliser des informations d'authentification Bedrock personnalisées"
52
52
  }
53
53
  },
54
+ "cloudflare": {
55
+ "apiKey": {
56
+ "desc": "Veuillez remplir l'Cloudflare API Key",
57
+ "placeholder": "Cloudflare API Key",
58
+ "title": "Cloudflare API Key"
59
+ },
60
+ "baseURLOrAccountID": {
61
+ "desc": "Saisir l'ID de compte Cloudflare ou l'adresse API personnalisée",
62
+ "placeholder": "ID de compte Cloudflare / URL API personnalisée",
63
+ "title": "ID de compte Cloudflare / adresse API"
64
+ }
65
+ },
54
66
  "github": {
55
67
  "personalAccessToken": {
56
68
  "desc": "Entrez votre PAT GitHub, cliquez [ici](https://github.com/settings/tokens) pour en créer un.",
@@ -51,6 +51,18 @@
51
51
  "title": "Usa le informazioni di autenticazione Bedrock personalizzate"
52
52
  }
53
53
  },
54
+ "cloudflare": {
55
+ "apiKey": {
56
+ "desc": "Compila l'Cloudflare API Key",
57
+ "placeholder": "Cloudflare API Key",
58
+ "title": "Cloudflare API Key"
59
+ },
60
+ "baseURLOrAccountID": {
61
+ "desc": "Inserisci l'ID dell'account Cloudflare o l'indirizzo API personalizzato",
62
+ "placeholder": "ID account Cloudflare / URL API personalizzato",
63
+ "title": "ID account Cloudflare / indirizzo API"
64
+ }
65
+ },
54
66
  "github": {
55
67
  "personalAccessToken": {
56
68
  "desc": "Inserisci il tuo PAT di Github, clicca [qui](https://github.com/settings/tokens) per crearne uno",
@@ -51,6 +51,18 @@
51
51
  "title": "使用カスタム Bedrock 認証情報"
52
52
  }
53
53
  },
54
+ "cloudflare": {
55
+ "apiKey": {
56
+ "desc": "Cloudflare API Key を入力してください",
57
+ "placeholder": "Cloudflare API Key",
58
+ "title": "Cloudflare API Key"
59
+ },
60
+ "baseURLOrAccountID": {
61
+ "desc": "Cloudflare アカウント ID またはカスタム API アドレスを入力してください。",
62
+ "placeholder": "Cloudflare アカウント ID / カスタム API URL",
63
+ "title": "Cloudflare アカウント ID / API アドレス"
64
+ }
65
+ },
54
66
  "github": {
55
67
  "personalAccessToken": {
56
68
  "desc": "あなたのGithub PATを入力してください。[こちら](https://github.com/settings/tokens)をクリックして作成します",
@@ -51,6 +51,18 @@
51
51
  "title": "사용자 정의 Bedrock 인증 정보 사용"
52
52
  }
53
53
  },
54
+ "cloudflare": {
55
+ "apiKey": {
56
+ "desc": "Cloudflare API Key 를 작성해 주세요.",
57
+ "placeholder": "Cloudflare API Key",
58
+ "title": "Cloudflare API Key"
59
+ },
60
+ "baseURLOrAccountID": {
61
+ "desc": "클라우드 플레어 계정 ID 또는 사용자 지정 API 주소 입력",
62
+ "placeholder": "클라우드 플레어 계정 ID / 사용자 지정 API 주소",
63
+ "title": "클라우드 플레어 계정 ID / API 주소"
64
+ }
65
+ },
54
66
  "github": {
55
67
  "personalAccessToken": {
56
68
  "desc": "당신의 Github PAT를 입력하세요. [여기](https://github.com/settings/tokens)를 클릭하여 생성하세요.",
@@ -51,6 +51,18 @@
51
51
  "title": "Gebruik aangepaste Bedrock-verificatiegegevens"
52
52
  }
53
53
  },
54
+ "cloudflare": {
55
+ "apiKey": {
56
+ "desc": "Voer Cloudflare API Key in",
57
+ "placeholder": "Cloudflare API Key",
58
+ "title": "Cloudflare API Key"
59
+ },
60
+ "baseURLOrAccountID": {
61
+ "desc": "Voer uw Cloudflare-account ID of een custom API-URL in",
62
+ "placeholder": "Cloudflare-account ID / custom API-URL",
63
+ "title": "Cloudflare-account ID / API-URL"
64
+ }
65
+ },
54
66
  "github": {
55
67
  "personalAccessToken": {
56
68
  "desc": "Vul je Github PAT in, klik [hier](https://github.com/settings/tokens) om er een te maken",
@@ -51,6 +51,18 @@
51
51
  "title": "Użyj niestandardowych informacji uwierzytelniających Bedrock"
52
52
  }
53
53
  },
54
+ "cloudflare": {
55
+ "apiKey": {
56
+ "desc": "Wprowadź klucz Cloudflare API Key",
57
+ "placeholder": "Cloudflare API Key",
58
+ "title": "Cloudflare API Key"
59
+ },
60
+ "baseURLOrAccountID": {
61
+ "desc": "Wprowadź ID konta Cloudflare lub adres API niestandardowy",
62
+ "placeholder": "ID konta Cloudflare / adres API niestandardowy",
63
+ "title": "ID konta Cloudflare / adres API"
64
+ }
65
+ },
54
66
  "github": {
55
67
  "personalAccessToken": {
56
68
  "desc": "Wprowadź swój osobisty token dostępu GitHub (PAT), kliknij [tutaj](https://github.com/settings/tokens), aby go utworzyć",
@@ -51,6 +51,18 @@
51
51
  "title": "Usar informações de autenticação Bedrock personalizadas"
52
52
  }
53
53
  },
54
+ "cloudflare": {
55
+ "apiKey": {
56
+ "desc": "Insira o Cloudflare API Key",
57
+ "placeholder": "Cloudflare API Key",
58
+ "title": "Cloudflare API Key"
59
+ },
60
+ "baseURLOrAccountID": {
61
+ "desc": "Insira o ID da conta do Cloudflare ou o endereço da API personalizado",
62
+ "placeholder": "ID da conta do Cloudflare / URL da API personalizada",
63
+ "title": "ID da conta do Cloudflare / Endereço da API"
64
+ }
65
+ },
54
66
  "github": {
55
67
  "personalAccessToken": {
56
68
  "desc": "Insira seu PAT do Github, clique [aqui](https://github.com/settings/tokens) para criar",
@@ -51,6 +51,18 @@
51
51
  "title": "Использовать пользовательскую информацию аутентификации Bedrock"
52
52
  }
53
53
  },
54
+ "cloudflare": {
55
+ "apiKey": {
56
+ "desc": "Пожалуйста, заполните Cloudflare API Key",
57
+ "placeholder": "Cloudflare API Key",
58
+ "title": "Cloudflare API Key"
59
+ },
60
+ "baseURLOrAccountID": {
61
+ "desc": "Введите ID аккаунта Cloudflare или адрес API по умолчанию",
62
+ "placeholder": "ID аккаунта Cloudflare / адрес API по умолчанию",
63
+ "title": "ID аккаунта Cloudflare / адрес API"
64
+ }
65
+ },
54
66
  "github": {
55
67
  "personalAccessToken": {
56
68
  "desc": "Введите ваш персональный токен доступа GitHub (PAT), нажмите [здесь](https://github.com/settings/tokens), чтобы создать его",
@@ -51,6 +51,18 @@
51
51
  "title": "Özel Bedrock Kimlik Bilgilerini Kullan"
52
52
  }
53
53
  },
54
+ "cloudflare": {
55
+ "apiKey": {
56
+ "desc": "Lütfen doldurun Cloudflare API Key",
57
+ "placeholder": "Cloudflare API Key",
58
+ "title": "Cloudflare API Key"
59
+ },
60
+ "baseURLOrAccountID": {
61
+ "desc": "Cloudflare hesabınızın ID'sini veya özel API adresinizi girin",
62
+ "placeholder": "Cloudflare Hesap ID / Özel API Adresi",
63
+ "title": "Cloudflare Hesap ID / API Adresi"
64
+ }
65
+ },
54
66
  "github": {
55
67
  "personalAccessToken": {
56
68
  "desc": "Github PAT'nizi girin, [buraya](https://github.com/settings/tokens) tıklayarak oluşturun",
@@ -51,6 +51,18 @@
51
51
  "title": "Sử dụng Thông tin Xác thực Bedrock tùy chỉnh"
52
52
  }
53
53
  },
54
+ "cloudflare": {
55
+ "apiKey": {
56
+ "desc": "Vui lòng nhập Cloudflare API Key",
57
+ "placeholder": "Cloudflare API Key",
58
+ "title": "Cloudflare API Key"
59
+ },
60
+ "baseURLOrAccountID": {
61
+ "desc": "Nhập ID tài khoản Cloudflare hoặc địa chỉ API tùy chỉnh",
62
+ "placeholder": "ID tài khoản Cloudflare / địa chỉ API tùy chỉnh",
63
+ "title": "ID tài khoản Cloudflare / địa chỉ API"
64
+ }
65
+ },
54
66
  "github": {
55
67
  "personalAccessToken": {
56
68
  "desc": "Nhập mã truy cập cá nhân Github của bạn, nhấp vào [đây](https://github.com/settings/tokens) để tạo",
@@ -51,6 +51,18 @@
51
51
  "title": "使用自定义 Bedrock 鉴权信息"
52
52
  }
53
53
  },
54
+ "cloudflare": {
55
+ "apiKey": {
56
+ "desc": "请填写 Cloudflare API Key",
57
+ "placeholder": "Cloudflare API Key",
58
+ "title": "Cloudflare API Key"
59
+ },
60
+ "baseURLOrAccountID": {
61
+ "desc": "填入 Cloudflare 账户 ID 或 自定义 API 地址",
62
+ "placeholder": "Cloudflare Account ID / custom API URL",
63
+ "title": "Cloudflare 账户 ID / API 地址"
64
+ }
65
+ },
54
66
  "github": {
55
67
  "personalAccessToken": {
56
68
  "desc": "填入你的 Github PAT,点击 [这里](https://github.com/settings/tokens) 创建",
@@ -51,6 +51,18 @@
51
51
  "title": "使用自定義 Bedrock 驗證資訊"
52
52
  }
53
53
  },
54
+ "cloudflare": {
55
+ "apiKey": {
56
+ "desc": "請填入 Cloudflare API Key",
57
+ "placeholder": "Cloudflare API Key",
58
+ "title": "Cloudflare API Key"
59
+ },
60
+ "baseURLOrAccountID": {
61
+ "desc": "填入 Cloudflare 帳戶 ID 或 自定義 API 位址",
62
+ "placeholder": "Cloudflare 帳戶 ID / 自定義 API 位址",
63
+ "title": "Cloudflare 帳戶 ID / API 位址"
64
+ }
65
+ },
54
66
  "github": {
55
67
  "personalAccessToken": {
56
68
  "desc": "填入你的 Github 個人存取權杖,點擊[這裡](https://github.com/settings/tokens) 創建",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.29.6",
3
+ "version": "1.31.0",
4
4
  "description": "Lobe Chat - an open-source, high-performance chatbot 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",
@@ -123,7 +123,7 @@
123
123
  "@langchain/community": "^0.3.0",
124
124
  "@lobehub/chat-plugin-sdk": "^1.32.4",
125
125
  "@lobehub/chat-plugins-gateway": "^1.9.0",
126
- "@lobehub/icons": "^1.37.0",
126
+ "@lobehub/icons": "^1.38.1",
127
127
  "@lobehub/tts": "^1.25.1",
128
128
  "@lobehub/ui": "^1.152.0",
129
129
  "@neondatabase/serverless": "^0.10.1",
@@ -0,0 +1,43 @@
1
+ 'use client';
2
+
3
+ import { Input } from 'antd';
4
+ import { useTranslation } from 'react-i18next';
5
+
6
+ import { CloudflareProviderCard } from '@/config/modelProviders';
7
+ import { GlobalLLMProviderKey } from '@/types/user/settings';
8
+
9
+ import { KeyVaultsConfigKey } from '../../const';
10
+ import { ProviderItem } from '../../type';
11
+
12
+ const providerKey: GlobalLLMProviderKey = 'cloudflare';
13
+
14
+ export const useCloudflareProvider = (): ProviderItem => {
15
+ const { t } = useTranslation('modelProvider');
16
+
17
+ return {
18
+ ...CloudflareProviderCard,
19
+ apiKeyItems: [
20
+ {
21
+ children: (
22
+ <Input.Password
23
+ autoComplete={'new-password'}
24
+ placeholder={t(`${providerKey}.apiKey.placeholder`)}
25
+ />
26
+ ),
27
+ desc: t(`${providerKey}.apiKey.desc`),
28
+ label: t(`${providerKey}.apiKey.title`),
29
+ name: [KeyVaultsConfigKey, providerKey, 'apiKey'],
30
+ },
31
+ {
32
+ children: (
33
+ <Input
34
+ placeholder={t(`${providerKey}.baseURLOrAccountID.placeholder`)}
35
+ />
36
+ ),
37
+ desc: t(`${providerKey}.baseURLOrAccountID.desc`),
38
+ label: t(`${providerKey}.baseURLOrAccountID.title`),
39
+ name: [KeyVaultsConfigKey, providerKey, 'baseURLOrAccountID'],
40
+ },
41
+ ],
42
+ };
43
+ };
@@ -23,6 +23,7 @@ import {
23
23
  TaichuProviderCard,
24
24
  TogetherAIProviderCard,
25
25
  UpstageProviderCard,
26
+ XAIProviderCard,
26
27
  ZeroOneProviderCard,
27
28
  ZhiPuProviderCard,
28
29
  } from '@/config/modelProviders';
@@ -30,6 +31,7 @@ import {
30
31
  import { ProviderItem } from '../type';
31
32
  import { useAzureProvider } from './Azure';
32
33
  import { useBedrockProvider } from './Bedrock';
34
+ import { useCloudflareProvider } from './Cloudflare';
33
35
  import { useGithubProvider } from './Github';
34
36
  import { useHuggingFaceProvider } from './HuggingFace';
35
37
  import { useOllamaProvider } from './Ollama';
@@ -42,6 +44,7 @@ export const useProviderList = (): ProviderItem[] => {
42
44
  const OllamaProvider = useOllamaProvider();
43
45
  const OpenAIProvider = useOpenAIProvider();
44
46
  const BedrockProvider = useBedrockProvider();
47
+ const CloudflareProvider = useCloudflareProvider();
45
48
  const GithubProvider = useGithubProvider();
46
49
  const HuggingFaceProvider = useHuggingFaceProvider();
47
50
  const WenxinProvider = useWenxinProvider();
@@ -58,6 +61,7 @@ export const useProviderList = (): ProviderItem[] => {
58
61
  DeepSeekProviderCard,
59
62
  HuggingFaceProvider,
60
63
  OpenRouterProviderCard,
64
+ CloudflareProvider,
61
65
  GithubProvider,
62
66
  NovitaProviderCard,
63
67
  TogetherAIProviderCard,
@@ -67,6 +71,7 @@ export const useProviderList = (): ProviderItem[] => {
67
71
  MistralProviderCard,
68
72
  Ai21ProviderCard,
69
73
  UpstageProviderCard,
74
+ XAIProviderCard,
70
75
  QwenProviderCard,
71
76
  WenxinProvider,
72
77
  HunyuanProviderCard,
@@ -87,6 +92,7 @@ export const useProviderList = (): ProviderItem[] => {
87
92
  OllamaProvider,
88
93
  OpenAIProvider,
89
94
  BedrockProvider,
95
+ CloudflareProvider,
90
96
  GithubProvider,
91
97
  WenxinProvider,
92
98
  HuggingFaceProvider,
package/src/config/llm.ts CHANGED
@@ -115,6 +115,10 @@ export const getLLMConfig = () => {
115
115
  TAICHU_API_KEY: z.string().optional(),
116
116
  TAICHU_MODEL_LIST: z.string().optional(),
117
117
 
118
+ ENABLED_CLOUDFLARE: z.boolean(),
119
+ CLOUDFLARE_API_KEY: z.string().optional(),
120
+ CLOUDFLARE_BASE_URL_OR_ACCOUNT_ID: z.string().optional(),
121
+
118
122
  ENABLED_AI360: z.boolean(),
119
123
  AI360_API_KEY: z.string().optional(),
120
124
  AI360_MODEL_LIST: z.string().optional(),
@@ -149,6 +153,10 @@ export const getLLMConfig = () => {
149
153
  SENSENOVA_ACCESS_KEY_ID: z.string().optional(),
150
154
  SENSENOVA_ACCESS_KEY_SECRET: z.string().optional(),
151
155
  SENSENOVA_MODEL_LIST: z.string().optional(),
156
+
157
+ ENABLED_XAI: z.boolean(),
158
+ XAI_API_KEY: z.string().optional(),
159
+ XAI_MODEL_LIST: z.string().optional(),
152
160
  },
153
161
  runtimeEnv: {
154
162
  API_KEY_SELECT_MODE: process.env.API_KEY_SELECT_MODE,
@@ -261,6 +269,11 @@ export const getLLMConfig = () => {
261
269
  TAICHU_API_KEY: process.env.TAICHU_API_KEY,
262
270
  TAICHU_MODEL_LIST: process.env.TAICHU_MODEL_LIST,
263
271
 
272
+ ENABLED_CLOUDFLARE:
273
+ !!process.env.CLOUDFLARE_API_KEY && !!process.env.CLOUDFLARE_BASE_URL_OR_ACCOUNT_ID,
274
+ CLOUDFLARE_API_KEY: process.env.CLOUDFLARE_API_KEY,
275
+ CLOUDFLARE_BASE_URL_OR_ACCOUNT_ID: process.env.CLOUDFLARE_BASE_URL_OR_ACCOUNT_ID,
276
+
264
277
  ENABLED_AI360: !!process.env.AI360_API_KEY,
265
278
  AI360_API_KEY: process.env.AI360_API_KEY,
266
279
  AI360_MODEL_LIST: process.env.AI360_MODEL_LIST,
@@ -295,6 +308,10 @@ export const getLLMConfig = () => {
295
308
  SENSENOVA_ACCESS_KEY_ID: process.env.SENSENOVA_ACCESS_KEY_ID,
296
309
  SENSENOVA_ACCESS_KEY_SECRET: process.env.SENSENOVA_ACCESS_KEY_SECRET,
297
310
  SENSENOVA_MODEL_LIST: process.env.SENSENOVA_MODEL_LIST,
311
+
312
+ ENABLED_XAI: !!process.env.XAI_API_KEY,
313
+ XAI_API_KEY: process.env.XAI_API_KEY,
314
+ XAI_MODEL_LIST: process.env.XAI_MODEL_LIST,
298
315
  },
299
316
  });
300
317
  };