@lobehub/chat 1.53.2 → 1.53.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.
package/.env.example CHANGED
@@ -122,6 +122,11 @@ OPENAI_API_KEY=sk-xxxxxxxxx
122
122
 
123
123
  # SILICONCLOUD_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
124
124
 
125
+
126
+ ### TencentCloud AI ####
127
+
128
+ # TENCENT_CLOUD_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
129
+
125
130
  ########################################
126
131
  ############ Market Service ############
127
132
  ########################################
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.53.4](https://github.com/lobehub/lobe-chat/compare/v1.53.3...v1.53.4)
6
+
7
+ <sup>Released on **2025-02-12**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Fix ai model abilities issue.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix ai model abilities issue, closes [#6060](https://github.com/lobehub/lobe-chat/issues/6060) ([718f477](https://github.com/lobehub/lobe-chat/commit/718f477))
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.53.3](https://github.com/lobehub/lobe-chat/compare/v1.53.2...v1.53.3)
31
+
32
+ <sup>Released on **2025-02-12**</sup>
33
+
34
+ #### 🐛 Bug Fixes
35
+
36
+ - **misc**: Fix tencent cloud api issue.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's fixed
44
+
45
+ - **misc**: Fix tencent cloud api issue, closes [#6058](https://github.com/lobehub/lobe-chat/issues/6058) ([025d0bc](https://github.com/lobehub/lobe-chat/commit/025d0bc))
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.53.2](https://github.com/lobehub/lobe-chat/compare/v1.53.1...v1.53.2)
6
56
 
7
57
  <sup>Released on **2025-02-12**</sup>
package/Dockerfile CHANGED
@@ -222,7 +222,9 @@ ENV \
222
222
  # 01.AI
223
223
  ZEROONE_API_KEY="" ZEROONE_MODEL_LIST="" \
224
224
  # Zhipu
225
- ZHIPU_API_KEY="" ZHIPU_MODEL_LIST=""
225
+ ZHIPU_API_KEY="" ZHIPU_MODEL_LIST="" \
226
+ # Tencent Cloud
227
+ TENCENT_CLOUD_API_KEY="" TENCENT_CLOUD_MODEL_LIST=""
226
228
 
227
229
  USER nextjs
228
230
 
@@ -259,7 +259,9 @@ ENV \
259
259
  # 01.AI
260
260
  ZEROONE_API_KEY="" ZEROONE_MODEL_LIST="" \
261
261
  # Zhipu
262
- ZHIPU_API_KEY="" ZHIPU_MODEL_LIST=""
262
+ ZHIPU_API_KEY="" ZHIPU_MODEL_LIST="" \
263
+ # Tencent Cloud
264
+ TENCENT_CLOUD_API_KEY="" TENCENT_CLOUD_MODEL_LIST=""
263
265
 
264
266
  USER nextjs
265
267
 
package/changelog/v1.json CHANGED
@@ -1,4 +1,22 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "fixes": [
5
+ "Fix ai model abilities issue."
6
+ ]
7
+ },
8
+ "date": "2025-02-12",
9
+ "version": "1.53.4"
10
+ },
11
+ {
12
+ "children": {
13
+ "fixes": [
14
+ "Fix tencent cloud api issue."
15
+ ]
16
+ },
17
+ "date": "2025-02-12",
18
+ "version": "1.53.3"
19
+ },
2
20
  {
3
21
  "children": {
4
22
  "fixes": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.53.2",
3
+ "version": "1.53.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",
package/src/config/llm.ts CHANGED
@@ -125,6 +125,9 @@ export const getLLMConfig = () => {
125
125
 
126
126
  ENABLED_DOUBAO: z.boolean(),
127
127
  DOUBAO_API_KEY: z.string().optional(),
128
+
129
+ ENABLED_TENCENT_CLOUD: z.boolean(),
130
+ TENCENT_CLOUD_API_KEY: z.string().optional(),
128
131
  },
129
132
  runtimeEnv: {
130
133
  API_KEY_SELECT_MODE: process.env.API_KEY_SELECT_MODE,
@@ -248,6 +251,9 @@ export const getLLMConfig = () => {
248
251
 
249
252
  ENABLED_DOUBAO: !!process.env.DOUBAO_API_KEY,
250
253
  DOUBAO_API_KEY: process.env.DOUBAO_API_KEY,
254
+
255
+ ENABLED_TENCENT_CLOUD: !!process.env.TENCENT_CLOUD_API_KEY,
256
+ TENCENT_CLOUD_API_KEY: process.env.TENCENT_CLOUD_API_KEY,
251
257
  },
252
258
  });
253
259
  };
@@ -1,3 +1,4 @@
1
+ import { isEmpty } from 'lodash-es';
1
2
  import pMap from 'p-map';
2
3
 
3
4
  import { DEFAULT_MODEL_PROVIDER_LIST } from '@/config/modelProviders';
@@ -88,15 +89,25 @@ export class AiInfraRepos {
88
89
  .map<EnabledAiModel & { enabled?: boolean | null }>((item) => {
89
90
  const user = allModels.find((m) => m.id === item.id && m.providerId === provider.id);
90
91
 
92
+ if (!user)
93
+ return {
94
+ ...item,
95
+ abilities: item.abilities || {},
96
+ providerId: provider.id,
97
+ };
98
+
91
99
  return {
92
- abilities: !!user ? user.abilities : item.abilities || {},
93
- config: !!user ? user.config : item.config,
94
- contextWindowTokens: !!user ? user.contextWindowTokens : item.contextWindowTokens,
100
+ abilities: !isEmpty(user.abilities) ? user.abilities : item.abilities || {},
101
+ config: !isEmpty(user.config) ? user.config : item.config,
102
+ contextWindowTokens:
103
+ typeof user.contextWindowTokens === 'number'
104
+ ? user.contextWindowTokens
105
+ : item.contextWindowTokens,
95
106
  displayName: user?.displayName || item.displayName,
96
- enabled: !!user ? user.enabled : item.enabled,
107
+ enabled: user.enabled || item.enabled,
97
108
  id: item.id,
98
109
  providerId: provider.id,
99
- sort: !!user ? user.sort : undefined,
110
+ sort: user.sort || undefined,
100
111
  type: item.type,
101
112
  };
102
113
  })
@@ -0,0 +1,11 @@
1
+ import { useAiInfraStore } from '@/store/aiInfra';
2
+
3
+ import JsonViewer from './JsonViewer';
4
+
5
+ const AiProviderRuntimeConfig = () => {
6
+ const aiProviderRuntimeConfig = useAiInfraStore((s) => s.aiProviderRuntimeConfig);
7
+
8
+ return <JsonViewer data={aiProviderRuntimeConfig} />;
9
+ };
10
+
11
+ export default AiProviderRuntimeConfig;
@@ -0,0 +1,17 @@
1
+ import { Highlighter } from '@lobehub/ui';
2
+ import { memo } from 'react';
3
+ import { Flexbox } from 'react-layout-kit';
4
+
5
+ interface JsonViewerProps {
6
+ data: object;
7
+ }
8
+
9
+ const JsonViewer = memo<JsonViewerProps>(({ data }) => {
10
+ return (
11
+ <Flexbox style={{ overflow: 'scroll' }}>
12
+ <Highlighter language={'json'}>{JSON.stringify(data, null, 2)}</Highlighter>
13
+ </Flexbox>
14
+ );
15
+ });
16
+
17
+ export default JsonViewer;
@@ -0,0 +1,11 @@
1
+ import { useServerConfigStore } from '@/store/serverConfig';
2
+
3
+ import JsonViewer from './JsonViewer';
4
+
5
+ const ServerConfig = () => {
6
+ const serverConfig = useServerConfigStore((s) => s.serverConfig);
7
+
8
+ return <JsonViewer data={serverConfig} />;
9
+ };
10
+
11
+ export default ServerConfig;
@@ -0,0 +1,42 @@
1
+ 'use client';
2
+
3
+ import { TabsNav } from '@lobehub/ui';
4
+ import { useState } from 'react';
5
+ import { Flexbox } from 'react-layout-kit';
6
+
7
+ import AiProviderRuntimeConfig from './AiProviderRuntimeConfig';
8
+ import ServerConfig from './ServerConfig';
9
+
10
+ enum TabKey {
11
+ AiProviderRuntimeConfig = 'aiProviderRuntimeConfig',
12
+ ServerConfig = 'serverConfig',
13
+ }
14
+
15
+ const SystemInspector = () => {
16
+ const [activeTab, setActiveTab] = useState<TabKey>(TabKey.ServerConfig);
17
+
18
+ return (
19
+ <Flexbox gap={4} height={'100%'}>
20
+ <TabsNav
21
+ activeKey={activeTab}
22
+ items={[
23
+ {
24
+ key: TabKey.ServerConfig,
25
+ label: 'Server Config',
26
+ },
27
+ {
28
+ key: TabKey.AiProviderRuntimeConfig,
29
+ label: 'Ai Provider Runtime Config',
30
+ },
31
+ ]}
32
+ onChange={(activeTab) => setActiveTab(activeTab as TabKey)}
33
+ variant={'compact'}
34
+ />
35
+
36
+ {activeTab === TabKey.ServerConfig && <ServerConfig />}
37
+ {activeTab === TabKey.AiProviderRuntimeConfig && <AiProviderRuntimeConfig />}
38
+ </Flexbox>
39
+ );
40
+ };
41
+
42
+ export default SystemInspector;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { ActionIcon, FluentEmoji, Icon, SideNav } from '@lobehub/ui';
4
- import { Dropdown, FloatButton } from 'antd';
4
+ import { FloatButton } from 'antd';
5
5
  import { createStyles } from 'antd-style';
6
6
  import { BugIcon, BugOff, XIcon } from 'lucide-react';
7
7
  import { ReactNode, memo, useEffect, useState } from 'react';
@@ -81,7 +81,7 @@ interface CollapsibleFloatPanelProps {
81
81
  const CollapsibleFloatPanel = memo<CollapsibleFloatPanelProps>(({ items }) => {
82
82
  const { styles, theme } = useStyles();
83
83
  const [tab, setTab] = useState<string>(items[0].key);
84
- const [isHide, setIsHide] = useState(false);
84
+
85
85
  const [isExpanded, setIsExpanded] = useState(false);
86
86
  const [position, setPosition] = useState({ x: 100, y: 100 });
87
87
  const [size, setSize] = useState({ height: minHeight, width: minWidth });
@@ -108,29 +108,11 @@ const CollapsibleFloatPanel = memo<CollapsibleFloatPanelProps>(({ items }) => {
108
108
 
109
109
  return (
110
110
  <>
111
- {!isHide && (
112
- <Dropdown
113
- menu={{
114
- items: [
115
- {
116
- icon: (
117
- <Icon color={theme.colorTextSecondary} icon={BugOff} size={{ fontSize: 16 }} />
118
- ),
119
- key: 'hide',
120
- label: 'Hide Toolbar',
121
- onClick: () => setIsHide(true),
122
- },
123
- ],
124
- }}
125
- trigger={['hover']}
126
- >
127
- <FloatButton
128
- className={styles.floatButton}
129
- icon={<Icon icon={isExpanded ? BugOff : BugIcon} />}
130
- onClick={() => setIsExpanded(!isExpanded)}
131
- />
132
- </Dropdown>
133
- )}
111
+ <FloatButton
112
+ className={styles.floatButton}
113
+ icon={<Icon icon={isExpanded ? BugOff : BugIcon} />}
114
+ onClick={() => setIsExpanded(!isExpanded)}
115
+ />
134
116
  {isExpanded && (
135
117
  <Rnd
136
118
  bounds="window"
@@ -1,9 +1,10 @@
1
- import { BookText, DatabaseIcon, FlagIcon, GlobeLockIcon } from 'lucide-react';
1
+ import { BookText, Cog, DatabaseIcon, FlagIcon, GlobeLockIcon } from 'lucide-react';
2
2
 
3
3
  import CacheViewer from './CacheViewer';
4
4
  import FeatureFlagViewer from './FeatureFlagViewer';
5
5
  import MetadataViewer from './MetadataViewer';
6
6
  import PostgresViewer from './PostgresViewer';
7
+ import SystemInspector from './SystemInspector';
7
8
  import FloatPanel from './features/FloatPanel';
8
9
 
9
10
  const DevPanel = () => (
@@ -29,6 +30,11 @@ const DevPanel = () => (
29
30
  icon: <FlagIcon size={16} />,
30
31
  key: 'Feature Flags',
31
32
  },
33
+ {
34
+ children: <SystemInspector />,
35
+ icon: <Cog size={16} />,
36
+ key: 'System Status',
37
+ },
32
38
  ]}
33
39
  />
34
40
  );
@@ -100,6 +100,14 @@ const getLlmOptionsFromPayload = (provider: string, payload: JWTPayload) => {
100
100
 
101
101
  return { apiKey };
102
102
  }
103
+
104
+ case ModelProvider.TencentCloud: {
105
+ const { TENCENT_CLOUD_API_KEY } = llmConfig;
106
+
107
+ const apiKey = apiKeyManager.pick(payload?.apiKey || TENCENT_CLOUD_API_KEY);
108
+
109
+ return { apiKey };
110
+ }
103
111
  }
104
112
  };
105
113