@lobehub/chat 0.133.5 → 0.134.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.134.1](https://github.com/lobehub/lobe-chat/compare/v0.134.0...v0.134.1)
6
+
7
+ <sup>Released on **2024-03-13**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: Add more model display name.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: Add more model display name, closes [#1554](https://github.com/lobehub/lobe-chat/issues/1554) ([31c987a](https://github.com/lobehub/lobe-chat/commit/31c987a))
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 0.134.0](https://github.com/lobehub/lobe-chat/compare/v0.133.5...v0.134.0)
31
+
32
+ <sup>Released on **2024-03-13**</sup>
33
+
34
+ #### ✨ Features
35
+
36
+ - **misc**: Support anthropic proxy url.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's improved
44
+
45
+ - **misc**: Support anthropic proxy url, closes [#1529](https://github.com/lobehub/lobe-chat/issues/1529) ([a5a9257](https://github.com/lobehub/lobe-chat/commit/a5a9257))
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 0.133.5](https://github.com/lobehub/lobe-chat/compare/v0.133.4...v0.133.5)
6
56
 
7
57
  <sup>Released on **2024-03-12**</sup>
package/README.md CHANGED
@@ -255,14 +255,14 @@ Our marketplace is not just a showcase platform but also a collaborative space.
255
255
 
256
256
  <!-- AGENT LIST -->
257
257
 
258
- | Recent Submits | Description |
259
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
260
- | [Gen Z Engagement Specialist](https://chat-preview.lobehub.com/market?agent=gen-z)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-03-09**</sup> | Specializes in engaging Gen Z users with tailored interactions reflecting their preferences and values.<br/>`engagement` `gen-z` `communication` `advice` `interaction` |
261
- | [Schedule Management Assistant](https://chat-preview.lobehub.com/market?agent=calendar-manager)<br/><sup>By **[ccdanpian](https://github.com/ccdanpian)** on **2024-03-07**</sup> | Schedule Management Assistant, calls the time plugin to handle requests for adding, querying, and deleting schedules, supports multiple operations and reminders.<br/>`schedule-management` `time-plugin` `add-schedule` `query-schedule` `delete-schedule` |
262
- | [Business Email Writing Expert](https://chat-preview.lobehub.com/market?agent=business-email)<br/><sup>By **[canisminor1990](https://github.com/canisminor1990)** on **2024-03-06**</sup> | Business email writing expert specializing in bilingual business emails in Chinese and English, cross-cultural communication, and engagement in the GitHub open-source community.<br/>`business-email-writing` `business-cooperation` `business-authorization` `cross-cultural-communication` `git-hub-and-open-source-community` |
263
- | [Discord Style Copywriting Expert](https://chat-preview.lobehub.com/market?agent=discord-copywriting)<br/><sup>By **[canisminor1990](https://github.com/canisminor1990)** on **2024-03-06**</sup> | A copywriting expert in Discord style, prioritizing humor and user experience, specializing in personalized software copywriting.<br/>`copywriting` `creation` `user-experience` `humor` `software-system` |
264
-
265
- > 📊 Total agents: [<kbd>**200**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
258
+ | Recent Submits | Description |
259
+ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
260
+ | [TikTok Script Writer](https://chat-preview.lobehub.com/market?agent=tiktok-script-writer)<br/><sup>By **[sdhjn19dj1m](https://github.com/sdhjn19dj1m)** on **2024-03-12**</sup> | This script is tailored for TikTok's short video format, designed to engage and entertain the specified target audience. It incorporates trending elements and best practices for content virality, ensuring the video captures attention from the start. The script is structured to include a captivating opening, concise and impactful message body, and a compelling call-to-action, all while reflecting the user's desired tone and theme.<br/>`tik-tok` `short-video` `viral-content` `trending-hashtag` `engagement` |
261
+ | [Gen Z Engagement Specialist](https://chat-preview.lobehub.com/market?agent=gen-z)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-03-09**</sup> | Specializes in engaging Gen Z users with tailored interactions reflecting their preferences and values.<br/>`engagement` `gen-z` `communication` `advice` `interaction` |
262
+ | [Schedule Management Assistant](https://chat-preview.lobehub.com/market?agent=calendar-manager)<br/><sup>By **[ccdanpian](https://github.com/ccdanpian)** on **2024-03-07**</sup> | Schedule Management Assistant, calls the time plugin to handle requests for adding, querying, and deleting schedules, supports multiple operations and reminders.<br/>`schedule-management` `time-plugin` `add-schedule` `query-schedule` `delete-schedule` |
263
+ | [Business Email Writing Expert](https://chat-preview.lobehub.com/market?agent=business-email)<br/><sup>By **[canisminor1990](https://github.com/canisminor1990)** on **2024-03-06**</sup> | Business email writing expert specializing in bilingual business emails in Chinese and English, cross-cultural communication, and engagement in the GitHub open-source community.<br/>`business-email-writing` `business-cooperation` `business-authorization` `cross-cultural-communication` `git-hub-and-open-source-community` |
264
+
265
+ > 📊 Total agents: [<kbd>**201**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
266
266
 
267
267
  <!-- AGENT LIST -->
268
268
 
package/README.zh-CN.md CHANGED
@@ -243,14 +243,14 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
243
243
 
244
244
  <!-- AGENT LIST -->
245
245
 
246
- | 最近新增 | 助手说明 |
247
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
248
- | [Gen Z Engagement Specialist](https://chat-preview.lobehub.com/market?agent=gen-z)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-03-09**</sup> | 专注于通过定制互动反映他们的偏好和价值观,与 Gen Z 用户进行互动。<br/>`engagement` `gen-z` `communication` `advice` `interaction` |
249
- | [日程管理助手](https://chat-preview.lobehub.com/market?agent=calendar-manager)<br/><sup>By **[ccdanpian](https://github.com/ccdanpian)** on **2024-03-07**</sup> | 日程管理助手,调用时间插件,处理新增、查询、删除日程请求,支持多种操作和提醒。<br/>`日程管理` `时间插件` `新增日程` `查询日程` `删除日程` |
250
- | [商务邮件撰写专家](https://chat-preview.lobehub.com/market?agent=business-email)<br/><sup>By **[canisminor1990](https://github.com/canisminor1990)** on **2024-03-06**</sup> | 商务邮件撰写专家,擅长中英文商务邮件,跨文化沟通,GitHub 开源社区交流。<br/>`商务邮件撰写` `商业合作` `商务授权` `跨文化沟通` `git-hub和开源社区` |
251
- | [Discord 风格文案大师](https://chat-preview.lobehub.com/market?agent=discord-copywriting)<br/><sup>By **[canisminor1990](https://github.com/canisminor1990)** on **2024-03-06**</sup> | Discord 风格文案专家,幽默风趣、用户体验优先,个性化设计软件文案。<br/>`文案生成` `创作` `用户体验` `幽默风趣` `软件系统` |
252
-
253
- > 📊 Total agents: [<kbd>**200**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
246
+ | 最近新增 | 助手说明 |
247
+ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
248
+ | [TikTok 脚本撰写器](https://chat-preview.lobehub.com/market?agent=tiktok-script-writer)<br/><sup>By **[sdhjn19dj1m](https://github.com/sdhjn19dj1m)** on **2024-03-12**</sup> | 此脚本专为 TikTok 的短视频格式量身定制,旨在吸引和娱乐特定目标受众。它融入了流行元素和内容病毒传播的最佳实践,确保视频从一开始就吸引注意力。脚本结构包括引人入胜的开场、简洁而有影响力的主体信息和引人注目的行动号召,同时反映用户期望的语气和主题。<br/>`tik-tok` `short-video` `viral-content` `trending-hashtag` `engagement` |
249
+ | [Gen Z Engagement Specialist](https://chat-preview.lobehub.com/market?agent=gen-z)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-03-09**</sup> | 专注于通过定制互动反映他们的偏好和价值观,与 Gen Z 用户进行互动。<br/>`engagement` `gen-z` `communication` `advice` `interaction` |
250
+ | [日程管理助手](https://chat-preview.lobehub.com/market?agent=calendar-manager)<br/><sup>By **[ccdanpian](https://github.com/ccdanpian)** on **2024-03-07**</sup> | 日程管理助手,调用时间插件,处理新增、查询、删除日程请求,支持多种操作和提醒。<br/>`日程管理` `时间插件` `新增日程` `查询日程` `删除日程` |
251
+ | [商务邮件撰写专家](https://chat-preview.lobehub.com/market?agent=business-email)<br/><sup>By **[canisminor1990](https://github.com/canisminor1990)** on **2024-03-06**</sup> | 商务邮件撰写专家,擅长中英文商务邮件,跨文化沟通,GitHub 开源社区交流。<br/>`商务邮件撰写` `商业合作` `商务授权` `跨文化沟通` `git-hub和开源社区` |
252
+
253
+ > 📊 Total agents: [<kbd>**201**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
254
254
 
255
255
  <!-- AGENT LIST -->
256
256
 
@@ -32,6 +32,11 @@
32
32
  },
33
33
  "llm": {
34
34
  "Anthropic": {
35
+ "endpoint": {
36
+ "desc": "بخلاف العنوان الافتراضي، يجب أن يتضمن http(s)://",
37
+ "placeholder": "https://api.anthropic.com",
38
+ "title": "عنوان وكيل الواجهة البرمجية للتطبيقات"
39
+ },
35
40
  "title": "أنثروبيك",
36
41
  "token": {
37
42
  "desc": "أدخل مفتاح API من أنثروبيك",
@@ -423,4 +428,4 @@
423
428
  },
424
429
  "title": "أدوات الامتداد"
425
430
  }
426
- }
431
+ }
@@ -32,6 +32,11 @@
32
32
  },
33
33
  "llm": {
34
34
  "Anthropic": {
35
+ "endpoint": {
36
+ "desc": "Muss die Standardadresse enthalten sowie http(s)://",
37
+ "placeholder": "https://api.anthropic.com",
38
+ "title": "API-Proxy-Adresse"
39
+ },
35
40
  "title": "Anthropic",
36
41
  "token": {
37
42
  "desc": "Geben Sie den API-Schlüssel von Anthropic ein",
@@ -423,4 +428,4 @@
423
428
  },
424
429
  "title": "Erweiterungswerkzeuge"
425
430
  }
426
- }
431
+ }
@@ -32,6 +32,11 @@
32
32
  },
33
33
  "llm": {
34
34
  "Anthropic": {
35
+ "endpoint": {
36
+ "desc": "Must include http(s):// besides the default address",
37
+ "placeholder": "https://api.anthropic.com",
38
+ "title": "API Proxy Address"
39
+ },
35
40
  "title": "Anthropic",
36
41
  "token": {
37
42
  "desc": "Enter the API Key from Anthropic",
@@ -423,4 +428,4 @@
423
428
  },
424
429
  "title": "Extension Tools"
425
430
  }
426
- }
431
+ }
@@ -32,6 +32,11 @@
32
32
  },
33
33
  "llm": {
34
34
  "Anthropic": {
35
+ "endpoint": {
36
+ "desc": "Debe incluir http(s):// además de la dirección predeterminada",
37
+ "placeholder": "https://api.anthropic.com",
38
+ "title": "Dirección del proxy de la API"
39
+ },
35
40
  "title": "Anthropic",
36
41
  "token": {
37
42
  "desc": "Introduce la clave API de Anthropic",
@@ -423,4 +428,4 @@
423
428
  },
424
429
  "title": "Herramientas de extensión"
425
430
  }
426
- }
431
+ }
@@ -32,6 +32,11 @@
32
32
  },
33
33
  "llm": {
34
34
  "Anthropic": {
35
+ "endpoint": {
36
+ "desc": "En dehors de l'adresse par défaut, doit inclure http(s)://",
37
+ "placeholder": "https://api.anthropic.com",
38
+ "title": "Adresse de l'API proxy"
39
+ },
35
40
  "title": "Anthropic",
36
41
  "token": {
37
42
  "desc": "Entrez votre clé API Anthropic",
@@ -423,4 +428,4 @@
423
428
  },
424
429
  "title": "Outils supplémentaires"
425
430
  }
426
- }
431
+ }
@@ -32,6 +32,11 @@
32
32
  },
33
33
  "llm": {
34
34
  "Anthropic": {
35
+ "endpoint": {
36
+ "desc": "Deve includere http(s):// oltre all'indirizzo predefinito",
37
+ "placeholder": "https://api.anthropic.com",
38
+ "title": "Indirizzo dell'API proxy"
39
+ },
35
40
  "title": "Anthropic",
36
41
  "token": {
37
42
  "desc": "Inserisci la chiave API di Anthropic",
@@ -423,4 +428,4 @@
423
428
  },
424
429
  "title": "Strumenti aggiuntivi"
425
430
  }
426
- }
431
+ }
@@ -32,6 +32,11 @@
32
32
  },
33
33
  "llm": {
34
34
  "Anthropic": {
35
+ "endpoint": {
36
+ "desc": "デフォルトのアドレスに加えて、http(s)://を含める必要があります",
37
+ "placeholder": "https://api.anthropic.com",
38
+ "title": "APIプロキシアドレス"
39
+ },
35
40
  "title": "Anthropic",
36
41
  "token": {
37
42
  "desc": "Anthropic の API キーを入力してください",
@@ -423,4 +428,4 @@
423
428
  },
424
429
  "title": "拡張ツール"
425
430
  }
426
- }
431
+ }
@@ -32,6 +32,11 @@
32
32
  },
33
33
  "llm": {
34
34
  "Anthropic": {
35
+ "endpoint": {
36
+ "desc": "기본 주소 이외에 http(s)://를 포함해야 합니다",
37
+ "placeholder": "https://api.anthropic.com",
38
+ "title": "API 프록시 주소"
39
+ },
35
40
  "title": "Anthropic",
36
41
  "token": {
37
42
  "desc": "Anthropic의 API 키를 입력하세요",
@@ -423,4 +428,4 @@
423
428
  },
424
429
  "title": "확장 도구"
425
430
  }
426
- }
431
+ }
@@ -32,6 +32,11 @@
32
32
  },
33
33
  "llm": {
34
34
  "Anthropic": {
35
+ "endpoint": {
36
+ "desc": "除默认地址外,必须包含 http(s)://",
37
+ "placeholder": "https://api.anthropic.com",
38
+ "title": "API 代理地址"
39
+ },
35
40
  "title": "Anthropic",
36
41
  "token": {
37
42
  "desc": "Voer de API-sleutel van Anthropic in",
@@ -423,4 +428,4 @@
423
428
  },
424
429
  "title": "Uitbreidingsgereedschap"
425
430
  }
426
- }
431
+ }
@@ -32,6 +32,11 @@
32
32
  },
33
33
  "llm": {
34
34
  "Anthropic": {
35
+ "endpoint": {
36
+ "desc": "除默认地址外,必须包含 http(s)://",
37
+ "placeholder": "https://api.anthropic.com",
38
+ "title": "API 代理地址"
39
+ },
35
40
  "title": "Antropijny",
36
41
  "token": {
37
42
  "desc": "Wprowadź klucz API z Anthropic",
@@ -423,4 +428,4 @@
423
428
  },
424
429
  "title": "Narzędzia rozszerzeń"
425
430
  }
426
- }
431
+ }
@@ -32,6 +32,11 @@
32
32
  },
33
33
  "llm": {
34
34
  "Anthropic": {
35
+ "endpoint": {
36
+ "desc": "Além do endereço padrão, deve incluir http(s)://",
37
+ "placeholder": "https://api.anthropic.com",
38
+ "title": "Endereço do Proxy da API"
39
+ },
35
40
  "title": "Anthropic",
36
41
  "token": {
37
42
  "desc": "Insira a chave da API da Anthropic",
@@ -423,4 +428,4 @@
423
428
  },
424
429
  "title": "Ferramentas de Extensão"
425
430
  }
426
- }
431
+ }
@@ -32,6 +32,11 @@
32
32
  },
