@lobehub/chat 1.63.0 β†’ 1.63.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,64 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.63.2](https://github.com/lobehub/lobe-chat/compare/v1.63.1...v1.63.2)
6
+
7
+ <sup>Released on **2025-02-24**</sup>
8
+
9
+ #### πŸ› Bug Fixes
10
+
11
+ - **misc**: Fix model settings config.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix model settings config, closes [#6459](https://github.com/lobehub/lobe-chat/issues/6459) ([469bd10](https://github.com/lobehub/lobe-chat/commit/469bd10))
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.63.1](https://github.com/lobehub/lobe-chat/compare/v1.63.0...v1.63.1)
31
+
32
+ <sup>Released on **2025-02-23**</sup>
33
+
34
+ #### πŸ› Bug Fixes
35
+
36
+ - **misc**: Fix groq location request.
37
+
38
+ #### πŸ’„ Styles
39
+
40
+ - **misc**: Improve plugin calling style.
41
+
42
+ <br/>
43
+
44
+ <details>
45
+ <summary><kbd>Improvements and Fixes</kbd></summary>
46
+
47
+ #### What's fixed
48
+
49
+ - **misc**: Fix groq location request, closes [#6449](https://github.com/lobehub/lobe-chat/issues/6449) ([8c8af6b](https://github.com/lobehub/lobe-chat/commit/8c8af6b))
50
+
51
+ #### Styles
52
+
53
+ - **misc**: Improve plugin calling style, closes [#6446](https://github.com/lobehub/lobe-chat/issues/6446) ([406cd46](https://github.com/lobehub/lobe-chat/commit/406cd46))
54
+
55
+ </details>
56
+
57
+ <div align="right">
58
+
59
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
60
+
61
+ </div>
62
+
5
63
  ## [Version 1.63.0](https://github.com/lobehub/lobe-chat/compare/v1.62.11...v1.63.0)
6
64
 
7
65
  <sup>Released on **2025-02-23**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,25 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "fixes": [
5
+ "Fix model settings config."
6
+ ]
7
+ },
8
+ "date": "2025-02-24",
9
+ "version": "1.63.2"
10
+ },
11
+ {
12
+ "children": {
13
+ "fixes": [
14
+ "Fix groq location request."
15
+ ],
16
+ "improvements": [
17
+ "Improve plugin calling style."
18
+ ]
19
+ },
20
+ "date": "2025-02-23",
21
+ "version": "1.63.1"
22
+ },
2
23
  {
3
24
  "children": {
4
25
  "features": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.63.0",
3
+ "version": "1.63.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",
@@ -167,7 +167,7 @@
167
167
  "i18next-resources-to-backend": "^1.2.1",
168
168
  "idb-keyval": "^6.2.1",
169
169
  "immer": "^10.1.1",
170
- "jose": "^6.0.0",
170
+ "jose": "^5.10.0",
171
171
  "js-sha256": "^0.11.0",
172
172
  "jsonl-parse-stringify": "^1.0.3",
173
173
  "langchain": "^0.3.10",
@@ -0,0 +1,29 @@
1
+ // @vitest-environment edge-runtime
2
+ import { describe, expect, it, vi } from 'vitest';
3
+
4
+ import { POST as UniverseRoute } from '../[provider]/route';
5
+ import { POST, preferredRegion, runtime } from './route';
6
+
7
+ vi.mock('../[provider]/route', () => ({
8
+ POST: vi.fn().mockResolvedValue('mocked response'),
9
+ }));
10
+
11
+ describe('Configuration tests', () => {
12
+ it('should have runtime set to "edge"', () => {
13
+ expect(runtime).toBe('edge');
14
+ });
15
+
16
+ it('should contain specific regions in preferredRegion', () => {
17
+ expect(preferredRegion).not.contain(['hk1']);
18
+ });
19
+ });
20
+
21
+ describe('Groq POST function tests', () => {
22
+ it('should call UniverseRoute with correct parameters', async () => {
23
+ const mockRequest = new Request('https://example.com', { method: 'POST' });
24
+ await POST(mockRequest);
25
+ expect(UniverseRoute).toHaveBeenCalledWith(mockRequest, {
26
+ params: Promise.resolve({ provider: 'groq' }),
27
+ });
28
+ });
29
+ });
@@ -0,0 +1,21 @@
1
+ import { POST as UniverseRoute } from '../[provider]/route';
2
+
3
+ export const runtime = 'edge';
4
+
5
+ export const preferredRegion = [
6
+ 'bom1',
7
+ 'cle1',
8
+ 'cpt1',
9
+ 'gru1',
10
+ 'hnd1',
11
+ 'iad1',
12
+ 'icn1',
13
+ 'kix1',
14
+ 'pdx1',
15
+ 'sfo1',
16
+ 'sin1',
17
+ 'syd1',
18
+ ];
19
+
20
+ export const POST = async (req: Request) =>
21
+ UniverseRoute(req, { params: Promise.resolve({ provider: 'groq' }) });
@@ -102,7 +102,6 @@ export class AiInfraRepos {
102
102
  enabledProviders,
103
103
  async (provider) => {
104
104
  const aiModels = await this.fetchBuiltinModels(provider.id);
105
-
106
105
  return (aiModels || [])
107
106
  .map<EnabledAiModel & { enabled?: boolean | null }>((item) => {
108
107
  const user = allModels.find((m) => m.id === item.id && m.providerId === provider.id);
@@ -125,6 +124,7 @@ export class AiInfraRepos {
125
124
  enabled: typeof user.enabled === 'boolean' ? user.enabled : item.enabled,
126
125
  id: item.id,
127
126
  providerId: provider.id,
127
+ settings: item.settings,
128
128
  sort: user.sort || undefined,
129
129
  type: item.type,
130
130
  };
@@ -2,7 +2,7 @@ import { ModelIcon } from '@lobehub/icons';
2
2
  import { ActionIcon, Tooltip } from '@lobehub/ui';
3
3
  import { Popover } from 'antd';
4
4
  import { createStyles } from 'antd-style';
5
- import { Brain, Settings2Icon } from 'lucide-react';
5
+ import { Settings2Icon } from 'lucide-react';
6
6
  import { memo } from 'react';
7
7
  import { useTranslation } from 'react-i18next';
8
8
  import { Center, Flexbox } from 'react-layout-kit';
@@ -57,10 +57,10 @@ const useStyles = createStyles(({ css, token, isDarkMode, cx }) => ({
57
57
  const ModelSwitch = memo(() => {
58
58
  const { t } = useTranslation('chat');
59
59
  const { styles, cx } = useStyles();
60
- const [model, provider, isLoading] = useAgentStore((s) => [
60
+
61
+ const [model, provider] = useAgentStore((s) => [
61
62
  agentSelectors.currentAgentModel(s),
62
63
  agentSelectors.currentAgentModelProvider(s),
63
- agentSelectors.isAgentConfigLoading(s),
64
64
  ]);
65
65
 
66
66
  const isModelHasExtendControls = useAiInfraStore(
@@ -69,17 +69,17 @@ const ModelSwitch = memo(() => {
69
69
 
70
70
  const isMobile = useIsMobile();
71
71
 
72
- if (isLoading)
73
- return (
74
- <ActionIcon
75
- icon={Brain}
76
- placement={'bottom'}
77
- style={{
78
- cursor: 'not-allowed',
79
- }}
80
- title={t('ModelSwitch.title')}
81
- />
82
- );
72
+ // if (isLoading && isLoginWithAuth)
73
+ // return (
74
+ // <ActionIcon
75
+ // icon={Brain}
76
+ // placement={'bottom'}
77
+ // style={{
78
+ // cursor: 'not-allowed',
79
+ // }}
80
+ // title={t('ModelSwitch.title')}
81
+ // />
82
+ // );
83
83
 
84
84
  return (
85
85
  <Flexbox
@@ -32,16 +32,14 @@ const Search = memo(() => {
32
32
  const isMobile = useIsMobile();
33
33
 
34
34
  const theme = useTheme();
35
- if (isLoading)
36
- return (
37
- <ActionIcon
38
- icon={Globe}
39
- placement={'bottom'}
40
- style={{
41
- cursor: 'not-allowed',
42
- }}
43
- />
44
- );
35
+ if (isLoading) return null;
36
+ // <ActionIcon
37
+ // icon={Globe}
38
+ // placement={'bottom'}
39
+ // style={{
40
+ // cursor: 'not-allowed',
41
+ // }}
42
+ // />
45
43
 
46
44
  return (
47
45
  isModelHasBuiltinSearch && (
@@ -1,4 +1,4 @@
1
- import { IPluginErrorType, PluginErrorType } from '@lobehub/chat-plugin-sdk';
1
+ import { IPluginErrorType } from '@lobehub/chat-plugin-sdk';
2
2
  import type { AlertProps } from '@lobehub/ui';
3
3
  import { Skeleton } from 'antd';
4
4
  import dynamic from 'next/dynamic';
@@ -19,7 +19,6 @@ import { ErrorActionContainer } from './style';
19
19
  const loading = () => <Skeleton active />;
20
20
 
21
21
  const OllamaBizError = dynamic(() => import('./OllamaBizError'), { loading, ssr: false });
22
- const PluginSettings = dynamic(() => import('./PluginSettings'), { loading, ssr: false });
23
22
 
24
23
  // Config for the errorMessage display
25
24
  const getErrorAlertConfig = (
@@ -86,10 +85,6 @@ const ErrorMessageExtra = memo<{ data: ChatMessage }>(({ data }) => {
86
85
  if (!error?.type) return;
87
86
 
88
87
  switch (error.type) {
89
- case PluginErrorType.PluginSettingsInvalid: {
90
- return <PluginSettings id={data.id} plugin={data.plugin} />;
91
- }
92
-
93
88
  case AgentRuntimeErrorType.OllamaBizError: {
94
89
  return <OllamaBizError {...data} />;
95
90
  }
@@ -3,12 +3,15 @@ import { Tabs } from 'antd';
3
3
  import { memo } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
5
 
6
+ import PluginResult from './PluginResultJSON';
7
+
6
8
  interface DebugProps {
7
9
  payload: object;
8
10
  requestArgs?: string;
11
+ toolCallId: string;
9
12
  }
10
13
 
11
- const Debug = memo<DebugProps>(({ payload, requestArgs }) => {
14
+ const Debug = memo<DebugProps>(({ payload, requestArgs, toolCallId }) => {
12
15
  const { t } = useTranslation('plugin');
13
16
  let params;
14
17
  try {
@@ -30,11 +33,11 @@ const Debug = memo<DebugProps>(({ payload, requestArgs }) => {
30
33
  key: 'function_call',
31
34
  label: t('debug.function_call'),
32
35
  },
33
- // {
34
- // children: <PluginResult content={content} />,
35
- // key: 'response',
36
- // label: t('debug.response'),
37
- // },
36
+ {
37
+ children: <PluginResult toolCallId={toolCallId} />,
38
+ key: 'response',
39
+ label: t('debug.response'),
40
+ },
38
41
  ]}
39
42
  style={{ display: 'grid', maxWidth: 800, minWidth: 400 }}
40
43
  />
@@ -1,18 +1,23 @@
1
1
  import { Highlighter } from '@lobehub/ui';
2
- import { memo } from 'react';
2
+ import { memo, useMemo } from 'react';
3
+
4
+ import { useChatStore } from '@/store/chat';
5
+ import { chatSelectors } from '@/store/chat/selectors';
3
6
 
4
7
  export interface FunctionMessageProps {
5
- content: string;
8
+ toolCallId: string;
6
9
  }
7
10
 
8
- const PluginResult = memo<FunctionMessageProps>(({ content }) => {
9
- let data;
11
+ const PluginResult = memo<FunctionMessageProps>(({ toolCallId }) => {
12
+ const toolMessage = useChatStore(chatSelectors.getMessageByToolCallId(toolCallId));
10
13
 
11
- try {
12
- data = JSON.stringify(JSON.parse(content), null, 2);
13
- } catch {
14
- data = content;
15
- }
14
+ const data = useMemo(() => {
15
+ try {
16
+ return JSON.stringify(JSON.parse(toolMessage?.content || ''), null, 2);
17
+ } catch {
18
+ return toolMessage?.content || '';
19
+ }
20
+ }, [toolMessage?.content]);
16
21
 
17
22
  return (
18
23
  <Highlighter language={'json'} style={{ maxHeight: 200, maxWidth: 800, overflow: 'scroll' }}>
@@ -21,6 +21,7 @@ const Settings = memo<{ id: string }>(({ id }) => {
21
21
  onClick={() => {
22
22
  setOpen(true);
23
23
  }}
24
+ size={'small'}
24
25
  title={t('setting')}
25
26
  />
26
27
  <PluginDetailModal
@@ -79,6 +79,7 @@ const Inspectors = memo<InspectorProps>(
79
79
  index,
80
80
  identifier,
81
81
  apiName,
82
+ id,
82
83
  arguments: requestArgs,
83
84
  showRender,
84
85
  payload,
@@ -142,7 +143,7 @@ const Inspectors = memo<InspectorProps>(
142
143
  <Settings id={identifier} />
143
144
  </Flexbox>
144
145
  </Flexbox>
145
- {showDebug && <Debug payload={payload} requestArgs={requestArgs} />}
146
+ {showDebug && <Debug payload={payload} requestArgs={requestArgs} toolCallId={id} />}
146
147
  </Flexbox>
147
148
  );
148
149
  },
@@ -29,10 +29,10 @@ const CustomRender = memo<
29
29
 
30
30
  const theme = useTheme();
31
31
  useEffect(() => {
32
- if (!plugin?.type) return;
32
+ if (!plugin?.type || loading) return;
33
33
 
34
34
  setShowPluginRender(plugin?.type !== 'default');
35
- }, [plugin?.type]);
35
+ }, [plugin?.type, loading]);
36
36
 
37
37
  if (isMessageToolUIOpen)
38
38
  return (
@@ -53,6 +53,8 @@ const CustomRender = memo<
53
53
  </Center>
54
54
  );
55
55
 
56
+ if (loading) return <Arguments arguments={requestArgs} shine />;
57
+
56
58
  return (
57
59
  <Flexbox gap={12} id={id} width={'100%'}>
58
60
  {showPluginRender ? (
@@ -0,0 +1,36 @@
1
+ import { Alert, Highlighter } from '@lobehub/ui';
2
+ import { memo } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { Flexbox } from 'react-layout-kit';
5
+
6
+ import { ChatMessageError, ChatPluginPayload } from '@/types/message';
7
+
8
+ import PluginSettings from './PluginSettings';
9
+
10
+ interface ErrorResponseProps extends ChatMessageError {
11
+ id: string;
12
+ plugin?: ChatPluginPayload;
13
+ }
14
+
15
+ const ErrorResponse = memo<ErrorResponseProps>(({ id, type, body, message, plugin }) => {
16
+ const { t } = useTranslation('error');
17
+ if (type === 'PluginSettingsInvalid') {
18
+ return <PluginSettings id={id} plugin={plugin} />;
19
+ }
20
+
21
+ return (
22
+ <Alert
23
+ extra={
24
+ <Flexbox>
25
+ <Highlighter copyButtonSize={'small'} language={'json'} type={'pure'}>
26
+ {JSON.stringify(body || { message, type }, null, 2)}
27
+ </Highlighter>
28
+ </Flexbox>
29
+ }
30
+ message={t(`response.${type}` as any)}
31
+ showIcon
32
+ type={'error'}
33
+ />
34
+ );
35
+ });
36
+ export default ErrorResponse;
@@ -12,7 +12,7 @@ import { pluginHelpers, useToolStore } from '@/store/tool';
12
12
  import { pluginSelectors } from '@/store/tool/selectors';
13
13
  import { ChatPluginPayload } from '@/types/message';
14
14
 
15
- import { ErrorActionContainer, useStyles } from './style';
15
+ import { ErrorActionContainer, useStyles } from '../../../../Error/style';
16
16
 
17
17
  interface PluginSettingsProps {
18
18
  id: string;
@@ -1,5 +1,6 @@
1
1
  import { Suspense, memo } from 'react';
2
2
 
3
+ import ErrorResponse from '@/features/Conversation/Messages/Assistant/Tool/Render/ErrorResponse';
3
4
  import { useChatStore } from '@/store/chat';
4
5
  import { chatSelectors } from '@/store/chat/selectors';
5
6
 
@@ -22,7 +23,11 @@ const Render = memo<RenderProps>(
22
23
  // ε¦‚ζžœε€„δΊŽ loading ζˆ–θ€…ζ‰ΎδΈεˆ° toolMessage εˆ™ε±•η€Ί Arguments
23
24
  if (loading || !toolMessage) return <Arguments arguments={requestArgs} />;
24
25
 
25
- if (!!toolMessage)
26
+ if (!!toolMessage) {
27
+ if (toolMessage.error) {
28
+ return <ErrorResponse {...toolMessage.error} id={messageId} plugin={toolMessage.plugin} />;
29
+ }
30
+
26
31
  return (
27
32
  <Suspense fallback={<Arguments arguments={requestArgs} shine />}>
28
33
  <CustomRender
@@ -33,6 +38,7 @@ const Render = memo<RenderProps>(
33
38
  />
34
39
  </Suspense>
35
40
  );
41
+ }
36
42
  },
37
43
  );
38
44
 
@@ -1,6 +1,7 @@
1
1
  import { DeepPartial } from 'utility-types';
2
2
 
3
3
  import { INBOX_SESSION_ID } from '@/const/session';
4
+ import { DEFAULT_AGENT_CONFIG } from '@/const/settings';
4
5
  import { SessionModel } from '@/database/_deprecated/models/session';
5
6
  import { SessionGroupModel } from '@/database/_deprecated/models/sessionGroup';
6
7
  import { UserModel } from '@/database/_deprecated/models/user';
@@ -47,7 +48,7 @@ export class ClientService implements ISessionService {
47
48
 
48
49
  async getSessionConfig(id: string): Promise<LobeAgentConfig> {
49
50
  if (!id || id === INBOX_SESSION_ID) {
50
- return UserModel.getAgentConfig();
51
+ return (await UserModel.getAgentConfig()) || DEFAULT_AGENT_CONFIG;
51
52
  }
52
53
 
53
54
  const res = await SessionModel.findById(id);
@@ -294,6 +294,7 @@ export interface AiProviderModelListItem {
294
294
  id: string;
295
295
  pricing?: ChatModelPricing;
296
296
  releasedAt?: string;
297
+ settings?: AiModelSettings;
297
298
  source?: AiModelSourceType;
298
299
  type: AiModelType;
299
300
  }