@lobehub/chat 1.29.5 → 1.30.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 (42) hide show
  1. package/.env.example +5 -0
  2. package/CHANGELOG.md +50 -0
  3. package/locales/ar/modelProvider.json +12 -0
  4. package/locales/bg-BG/modelProvider.json +12 -0
  5. package/locales/de-DE/modelProvider.json +12 -0
  6. package/locales/en-US/modelProvider.json +12 -0
  7. package/locales/es-ES/modelProvider.json +12 -0
  8. package/locales/fr-FR/modelProvider.json +12 -0
  9. package/locales/it-IT/modelProvider.json +12 -0
  10. package/locales/ja-JP/modelProvider.json +12 -0
  11. package/locales/ko-KR/modelProvider.json +12 -0
  12. package/locales/nl-NL/modelProvider.json +12 -0
  13. package/locales/pl-PL/modelProvider.json +12 -0
  14. package/locales/pt-BR/modelProvider.json +12 -0
  15. package/locales/ru-RU/modelProvider.json +12 -0
  16. package/locales/tr-TR/modelProvider.json +12 -0
  17. package/locales/vi-VN/modelProvider.json +12 -0
  18. package/locales/zh-CN/modelProvider.json +12 -0
  19. package/locales/zh-TW/modelProvider.json +12 -0
  20. package/package.json +2 -2
  21. package/src/app/(main)/settings/llm/ProviderList/Cloudflare/index.tsx +43 -0
  22. package/src/app/(main)/settings/llm/ProviderList/providers.tsx +4 -0
  23. package/src/config/llm.ts +9 -0
  24. package/src/config/modelProviders/bedrock.ts +14 -0
  25. package/src/config/modelProviders/cloudflare.ts +89 -0
  26. package/src/config/modelProviders/index.ts +4 -0
  27. package/src/const/auth.ts +2 -0
  28. package/src/const/settings/llm.ts +5 -0
  29. package/src/libs/agent-runtime/AgentRuntime.ts +7 -1
  30. package/src/libs/agent-runtime/cloudflare/index.test.ts +648 -0
  31. package/src/libs/agent-runtime/cloudflare/index.ts +123 -0
  32. package/src/libs/agent-runtime/types/type.ts +1 -0
  33. package/src/libs/agent-runtime/utils/cloudflareHelpers.test.ts +339 -0
  34. package/src/libs/agent-runtime/utils/cloudflareHelpers.ts +134 -0
  35. package/src/locales/default/modelProvider.ts +13 -1
  36. package/src/server/globalConfig/index.ts +4 -0
  37. package/src/server/modules/AgentRuntime/index.ts +11 -0
  38. package/src/services/_auth.ts +9 -0
  39. package/src/services/chat.ts +7 -0
  40. package/src/store/user/slices/modelList/selectors/keyVaults.ts +2 -0
  41. package/src/store/user/slices/modelList/selectors/modelConfig.ts +2 -0
  42. package/src/types/user/settings/keyVaults.ts +6 -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.30.0](https://github.com/lobehub/lobe-chat/compare/v1.29.6...v1.30.0)
6
+
7
+ <sup>Released on **2024-11-11**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **misc**: Support Cloudflare Workers AI.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **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))
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.29.6](https://github.com/lobehub/lobe-chat/compare/v1.29.5...v1.29.6)
31
+
32
+ <sup>Released on **2024-11-10**</sup>
33
+
34
+ #### 💄 Styles
35
+
36
+ - **misc**: Add Sonnet 3.5 v2 inference model to BedRock.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### Styles
44
+
45
+ - **misc**: Add Sonnet 3.5 v2 inference model to BedRock, closes [#4652](https://github.com/lobehub/lobe-chat/issues/4652) ([1a8584d](https://github.com/lobehub/lobe-chat/commit/1a8584d))
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.5](https://github.com/lobehub/lobe-chat/compare/v1.29.4...v1.29.5)
6
56
 
7
57
  <sup>Released on **2024-11-10**</sup>
@@ -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.5",
3
+ "version": "1.30.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
+ };
@@ -30,6 +30,7 @@ import {
30
30
  import { ProviderItem } from '../type';
31
31
  import { useAzureProvider } from './Azure';
32
32
  import { useBedrockProvider } from './Bedrock';
33
+ import { useCloudflareProvider } from './Cloudflare';
33
34
  import { useGithubProvider } from './Github';
34
35
  import { useHuggingFaceProvider } from './HuggingFace';
35
36
  import { useOllamaProvider } from './Ollama';
@@ -42,6 +43,7 @@ export const useProviderList = (): ProviderItem[] => {
42
43
  const OllamaProvider = useOllamaProvider();
43
44
  const OpenAIProvider = useOpenAIProvider();
44
45
  const BedrockProvider = useBedrockProvider();
46
+ const CloudflareProvider = useCloudflareProvider();
45
47
  const GithubProvider = useGithubProvider();
46
48
  const HuggingFaceProvider = useHuggingFaceProvider();
47
49
  const WenxinProvider = useWenxinProvider();
@@ -58,6 +60,7 @@ export const useProviderList = (): ProviderItem[] => {
58
60
  DeepSeekProviderCard,
59
61
  HuggingFaceProvider,
60
62
  OpenRouterProviderCard,
63
+ CloudflareProvider,
61
64
  GithubProvider,
62
65
  NovitaProviderCard,
63
66
  TogetherAIProviderCard,
@@ -87,6 +90,7 @@ export const useProviderList = (): ProviderItem[] => {
87
90
  OllamaProvider,
88
91
  OpenAIProvider,
89
92
  BedrockProvider,
93
+ CloudflareProvider,
90
94
  GithubProvider,
91
95
  WenxinProvider,
92
96
  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(),
@@ -261,6 +265,11 @@ export const getLLMConfig = () => {
261
265
  TAICHU_API_KEY: process.env.TAICHU_API_KEY,
262
266
  TAICHU_MODEL_LIST: process.env.TAICHU_MODEL_LIST,
263
267
 
268
+ ENABLED_CLOUDFLARE:
269
+ !!process.env.CLOUDFLARE_API_KEY && !!process.env.CLOUDFLARE_BASE_URL_OR_ACCOUNT_ID,
270
+ CLOUDFLARE_API_KEY: process.env.CLOUDFLARE_API_KEY,
271
+ CLOUDFLARE_BASE_URL_OR_ACCOUNT_ID: process.env.CLOUDFLARE_BASE_URL_OR_ACCOUNT_ID,
272
+
264
273
  ENABLED_AI360: !!process.env.AI360_API_KEY,
265
274
  AI360_API_KEY: process.env.AI360_API_KEY,
266
275
  AI360_MODEL_LIST: process.env.AI360_MODEL_LIST,
@@ -40,6 +40,20 @@ const Bedrock: ModelProviderCard = {
40
40
  tokens: 200_000,
41
41
  vision: true,
42
42
  },
43
+ {
44
+ description:
45
+ 'Claude 3.5 Sonnet 提升了行业标准,性能超过竞争对手模型和 Claude 3 Opus,在广泛的评估中表现出色,同时具有我们中等层级模型的速度和成本。',
46
+ displayName: 'Claude 3.5 Sonnet v2 (Inference profile)',
47
+ enabled: true,
48
+ functionCall: true,
49
+ id: 'us.anthropic.claude-3-5-sonnet-20241022-v2:0',
50
+ pricing: {
51
+ input: 3,
52
+ output: 15,
53
+ },
54
+ tokens: 200_000,
55
+ vision: true,
56
+ },
43
57
  {
44
58
  description:
45
59
  'Claude 3.5 Sonnet 提升了行业标准,性能超过竞争对手模型和 Claude 3 Opus,在广泛的评估中表现出色,同时具有我们中等层级模型的速度和成本。',
@@ -0,0 +1,89 @@
1
+ import { ModelProviderCard } from '@/types/llm';
2
+
3
+ // ref https://developers.cloudflare.com/workers-ai/models/#text-generation
4
+ // api https://developers.cloudflare.com/workers-ai/configuration/open-ai-compatibility
5
+ const Cloudflare: ModelProviderCard = {
6
+ chatModels: [
7
+ {
8
+ displayName: 'deepseek-coder-6.7b-instruct-awq',
9
+ enabled: true,
10
+ id: '@hf/thebloke/deepseek-coder-6.7b-instruct-awq',
11
+ tokens: 16_384,
12
+ },
13
+ {
14
+ displayName: 'gemma-7b-it',
15
+ enabled: true,
16
+ id: '@hf/google/gemma-7b-it',
17
+ tokens: 2048,
18
+ },
19
+ {
20
+ displayName: 'hermes-2-pro-mistral-7b',
21
+ enabled: true,
22
+ // functionCall: true,
23
+ id: '@hf/nousresearch/hermes-2-pro-mistral-7b',
24
+ tokens: 4096,
25
+ },
26
+ {
27
+ displayName: 'llama-3-8b-instruct-awq',
28
+ id: '@cf/meta/llama-3-8b-instruct-awq',
29
+ tokens: 8192,
30
+ },
31
+ {
32
+ displayName: 'mistral-7b-instruct-v0.2',
33
+ id: '@hf/mistral/mistral-7b-instruct-v0.2',
34
+ tokens: 4096,
35
+ },
36
+ {
37
+ displayName: 'neural-chat-7b-v3-1-awq',
38
+ enabled: true,
39
+ id: '@hf/thebloke/neural-chat-7b-v3-1-awq',
40
+ tokens: 32_768,
41
+ },
42
+ {
43
+ displayName: 'openchat-3.5-0106',
44
+ id: '@cf/openchat/openchat-3.5-0106',
45
+ tokens: 8192,
46
+ },
47
+ {
48
+ displayName: 'openhermes-2.5-mistral-7b-awq',
49
+ enabled: true,
50
+ id: '@hf/thebloke/openhermes-2.5-mistral-7b-awq',
51
+ tokens: 32_768,
52
+ },
53
+ {
54
+ displayName: 'qwen1.5-14b-chat-awq',
55
+ enabled: true,
56
+ id: '@cf/qwen/qwen1.5-14b-chat-awq',
57
+ tokens: 32_768,
58
+ },
59
+ {
60
+ displayName: 'starling-lm-7b-beta',
61
+ enabled: true,
62
+ id: '@hf/nexusflow/starling-lm-7b-beta',
63
+ tokens: 4096,
64
+ },
65
+ {
66
+ displayName: 'zephyr-7b-beta-awq',
67
+ enabled: true,
68
+ id: '@hf/thebloke/zephyr-7b-beta-awq',
69
+ tokens: 32_768,
70
+ },
71
+ {
72
+ description:
73
+ 'Generation over generation, Meta Llama 3 demonstrates state-of-the-art performance on a wide range of industry benchmarks and offers new capabilities, including improved reasoning.\t',
74
+ displayName: 'meta-llama-3-8b-instruct',
75
+ enabled: true,
76
+ functionCall: false,
77
+ id: '@hf/meta-llama/meta-llama-3-8b-instruct',
78
+ },
79
+ ],
80
+ checkModel: '@hf/meta-llama/meta-llama-3-8b-instruct',
81
+ id: 'cloudflare',
82
+ modelList: {
83
+ showModelFetcher: true,
84
+ },
85
+ name: 'Cloudflare Workers AI',
86
+ url: 'https://developers.cloudflare.com/workers-ai/models',
87
+ };
88
+
89
+ export default Cloudflare;