33
33
  "llm": {
34
34
  "Anthropic": {
35
+ "endpoint": {
36
+ "desc": "除默认地址外,必须包含 http(s)://",
37
+ "placeholder": "https://api.anthropic.com",
38
+ "title": "API 代理地址"
39
+ },
35
40
  "title": "Антропный",
36
41
  "token": {
37
42
  "desc": "Введите ключ API от Anthropic",
@@ -423,4 +428,4 @@
423
428
  },
424
429
  "title": "Дополнительные инструменты"
425
430
  }
426
- }
431
+ }
@@ -32,6 +32,11 @@
32
32
  },
33
33
  "llm": {
34
34
  "Anthropic": {
35
+ "endpoint": {
36
+ "desc": "默认地址以外,必须包含 http(s)://",
37
+ "placeholder": "https://api.anthropic.com",
38
+ "title": "API Proxy Adresi"
39
+ },
35
40
  "title": "Anthropic",
36
41
  "token": {
37
42
  "desc": "Anthropic 的 API 密钥",
@@ -423,4 +428,4 @@
423
428
  },
424
429
  "title": "Uzantı Araçları"
425
430
  }
426
- }
431
+ }
@@ -32,6 +32,11 @@
32
32
  },
33
33
  "llm": {
34
34
  "Anthropic": {
35
+ "endpoint": {
36
+ "desc": "Ngoài địa chỉ mặc định, phải bao gồm http(s)://",
37
+ "placeholder": "https://api.anthropic.com",
38
+ "title": "Địa chỉ Proxy API"
39
+ },
35
40
  "title": "Anthropic",
36
41
  "token": {
37
42
  "desc": "Nhập API Key từ Anthropic",
@@ -423,4 +428,4 @@
423
428
  },
424
429
  "title": "Công cụ mở rộng"
425
430
  }
426
- }
431
+ }
@@ -32,6 +32,11 @@
32
32
  },
