@lobehub/chat 1.28.1 → 1.28.2

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,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.28.2](https://github.com/lobehub/lobe-chat/compare/v1.28.1...v1.28.2)
6
+
7
+ <sup>Released on **2024-11-06**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: Refactor and clean some code.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **misc**: Refactor and clean some code, closes [#4629](https://github.com/lobehub/lobe-chat/issues/4629) ([ad3a154](https://github.com/lobehub/lobe-chat/commit/ad3a154))
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
+
5
30
  ### [Version 1.28.1](https://github.com/lobehub/lobe-chat/compare/v1.28.0...v1.28.1)
6
31
 
7
32
  <sup>Released on **2024-11-06**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.28.1",
3
+ "version": "1.28.2",
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",
@@ -1,17 +1,5 @@
1
1
  import { POST as UniverseRoute } from '../[provider]/route';
2
2
 
3
- // due to the Chinese region does not support accessing Google
4
- // we need to use proxy to access it
5
- // refs: https://github.com/google/generative-ai-js/issues/29#issuecomment-1866246513
6
- // if (process.env.HTTP_PROXY_URL) {
7
- // const { setGlobalDispatcher, ProxyAgent } = require('undici');
8
- //
9
- // console.log(process.env.HTTP_PROXY_URL)
10
- // setGlobalDispatcher(new ProxyAgent({ uri: process.env.HTTP_PROXY_URL }));
11
- // }
12
-
13
- // but undici only can be used in NodeJS
14
- // so if you want to use with proxy, you need comment the code below
15
3
  export const runtime = 'edge';
16
4
 
17
5
  export const preferredRegion = [
@@ -1,16 +1,5 @@
1
1
  import { POST as UniverseRoute } from '../[provider]/route';
2
2
 
3
- // due to the Chinese region does not support accessing Google
4
- // we need to use proxy to access it
5
- // refs: https://github.com/google/generative-ai-js/issues/29#issuecomment-1866246513
6
- // if (process.env.HTTP_PROXY_URL) {
7
- // const { setGlobalDispatcher, ProxyAgent } = require('undici');
8
- //
9
- // setGlobalDispatcher(new ProxyAgent({ uri: process.env.HTTP_PROXY_URL }));
10
- // }
11
-
12
- // but undici only can be used in NodeJS
13
- // so if you want to use with proxy, you need comment the code below
14
3
  export const runtime = 'edge';
15
4
 
16
5
  // due to Gemini-1.5-pro is not available in Hong Kong, we need to set the preferred region to exclude "Hong Kong (hkg1)".
@@ -1,5 +1,5 @@
1
1
  import { getLLMConfig } from '@/config/llm';
2
- import { AgentRuntime } from '@/libs/agent-runtime';
2
+ import { AgentRuntime, ModelProvider } from '@/libs/agent-runtime';
3
3
  import LobeWenxinAI from '@/libs/agent-runtime/wenxin';
4
4
 
5
5
  import { POST as UniverseRoute } from '../[provider]/route';
@@ -26,5 +26,5 @@ export const POST = async (req: Request) =>
26
26
 
27
27
  return new AgentRuntime(instance);
28
28
  },
29
- params: { provider: 'wenxin' },
29
+ params: { provider: ModelProvider.Wenxin },
30
30
  });
@@ -116,6 +116,7 @@ const ProviderConfig = memo<ProviderConfigProps>(
116
116
  className,
117
117
  name,
118
118
  showAceGcm = true,
119
+ showChecker = true,
119
120
  extra,
120
121
  }) => {
121
122
  const { t } = useTranslation('setting');
@@ -219,12 +220,14 @@ const ProviderConfig = memo<ProviderConfigProps>(
219
220
  label: t('llm.modelList.title'),
220
221
  name: [LLMProviderConfigKey, id, LLMProviderModelListKey],
221
222
  },
222
- checkerItem ?? {
223
- children: <Checker model={checkModel!} provider={id} />,
224
- desc: t('llm.checker.desc'),
225
- label: t('llm.checker.title'),
226
- minWidth: undefined,
227
- },
223
+ showChecker
224
+ ? (checkerItem ?? {
225
+ children: <Checker model={checkModel!} provider={id} />,
226
+ desc: t('llm.checker.desc'),
227
+ label: t('llm.checker.title'),
228
+ minWidth: undefined,
229
+ })
230
+ : undefined,
228
231
  showAceGcm && isServerMode && aceGcmItem,
229
232
  ].filter(Boolean) as FormItemProps[];
230
233
 
@@ -103,7 +103,7 @@ export const getServerGlobalConfig = () => {
103
103
 
104
104
  ENABLED_AI21,
105
105
  AI21_MODEL_LIST,
106
-
106
+
107
107
  ENABLED_AI360,
108
108
  AI360_MODEL_LIST,
109
109
 
@@ -266,8 +266,12 @@ const getLlmOptionsFromPayload = (provider: string, payload: JWTPayload) => {
266
266
  case ModelProvider.SenseNova: {
267
267
  const { SENSENOVA_ACCESS_KEY_ID, SENSENOVA_ACCESS_KEY_SECRET } = getLLMConfig();
268
268
 
269
- const sensenovaAccessKeyID = apiKeyManager.pick(payload?.sensenovaAccessKeyID || SENSENOVA_ACCESS_KEY_ID);
270
- const sensenovaAccessKeySecret = apiKeyManager.pick(payload?.sensenovaAccessKeySecret || SENSENOVA_ACCESS_KEY_SECRET);
269
+ const sensenovaAccessKeyID = apiKeyManager.pick(
270
+ payload?.sensenovaAccessKeyID || SENSENOVA_ACCESS_KEY_ID,
271
+ );
272
+ const sensenovaAccessKeySecret = apiKeyManager.pick(
273
+ payload?.sensenovaAccessKeySecret || SENSENOVA_ACCESS_KEY_SECRET,
274
+ );
271
275
 
272
276
  const apiKey = sensenovaAccessKeyID + ':' + sensenovaAccessKeySecret;
273
277
 
package/src/types/llm.ts CHANGED
@@ -122,6 +122,10 @@ export interface ModelProviderCard {
122
122
  * so provider like ollama don't need api key field
123
123
  */
124
124
  showApiKey?: boolean;
125
+ /**
126
+ * whether show checker in the provider config
127
+ */
128
+ showChecker?: boolean;
125
129
  /**
126
130
  * whether to smoothing the output
127
131
  */