@lobehub/chat 0.147.2 → 0.147.4

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 (72) hide show
  1. package/.env.example +47 -56
  2. package/CHANGELOG.md +58 -0
  3. package/Dockerfile +3 -2
  4. package/README.md +2 -1
  5. package/README.zh-CN.md +7 -6
  6. package/docs/self-hosting/advanced/authentication.mdx +6 -8
  7. package/docs/self-hosting/advanced/authentication.zh-CN.mdx +6 -8
  8. package/docs/self-hosting/advanced/sso-providers/auth0.mdx +2 -2
  9. package/docs/self-hosting/advanced/sso-providers/auth0.zh-CN.mdx +2 -2
  10. package/docs/self-hosting/advanced/sso-providers/authentik.mdx +2 -2
  11. package/docs/self-hosting/advanced/sso-providers/authentik.zh-CN.mdx +2 -2
  12. package/docs/self-hosting/advanced/sso-providers/github.mdx +1 -1
  13. package/docs/self-hosting/advanced/sso-providers/github.zh-CN.mdx +2 -2
  14. package/docs/self-hosting/advanced/sso-providers/microsoft-entra-id.mdx +1 -1
  15. package/docs/self-hosting/advanced/sso-providers/microsoft-entra-id.zh-CN.mdx +2 -2
  16. package/docs/self-hosting/advanced/sso-providers/zitadel.mdx +2 -2
  17. package/docs/self-hosting/advanced/sso-providers/zitadel.zh-CN.mdx +2 -2
  18. package/docs/self-hosting/environment-variables/analytics.mdx +1 -1
  19. package/docs/self-hosting/environment-variables/analytics.zh-CN.mdx +1 -3
  20. package/docs/self-hosting/environment-variables/model-provider.mdx +19 -21
  21. package/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx +16 -2
  22. package/docs/self-hosting/environment-variables.mdx +2 -1
  23. package/docs/self-hosting/environment-variables.zh-CN.mdx +2 -1
  24. package/docs/self-hosting/examples/azure-openai.mdx +6 -26
  25. package/docs/self-hosting/examples/azure-openai.zh-CN.mdx +6 -23
  26. package/docs/self-hosting/examples/ollama.mdx +12 -1
  27. package/docs/self-hosting/examples/ollama.zh-CN.mdx +10 -1
  28. package/docs/self-hosting/platform/docker.mdx +4 -4
  29. package/docs/self-hosting/platform/docker.zh-CN.mdx +4 -4
  30. package/docs/self-hosting/platform/netlify.mdx +1 -1
  31. package/docs/self-hosting/platform/netlify.zh-CN.mdx +1 -1
  32. package/docs/self-hosting/platform/vercel.mdx +1 -1
  33. package/docs/self-hosting/platform/vercel.zh-CN.mdx +1 -1
  34. package/docs/usage/agents/custom-agent.mdx +2 -2
  35. package/docs/usage/agents/custom-agent.zh-CN.mdx +2 -2
  36. package/docs/usage/features/multi-ai-providers.mdx +7 -1
  37. package/docs/usage/features/multi-ai-providers.zh-CN.mdx +7 -2
  38. package/docs/usage/features/plugin-system.mdx +1 -1
  39. package/docs/usage/features/plugin-system.zh-CN.mdx +2 -2
  40. package/docs/usage/plugins/custom-plugin.mdx +1 -1
  41. package/docs/usage/plugins/custom-plugin.zh-CN.mdx +1 -1
  42. package/docs/usage/providers/ollama/gemma.mdx +3 -3
  43. package/docs/usage/providers/ollama/gemma.zh-CN.mdx +3 -3
  44. package/docs/usage/providers/ollama/qwen.mdx +3 -3
  45. package/docs/usage/providers/ollama/qwen.zh-CN.mdx +3 -3
  46. package/docs/usage/providers/ollama.mdx +3 -3
  47. package/docs/usage/providers/ollama.zh-CN.mdx +3 -3
  48. package/locales/ar/modelProvider.json +5 -0
  49. package/locales/bg-BG/modelProvider.json +5 -0
  50. package/locales/de-DE/modelProvider.json +5 -0
  51. package/locales/en-US/modelProvider.json +5 -0
  52. package/locales/es-ES/modelProvider.json +5 -0
  53. package/locales/fr-FR/modelProvider.json +5 -0
  54. package/locales/it-IT/modelProvider.json +5 -0
  55. package/locales/ja-JP/modelProvider.json +5 -0
  56. package/locales/ko-KR/modelProvider.json +5 -0
  57. package/locales/nl-NL/modelProvider.json +5 -0
  58. package/locales/pl-PL/modelProvider.json +5 -0
  59. package/locales/pt-BR/modelProvider.json +5 -0
  60. package/locales/ru-RU/modelProvider.json +5 -0
  61. package/locales/tr-TR/modelProvider.json +5 -0
  62. package/locales/vi-VN/modelProvider.json +5 -0
  63. package/locales/zh-CN/modelProvider.json +5 -0
  64. package/locales/zh-TW/modelProvider.json +5 -0
  65. package/package.json +2 -2
  66. package/src/app/api/chat/agentRuntime.ts +3 -2
  67. package/src/app/settings/llm/Google/index.tsx +1 -0
  68. package/src/config/modelProviders/openrouter.ts +64 -0
  69. package/src/config/server/provider.ts +2 -0
  70. package/src/const/layoutTokens.ts +1 -1
  71. package/src/libs/agent-runtime/google/index.ts +4 -2
  72. package/src/locales/default/modelProvider.ts +5 -0