33
33
  "llm": {
34
34
  "Anthropic": {
35
+ "endpoint": {
36
+ "desc": "除默认地址外,必须包含 http(s)://",
37
+ "placeholder": "https://api.anthropic.com",
38
+ "title": "API 代理地址"
39
+ },
35
40
  "title": "Anthropic",
36
41
  "token": {
37
42
  "desc": "填入来自 Anthropic 的 API Key",
@@ -423,4 +428,4 @@
423
428
  },
424
429
  "title": "扩展插件"
425
430
  }
426
- }
431
+ }
@@ -32,6 +32,11 @@
32
32
  },
33
33
  "llm": {
34
34
  "Anthropic": {
35
+ "endpoint": {
36
+ "desc": "除預設地址外,必須包含 http(s)://",
37
+ "placeholder": "https://api.anthropic.com",
38
+ "title": "API 代理地址"
39
+ },
35
40
  "title": "Anthropic",
36
41
  "token": {
37
42
  "desc": "填入來自 Anthropic 的 API 金鑰",
@@ -423,4 +428,4 @@
423
428
  },
424
429
  "title": "擴展工具"
425
430
  }
426
- }
431
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.133.5",
3
+ "version": "0.134.1",
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",
@@ -256,10 +256,10 @@ class AgentRuntime {
256
256
  }