@@ -67,6 +67,11 @@
67
67
  }
68
68
  },
69
69
  "google": {
70
+ "endpoint": {
71
+ "desc": "기본 주소 이외에 http(s)://를 포함해야 합니다.",
72
+ "placeholder": "https://generativelanguage.googleapis.com",
73
+ "title": "API 프록시 주소"
74
+ },
70
75
  "title": "Google",
71
76
  "token": {
72
77
  "desc": "Google에서 제공하는 API 키를 입력하세요.",
@@ -67,6 +67,11 @@
67
67
  }
68
68
  },
69
69
  "google": {
70
+ "endpoint": {
71
+ "desc": "除默认地址外,必须包含 http(s)://",
72
+ "placeholder": "https://generativelanguage.googleapis.com",
73
+ "title": "API 代理地址"
74
+ },
70
75
  "title": "Google",
71
76
  "token": {
72
77
  "desc": "Voer de API Key van Google in",
@@ -67,6 +67,11 @@
67
67
  }
68
68
  },
69
69
  "google": {
70
+ "endpoint": {
71
+ "desc": "除默认地址外,必须包含 http(s)://",
72
+ "placeholder": "https://generativelanguage.googleapis.com",
73
+ "title": "API 代理地址"
74
+ },
70
75
  "title": "Google",
71
76
  "token": {
72
77
  "desc": "Wprowadź klucz API uzyskany od Google",
@@ -67,6 +67,11 @@
67
67
  }
68
68
  },
69
69
  "google": {
70
+ "endpoint": {
71
+ "desc": "Além do endereço padrão, deve incluir http(s)://",
72
+ "placeholder": "https://generativelanguage.googleapis.com",
73
+ "title": "Endereço do Proxy da API"
74
+ },
70
75
  "title": "Google",
71
76
  "token": {
72
77
  "desc": "Insira sua API Key fornecida pelo Google",
@@ -67,6 +67,11 @@
67
67
  }
68
68
  },
69
69
  "google": {
70
+ "endpoint": {
71
+ "desc": "Помимо адреса по умолчанию, должен включать http(s)://",
72
+ "placeholder": "https://generativelanguage.googleapis.com",
73
+ "title": "Адрес прокси-API"
74
+ },
70
75
  "title": "Google",
71
76
  "token": {
72
77
  "desc": "Введите свой API Key от Google",
@@ -67,6 +67,11 @@
67
67
  }
68
68
  },
69
69
  "google": {
70
+ "endpoint": {
71
+ "desc": "除默认地址外,必须包含 http(s)://",
72
+ "placeholder": "https://generativelanguage.googleapis.com",
73
+ "title": "API 代理地址"
74
+ },
70
75
  "title": "Google",
71
76
  "token": {
72
77
  "desc": "Google'dan gelen API Key'i girin",
@@ -67,6 +67,11 @@
67
67
  }
68
68
  },
69
69
  "google": {
70
+ "endpoint": {
71
+ "desc": "Ngoài địa chỉ mặc định, phải bao gồm http(s)://",
72
+ "placeholder": "https://generativelanguage.googleapis.com",
73
+ "title": "Địa chỉ Proxy API"
74
+ },
70
75
  "title": "Google",
71
76
  "token": {
72
77
  "desc": "Nhập API Key từ Google",
@@ -67,6 +67,11 @@
67
67
  }
68
68
  },