257
257
 
258
258
  private static initAnthropic(payload: JWTPayload) {
259
- const { ANTHROPIC_API_KEY } = getServerConfig();
259
+ const { ANTHROPIC_API_KEY, ANTHROPIC_PROXY_URL } = getServerConfig();
260
260
  const apiKey = apiKeyManager.pick(payload?.apiKey || ANTHROPIC_API_KEY);
261
-
262
- return new LobeAnthropicAI({ apiKey });
261
+ const baseURL = payload?.endpoint || ANTHROPIC_PROXY_URL;
262
+ return new LobeAnthropicAI({ apiKey, baseURL });
263
263
  }
264
264
 
265
265
  private static initMistral(payload: JWTPayload) {
@@ -8,7 +8,11 @@ import { ModelProvider } from '@/libs/agent-runtime';
8
8
 
9
9
  import Checker from '../components/Checker';
10
10
  import ProviderConfig from '../components/ProviderConfig';
11
- import { LLMProviderApiTokenKey, LLMProviderConfigKey } from '../const';
11
+ import {
12
+ LLMProviderApiTokenKey,
13
+ LLMProviderBaseUrlKey,
14
+ LLMProviderConfigKey
15
+ } from '../const';
12
16
 
13
17
  const providerKey = 'anthropic';
14
18
 
@@ -31,6 +35,17 @@ const AnthropicProvider = memo(() => {
31
35
  label: t('llm.Anthropic.token.title'),
32
36
  name: [LLMProviderConfigKey, providerKey, LLMProviderApiTokenKey],
33
37
  },
38
+ {
39
+ children: (
40
+ <Input
41
+ allowClear
42
+ placeholder={t('llm.Anthropic.endpoint.placeholder')}
43
+ />
44
+ ),
45
+ desc: t('llm.Anthropic.endpoint.desc'),
46
+ label: t('llm.Anthropic.endpoint.title'),
47
+ name: [LLMProviderConfigKey, providerKey, LLMProviderBaseUrlKey],
48
+ },
34
49
  {
35
50
  children: <Checker model={'claude-2.1'} provider={ModelProvider.Anthropic} />,
36
51
  desc: t('llm.checker.desc'),
@@ -25,6 +25,7 @@ const OpenAI: ModelProviderCard = {
25
25
  tokens: 16_385,
26
26
  },
27
27
  {
28
+ displayName: 'GPT-3.5 Turbo Instruct',
28
29
  hidden: true,
29
30
  id: 'gpt-3.5-turbo-instruct',
30
31
  tokens: 4096,
@@ -36,12 +37,14 @@ const OpenAI: ModelProviderCard = {
36
37
  tokens: 16_385,
37
38
  },
38
39
  {
40
+ displayName: 'GPT-3.5 Turbo (0613)',
39
41
  hidden: true,
40
42
  id: 'gpt-3.5-turbo-0613',
41
43
  legacy: true,
42
44
  tokens: 4096,
43
45
  },
44
46
  {
47
+ displayName: 'GPT-3.5 Turbo 16K (0613)',
45
48
  hidden: true,
46
49
  id: 'gpt-3.5-turbo-16k-0613',
47
50
  legacy: true,
@@ -82,24 +85,28 @@ const OpenAI: ModelProviderCard = {
82
85
  tokens: 8192,
83
86
  },
84
87
  {
88
+ displayName: 'GPT-4 (0613)',
85
89
  functionCall: true,
86
90
  hidden: true,
87
91
  id: 'gpt-4-0613',
88
92
  tokens: 8192,
89
93
  },
90
94
  {
95
+ displayName: 'GPT-4 32K',
91
96
  functionCall: true,
92
97
  hidden: true,
93
98
  id: 'gpt-4-32k',
94
99
  tokens: 32_768,
95
100
  },
96
101
  {
102
+ displayName: 'GPT-4 32K (0613)',
97
103
  functionCall: true,
98
104
  hidden: true,
99
105
  id: 'gpt-4-32k-0613',
100
106
  tokens: 32_768,
101
107
  },
102
108
  {
109
+ displayName: 'GPT-4 ALL',
103
110
  files: true,
104
111
  functionCall: true,
105
112
  hidden: true,
@@ -35,6 +35,7 @@ declare global {
35
35
 
36
36
  // Anthropic Provider
37
37
  ANTHROPIC_API_KEY?: string;
38
+ ANTHROPIC_PROXY_URL?: string;
38
39
 
39
40
  // Mistral Provider
40
41
  MISTRAL_API_KEY?: string;
@@ -94,6 +95,7 @@ export const getProviderConfig = () => {
94
95
 
95
96
  ENABLED_ANTHROPIC: !!ANTHROPIC_API_KEY,
96
97
  ANTHROPIC_API_KEY,
98
+ ANTHROPIC_PROXY_URL: process.env.ANTHROPIC_PROXY_URL,
97
99
 
98
100
  ENABLED_MISTRAL: !!MISTRAL_API_KEY,
99
101
  MISTRAL_API_KEY,
@@ -24,10 +24,19 @@ afterEach(() => {
24
24
 
25
25
  describe('LobeAnthropicAI', () => {
26
26
  describe('init', () => {
27
+
27
28
  it('should correctly initialize with an API key', async () => {
28
29
  const instance = new LobeAnthropicAI({ apiKey: 'test_api_key' });
29
30
  expect(instance).toBeInstanceOf(LobeAnthropicAI);
31
+ expect(instance.baseURL).toBe('https://api.anthropic.com');
32
+ });
33
+
34
+ it('should correctly initialize with a baseURL', async () => {
35
+ const instance = new LobeAnthropicAI({ apiKey: 'test_api_key', baseURL: 'https://api.anthropic.proxy' });
36
+ expect(instance).toBeInstanceOf(LobeAnthropicAI);
37
+ expect(instance.baseURL).toBe('https://api.anthropic.proxy');
30
38
  });
39
+
31
40
  });
32
41
 
33
42
  describe('chat', () => {
@@ -235,7 +244,12 @@ describe('LobeAnthropicAI', () => {
235
244
  });
236
245
  } catch (e) {
237
246
  // Assert
238
- expect(e).toEqual({ errorType: 'InvalidAnthropicAPIKey', error: apiError, provider });
247
+ expect(e).toEqual({
248
+ endpoint: "https://api.anthropic.com",
249
+ error: apiError,
250
+ errorType: 'InvalidAnthropicAPIKey',
251
+ provider
252
+ });
239
253
  }
240
254
  });
241
255
  it('should throw BizError error', async () => {
@@ -261,7 +275,12 @@ describe('LobeAnthropicAI', () => {
261
275
  });
262
276
  } catch (e) {
263
277
  // Assert
264
- expect(e).toEqual({ errorType: 'AnthropicBizError', error: apiError, provider });
278
+ expect(e).toEqual({
279
+ endpoint: "https://api.anthropic.com",
280
+ error: apiError,
281
+ errorType: 'AnthropicBizError',
282
+ provider
283
+ });
265
284
  }
266
285
  });
267
286
 
@@ -15,15 +15,21 @@ import {
15
15
  } from '../types';
16
16
  import { AgentRuntimeError } from '../utils/createError';
17
17
  import { debugStream } from '../utils/debugStream';
18
+ import { desensitizeUrl } from '../utils/desensitizeUrl';
18
19
  import { parseDataUri } from '../utils/uriParser';
19
20
 
21
+ const DEFAULT_BASE_URL = 'https://api.anthropic.com';
22
+
20
23
  export class LobeAnthropicAI implements LobeRuntimeAI {
21
24
  private client: Anthropic;
25
+
26
+ baseURL: string;
22
27
 
23
- constructor({ apiKey }: ClientOptions) {
28
+ constructor({ apiKey, baseURL = DEFAULT_BASE_URL }: ClientOptions) {
24
29
  if (!apiKey) throw AgentRuntimeError.createError(AgentRuntimeErrorType.InvalidAnthropicAPIKey);
25
-
26
- this.client = new Anthropic({ apiKey });
30
+
31
+ this.client = new Anthropic({ apiKey, baseURL });
32
+ this.baseURL = this.client.baseURL;
27
33
  }
28
34
 
29
35
  private buildAnthropicMessages = (
@@ -70,10 +76,17 @@ export class LobeAnthropicAI implements LobeRuntimeAI {
70
76
  headers: options?.headers,
71
77
  });
72
78
  } catch (error) {
79
+ let desensitizedEndpoint = this.baseURL;
80
+
81
+ if (this.baseURL !== DEFAULT_BASE_URL) {
82
+ desensitizedEndpoint = desensitizeUrl(this.baseURL);
83
+ }
84
+
73
85
  if ('status' in (error as any)) {
74
86
  switch ((error as Response).status) {
75
87
  case 401: {
76
88
  throw AgentRuntimeError.chat({
89
+ endpoint: desensitizedEndpoint,
77
90
  error: error as any,
78
91
  errorType: AgentRuntimeErrorType.InvalidAnthropicAPIKey,
79
92
  provider: ModelProvider.Anthropic,
@@ -85,6 +98,7 @@ export class LobeAnthropicAI implements LobeRuntimeAI {
85
98
  }
86
99
  }
87
100
  throw AgentRuntimeError.chat({
101
+ endpoint: desensitizedEndpoint,
88
102
  error: error as any,
89
103
  errorType: AgentRuntimeErrorType.AnthropicBizError,
90
104
  provider: ModelProvider.Anthropic,
@@ -32,6 +32,11 @@ export default {
32
32
  },
33
33
  llm: {
34
34
  Anthropic: {
35
+ endpoint: {
36
+ desc: '除默认地址外,必须包含 http(s)://',
37
+ placeholder: 'https://api.anthropic.com',
38
+ title: 'API 代理地址',
39
+ },
35
40
  title: 'Anthropic',
36
41
  token: {
37
42
  desc: '填入来自 Anthropic 的 API Key',
@@ -53,7 +53,9 @@ export const getProviderAuthPayload = (provider: string) => {
53
53
  }
54
54
 
55
55
  case ModelProvider.Anthropic: {
56
- return { apiKey: modelProviderSelectors.anthropicAPIKey(useGlobalStore.getState()) };
56
+ const apiKey = modelProviderSelectors.anthropicAPIKey(useGlobalStore.getState());
57
+ const endpoint = modelProviderSelectors.anthropicProxyUrl(useGlobalStore.getState());
58
+ return { apiKey, endpoint };
57
59
  }
58
60
 
59
61
  case ModelProvider.Mistral: {
@@ -63,7 +63,7 @@ exports[`modelProviderSelectors > CUSTOM_MODELS > should work correct with gpt-4
63
63
  "tokens": 8192,
64
64
  },
65
65
  {
66
- "displayName": "gpt-4-32k",
66
+ "displayName": "GPT-4 32K",
67
67
  "functionCall": true,
68
68
  "hidden": undefined,
69
69
  "id": "gpt-4-32k",
@@ -59,6 +59,7 @@ const perplexityAPIKey = (s: GlobalStore) => modelProvider(s).perplexity.apiKey;
59
59
 
60
60
  const enableAnthropic = (s: GlobalStore) => modelProvider(s).anthropic.enabled;
61
61
  const anthropicAPIKey = (s: GlobalStore) => modelProvider(s).anthropic.apiKey;
62
+ const anthropicProxyUrl = (s: GlobalStore) => modelProvider(s).anthropic.endpoint;
62
63
 
63
64
  // const azureModelList = (s: GlobalStore): ModelProviderCard => {
64
65
  // const azure = azureConfig(s);
@@ -226,6 +227,7 @@ export const modelProviderSelectors = {
226
227
  // Anthropic
227
228
  enableAnthropic,
228
229
  anthropicAPIKey,
230
+ anthropicProxyUrl,
229
231
 
230
232
  // Mistral
231
233
  enableMistral,
@@ -63,6 +63,7 @@ export interface PerplexityConfig {
63
63
  export interface AnthropicConfig {
64
64
  apiKey?: string;
65
65
  enabled: boolean;
66
+ endpoint?: string;
66
67
  }
67
68
 
68
69
  export interface MistralConfig {