69
69
  "google": {
70
+ "endpoint": {
71
+ "desc": "除默认地址外,必须包含 http(s)://",
72
+ "placeholder": "https://generativelanguage.googleapis.com",
73
+ "title": "API 代理地址"
74
+ },
70
75
  "title": "Google",
71
76
  "token": {
72
77
  "desc": "填入来自 Google 的 API Key",
@@ -67,6 +67,11 @@
67
67
  }
68
68
  },
69
69
  "google": {
70
+ "endpoint": {
71
+ "desc": "除了預設地址外,必須包含 http(s)://",
72
+ "placeholder": "https://generativelanguage.googleapis.com",
73
+ "title": "API 代理地址"
74
+ },
70
75
  "title": "Google",
71
76
  "token": {
72
77
  "desc": "填入來自 Google 的 API 金鑰",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.147.2",
3
+ "version": "0.147.4",
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",
@@ -86,7 +86,7 @@
86
86
  "@aws-sdk/client-bedrock-runtime": "^3.549.0",
87
87
  "@azure/openai": "^1.0.0-beta.12",
88
88
  "@cfworker/json-schema": "^1.12.8",
89
- "@google/generative-ai": "^0.3.1",
89
+ "@google/generative-ai": "^0.5.0",
90
90
  "@icons-pack/react-simple-icons": "^9.4.0",
91
91
  "@lobehub/chat-plugin-sdk": "latest",
92
92
  "@lobehub/chat-plugins-gateway": "latest",
@@ -224,10 +224,11 @@ class AgentRuntime {
224
224
  }
225
225
 
226
226
  private static initGoogle(payload: JWTPayload) {
227
- const { GOOGLE_API_KEY } = getServerConfig();
227
+ const { GOOGLE_API_KEY, GOOGLE_PROXY_URL } = getServerConfig();
228
228
  const apiKey = apiKeyManager.pick(payload?.apiKey || GOOGLE_API_KEY);
229
+ const baseURL = payload?.endpoint || GOOGLE_PROXY_URL;
229
230
 
230
- return new LobeGoogleAI({ apiKey });
231
+ return new LobeGoogleAI({ apiKey, baseURL });
231
232
  }
232
233
 
233
234
  private static initBedrock(payload: JWTPayload) {
@@ -12,6 +12,7 @@ const GoogleProvider = memo(() => {
12
12
  <ProviderConfig
13
13
  checkModel={'gemini-pro'}
14
14
  provider={ModelProvider.Google}
15
+ showEndpoint
15
16
  title={
16
17
  <Flexbox align={'center'} gap={8} horizontal>
17
18
  <Google.BrandColor size={28} />
@@ -2,6 +2,14 @@ import { ModelProviderCard } from '@/types/llm';
2
2
 
3
3
  const OpenRouter: ModelProviderCard = {
4
4
  chatModels: [
5
+ {
6
+ displayName: 'Auto (best for prompt)',
7
+ enabled: true,
8
+ functionCall: false,
9
+ id: 'openrouter/auto',
10
+ tokens: 128_000,
11
+ vision: false,
12
+ },
5
13
  {
6
14
  displayName: 'Mistral 7B Instruct (free)',
7
15
  enabled: true,
@@ -42,6 +50,62 @@ const OpenRouter: ModelProviderCard = {
42
50
  tokens: 4096,
43
51
  vision: false,
44
52
  },
53
+ {
54
+ displayName: 'MythoMist 7B (free)',
55
+ enabled: true,
56
+ functionCall: false,
57
+ id: 'gryphe/mythomist-7b:free',
58
+ tokens: 32_768,
59
+ vision: false,
60
+ },
61
+ {
62
+ displayName: 'Toppy M 7B (free)',
63
+ enabled: true,
64
+ functionCall: false,
65
+ id: 'undi95/toppy-m-7b:free',
66
+ tokens: 4096,
67
+ vision: false,
68
+ },
69
+ {
70
+ displayName: 'Cinematika 7B (alpha) (free)',
71
+ enabled: true,
72
+ functionCall: false,
73
+ id: 'openrouter/cinematika-7b:free',
74
+ tokens: 8000,
75
+ vision: false,
76
+ },
77
+ {
78
+ displayName: 'RWKV v5 World 3B (free)',
79
+ enabled: true,
80
+ functionCall: false,
81
+ id: 'rwkv/rwkv-5-world-3b',
82
+ tokens: 10_000,
83
+ vision: false,
84
+ },
85
+ {
86
+ displayName: 'RWKV v5 3B AI Town (free)',
87
+ enabled: true,
88
+ functionCall: false,
89
+ id: 'recursal/rwkv-5-3b-ai-town',
90
+ tokens: 10_000,
91
+ vision: false,
92
+ },
93
+ {
94
+ displayName: 'RWKV v5: Eagle 7B (free)',
95
+ enabled: true,
96
+ functionCall: false,
97
+ id: 'recursal/eagle-7b',
98
+ tokens: 10_000,
99
+ vision: false,
100
+ },
101
+ {
102
+ displayName: 'Mistral: Mixtral 8x22B (base) (free)',
103
+ enabled: true,
104
+ functionCall: false,
105
+ id: 'mistralai/mixtral-8x22b',
106
+ tokens: 64_000,
107
+ vision: false,
108
+ },
45
109
  ],
46
110
  id: 'openrouter',
47
111
  };
@@ -28,6 +28,7 @@ declare global {
28
28
  // Google Provider
29
29
  ENABLED_GOOGLE?: string;
30
30
  GOOGLE_API_KEY?: string;
31
+ GOOGLE_PROXY_URL?: string;
31
32
 
32
33
  // Moonshot Provider
33
34
  ENABLED_MOONSHOT?: string;
@@ -154,6 +155,7 @@ export const getProviderConfig = () => {
154
155
 
155
156
  ENABLED_GOOGLE: !!GOOGLE_API_KEY,
156
157
  GOOGLE_API_KEY,
158
+ GOOGLE_PROXY_URL: process.env.GOOGLE_PROXY_URL,
157
159
 
158
160
  ENABLED_PERPLEXITY: !!PERPLEXITY_API_KEY,
159
161
  PERPLEXITY_API_KEY,
@@ -8,7 +8,7 @@ export const CHAT_TEXTAREA_HEIGHT = 230;
8
8
  export const CHAT_TEXTAREA_HEIGHT_MOBILE = 108;
9
9
  export const CHAT_SIDEBAR_WIDTH = 280;
10
10
  export const MARKET_SIDEBAR_WIDTH = 400;
11
- export const FOLDER_WIDTH = 256;
11
+ export const FOLDER_WIDTH = 270;
12
12
  export const MAX_WIDTH = 1024;
13
13
  export const FORM_STYLE: FormProps = {
14
14
  itemMinWidth: 'max(30%,240px)',
@@ -27,11 +27,13 @@ enum HarmBlockThreshold {
27
27
 
28
28
  export class LobeGoogleAI implements LobeRuntimeAI {
29
29
  private client: GoogleGenerativeAI;
30
+ baseURL?: string;
30
31
 
31
- constructor({ apiKey }: { apiKey?: string }) {
32
+ constructor({ apiKey, baseURL }: { apiKey?: string; baseURL?: string }) {
32
33
  if (!apiKey) throw AgentRuntimeError.createError(AgentRuntimeErrorType.InvalidGoogleAPIKey);
33
34
 
34
35
  this.client = new GoogleGenerativeAI(apiKey);
36
+ this.baseURL = baseURL;
35
37
  }
36
38
 
37
39
  async chat(payload: ChatStreamPayload, options?: ChatCompetitionOptions) {
@@ -70,7 +72,7 @@ export class LobeGoogleAI implements LobeRuntimeAI {
70
72
  },
71
73
  ],
72
74
  },
73
- { apiVersion: 'v1beta' },
75
+ { apiVersion: 'v1beta', baseUrl: this.baseURL },
74
76
  )
75
77
  .generateContentStream({ contents });
76
78
 
@@ -69,6 +69,11 @@ export default {
69
69
  },
70
70
  },
71
71
  google: {
72
+ endpoint: {
73
+ desc: '除默认地址外,必须包含 http(s)://',
74
+ placeholder: 'https://generativelanguage.googleapis.com',
75
+ title: 'API 代理地址',
76
+ },
72
77
  title: 'Google',
73
78
  token: {
74
79
  desc: '填入来自 Google 的 API Key',