@lobehub/chat 1.110.2 → 1.110.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/CHANGELOG.md +50 -0
- package/apps/desktop/src/main/controllers/__tests__/MenuCtr.test.ts +13 -13
- package/changelog/v1.json +18 -0
- package/next.config.ts +1 -0
- package/package.json +4 -4
- package/packages/types/package.json +5 -13
- package/packages/types/src/aiProvider.ts +2 -2
- package/packages/types/src/importer.ts +4 -4
- package/packages/types/src/index.ts +3 -0
- package/packages/types/src/llm.ts +2 -2
- package/packages/types/src/rag.ts +1 -1
- package/packages/types/src/serverConfig.ts +3 -6
- package/packages/types/src/trace/action.ts +24 -1
- package/packages/types/src/trace/enum.ts +32 -0
- package/packages/types/src/trace/index.ts +1 -0
- package/packages/types/src/user/index.ts +3 -3
- package/src/app/(backend)/_deprecated/createBizOpenAI/auth.ts +1 -1
- package/src/app/(backend)/_deprecated/createBizOpenAI/createAzureOpenai.ts +1 -1
- package/src/app/(backend)/_deprecated/createBizOpenAI/createOpenai.ts +1 -1
- package/src/app/(backend)/_deprecated/createBizOpenAI/index.ts +1 -1
- package/src/app/(backend)/middleware/auth/index.test.ts +1 -1
- package/src/app/(backend)/middleware/auth/index.ts +1 -1
- package/src/app/(backend)/middleware/auth/utils.ts +1 -1
- package/src/app/(backend)/webapi/chat/[provider]/route.test.ts +1 -1
- package/src/app/(backend)/webapi/chat/[provider]/route.ts +1 -1
- package/src/app/(backend)/webapi/models/[provider]/pull/route.ts +1 -1
- package/src/app/(backend)/webapi/models/[provider]/route.ts +1 -1
- package/src/app/(backend)/webapi/plugin/gateway/route.ts +2 -2
- package/src/app/(backend)/webapi/text-to-image/[provider]/route.ts +1 -1
- package/src/app/(backend)/webapi/trace/route.ts +1 -1
- package/src/app/[variants]/(main)/settings/_layout/Desktop/index.tsx +2 -1
- package/src/app/[variants]/(main)/settings/llm/components/Checker.tsx +1 -1
- package/src/app/[variants]/(main)/settings/provider/_layout/Desktop/Container.tsx +1 -0
- package/src/app/[variants]/(main)/settings/provider/_layout/Desktop/index.tsx +4 -9
- package/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/Checker.tsx +1 -1
- package/src/app/[variants]/layout.tsx +2 -1
- package/src/components/InnerLink.tsx +20 -0
- package/src/const/trace.ts +2 -33
- package/src/features/AgentSetting/store/action.ts +2 -2
- package/src/features/Conversation/Error/index.tsx +1 -1
- package/src/features/ElectronTitlebar/UpdateModal.tsx +15 -3
- package/src/features/Portal/Artifacts/Header.tsx +1 -1
- package/src/hooks/usePlatform.ts +1 -1
- package/src/layout/GlobalProvider/index.tsx +3 -0
- package/src/libs/model-runtime/ModelRuntime.test.ts +1 -1
- package/src/libs/model-runtime/ModelRuntime.ts +1 -2
- package/src/libs/traces/event.test.ts +1 -2
- package/src/libs/traces/event.ts +1 -1
- package/src/server/ld.ts +1 -1
- package/src/server/modules/ModelRuntime/trace.ts +2 -6
- package/src/services/__tests__/chat.test.ts +1 -1
- package/src/services/chat.ts +1 -2
- package/src/store/chat/slices/aiChat/actions/generateAIChat.ts +1 -1
- package/src/store/chat/slices/aiChat/actions/memory.ts +1 -1
- package/src/store/chat/slices/message/action.test.ts +1 -1
- package/src/store/chat/slices/message/action.ts +1 -2
- package/src/store/chat/slices/plugin/action.ts +1 -1
- package/src/store/chat/slices/topic/action.ts +1 -1
- package/src/store/chat/slices/translate/action.ts +1 -1
- package/src/store/serverConfig/Provider.tsx +7 -2
- package/src/store/serverConfig/store.ts +2 -0
- package/src/utils/errorResponse.test.ts +1 -1
- package/src/utils/errorResponse.ts +1 -1
- package/src/utils/fetch/__tests__/parseError.test.ts +1 -1
- package/src/utils/fetch/fetchSSE.ts +1 -1
- package/src/utils/fetch/parseError.ts +1 -1
- package/packages/types/src/share.ts +0 -7
- /package/{packages/types/src → src/types}/locale.ts +0 -0
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,56 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.110.4](https://github.com/lobehub/lobe-chat/compare/v1.110.3...v1.110.4)
|
6
|
+
|
7
|
+
<sup>Released on **2025-08-06**</sup>
|
8
|
+
|
9
|
+
#### ♻ Code Refactoring
|
10
|
+
|
11
|
+
- **misc**: Refactor trace type.
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
<details>
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
17
|
+
|
18
|
+
#### Code refactoring
|
19
|
+
|
20
|
+
- **misc**: Refactor trace type, closes [#8699](https://github.com/lobehub/lobe-chat/issues/8699) ([4e71af7](https://github.com/lobehub/lobe-chat/commit/4e71af7))
|
21
|
+
|
22
|
+
</details>
|
23
|
+
|
24
|
+
<div align="right">
|
25
|
+
|
26
|
+
[](#readme-top)
|
27
|
+
|
28
|
+
</div>
|
29
|
+
|
30
|
+
### [Version 1.110.3](https://github.com/lobehub/lobe-chat/compare/v1.110.2...v1.110.3)
|
31
|
+
|
32
|
+
<sup>Released on **2025-08-06**</sup>
|
33
|
+
|
34
|
+
#### 💄 Styles
|
35
|
+
|
36
|
+
- **misc**: Fix provider setting page hydration error.
|
37
|
+
|
38
|
+
<br/>
|
39
|
+
|
40
|
+
<details>
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
42
|
+
|
43
|
+
#### Styles
|
44
|
+
|
45
|
+
- **misc**: Fix provider setting page hydration error, closes [#8695](https://github.com/lobehub/lobe-chat/issues/8695) ([88e7d2a](https://github.com/lobehub/lobe-chat/commit/88e7d2a))
|
46
|
+
|
47
|
+
</details>
|
48
|
+
|
49
|
+
<div align="right">
|
50
|
+
|
51
|
+
[](#readme-top)
|
52
|
+
|
53
|
+
</div>
|
54
|
+
|
5
55
|
### [Version 1.110.2](https://github.com/lobehub/lobe-chat/compare/v1.110.1...v1.110.2)
|
6
56
|
|
7
57
|
<sup>Released on **2025-08-06**</sup>
|
@@ -29,9 +29,9 @@ describe('MenuController', () => {
|
|
29
29
|
it('should call menuManager.refreshMenus', () => {
|
30
30
|
// 模拟返回值
|
31
31
|
mockRefreshMenus.mockReturnValueOnce(true);
|
32
|
-
|
32
|
+
|
33
33
|
const result = menuController.refreshAppMenu();
|
34
|
-
|
34
|
+
|
35
35
|
expect(mockRefreshMenus).toHaveBeenCalled();
|
36
36
|
expect(result).toBe(true);
|
37
37
|
});
|
@@ -41,9 +41,9 @@ describe('MenuController', () => {
|
|
41
41
|
it('should call menuManager.showContextMenu with type only', () => {
|
42
42
|
const menuType = 'chat';
|
43
43
|
mockShowContextMenu.mockReturnValueOnce({ shown: true });
|
44
|
-
|
45
|
-
const result = menuController.showContextMenu(menuType);
|
46
|
-
|
44
|
+
|
45
|
+
const result = menuController.showContextMenu({ type: menuType });
|
46
|
+
|
47
47
|
expect(mockShowContextMenu).toHaveBeenCalledWith(menuType, undefined);
|
48
48
|
expect(result).toEqual({ shown: true });
|
49
49
|
});
|
@@ -52,9 +52,9 @@ describe('MenuController', () => {
|
|
52
52
|
const menuType = 'file';
|
53
53
|
const menuData = { fileId: '123', filePath: '/path/to/file.txt' };
|
54
54
|
mockShowContextMenu.mockReturnValueOnce({ shown: true });
|
55
|
-
|
56
|
-
const result = menuController.showContextMenu(menuType, menuData);
|
57
|
-
|
55
|
+
|
56
|
+
const result = menuController.showContextMenu({ type: menuType, data: menuData });
|
57
|
+
|
58
58
|
expect(mockShowContextMenu).toHaveBeenCalledWith(menuType, menuData);
|
59
59
|
expect(result).toEqual({ shown: true });
|
60
60
|
});
|
@@ -63,20 +63,20 @@ describe('MenuController', () => {
|
|
63
63
|
describe('setDevMenuVisibility', () => {
|
64
64
|
it('should call menuManager.rebuildAppMenu with showDevItems true', () => {
|
65
65
|
mockRebuildAppMenu.mockReturnValueOnce(true);
|
66
|
-
|
66
|
+
|
67
67
|
const result = menuController.setDevMenuVisibility(true);
|
68
|
-
|
68
|
+
|
69
69
|
expect(mockRebuildAppMenu).toHaveBeenCalledWith({ showDevItems: true });
|
70
70
|
expect(result).toBe(true);
|
71
71
|
});
|
72
72
|
|
73
73
|
it('should call menuManager.rebuildAppMenu with showDevItems false', () => {
|
74
74
|
mockRebuildAppMenu.mockReturnValueOnce(true);
|
75
|
-
|
75
|
+
|
76
76
|
const result = menuController.setDevMenuVisibility(false);
|
77
|
-
|
77
|
+
|
78
78
|
expect(mockRebuildAppMenu).toHaveBeenCalledWith({ showDevItems: false });
|
79
79
|
expect(result).toBe(true);
|
80
80
|
});
|
81
81
|
});
|
82
|
-
});
|
82
|
+
});
|
package/changelog/v1.json
CHANGED
@@ -1,4 +1,22 @@
|
|
1
1
|
[
|
2
|
+
{
|
3
|
+
"children": {
|
4
|
+
"improvements": [
|
5
|
+
"Refactor trace type."
|
6
|
+
]
|
7
|
+
},
|
8
|
+
"date": "2025-08-06",
|
9
|
+
"version": "1.110.4"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"children": {
|
13
|
+
"improvements": [
|
14
|
+
"Fix provider setting page hydration error."
|
15
|
+
]
|
16
|
+
},
|
17
|
+
"date": "2025-08-06",
|
18
|
+
"version": "1.110.3"
|
19
|
+
},
|
2
20
|
{
|
3
21
|
"children": {
|
4
22
|
"fixes": [
|
package/next.config.ts
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.110.
|
3
|
+
"version": "1.110.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",
|
@@ -129,9 +129,9 @@
|
|
129
129
|
"@azure-rest/ai-inference": "1.0.0-beta.5",
|
130
130
|
"@azure/core-auth": "^1.10.0",
|
131
131
|
"@cfworker/json-schema": "^4.1.1",
|
132
|
-
"@clerk/localizations": "^3.20.
|
133
|
-
"@clerk/nextjs": "^6.
|
134
|
-
"@clerk/themes": "^2.
|
132
|
+
"@clerk/localizations": "^3.20.6",
|
133
|
+
"@clerk/nextjs": "^6.28.1",
|
134
|
+
"@clerk/themes": "^2.4.4",
|
135
135
|
"@codesandbox/sandpack-react": "^2.20.0",
|
136
136
|
"@cyntler/react-doc-viewer": "^1.17.0",
|
137
137
|
"@electric-sql/pglite": "0.2.17",
|
@@ -2,19 +2,11 @@
|
|
2
2
|
"name": "@lobechat/types",
|
3
3
|
"version": "1.0.0",
|
4
4
|
"private": true,
|
5
|
-
"
|
6
|
-
"./*": {
|
7
|
-
"types": [
|
8
|
-
"./src/*.ts",
|
9
|
-
"./src/*/index.ts"
|
10
|
-
],
|
11
|
-
"default": [
|
12
|
-
"./src/*.ts",
|
13
|
-
"./src/*/index.ts"
|
14
|
-
]
|
15
|
-
}
|
16
|
-
},
|
5
|
+
"main": "./src/index.ts",
|
17
6
|
"dependencies": {
|
18
|
-
"@
|
7
|
+
"@lobechat/web-crawler": "workspace:*",
|
8
|
+
"@lobehub/chat-plugin-sdk": "^1.32.4",
|
9
|
+
"type-fest": "^4.41.0",
|
10
|
+
"zod": "^3.25.76"
|
19
11
|
}
|
20
12
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { z } from 'zod';
|
2
2
|
|
3
|
-
import { AiModelForSelect, EnabledAiModel, ModelSearchImplementType } from '
|
4
|
-
import { ResponseAnimation } from '
|
3
|
+
import { AiModelForSelect, EnabledAiModel, ModelSearchImplementType } from './aiModel';
|
4
|
+
import { ResponseAnimation } from './llm';
|
5
5
|
|
6
6
|
export const AiProviderSourceEnum = {
|
7
7
|
Builtin: 'builtin',
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { LobeAgentConfig } from '
|
1
|
+
import { LobeAgentConfig } from './agent';
|
2
2
|
import {
|
3
3
|
ChatMessageError,
|
4
4
|
ChatPluginPayload,
|
@@ -6,9 +6,9 @@ import {
|
|
6
6
|
ChatToolPayload,
|
7
7
|
ChatTranslate,
|
8
8
|
MessageRoleType,
|
9
|
-
} from '
|
10
|
-
import { MetaData } from '
|
11
|
-
import { SessionGroupId } from '
|
9
|
+
} from './message';
|
10
|
+
import { MetaData } from './meta';
|
11
|
+
import { SessionGroupId } from './session';
|
12
12
|
|
13
13
|
export interface ImportSession {
|
14
14
|
config: LobeAgentConfig;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { ReactNode } from 'react';
|
2
2
|
|
3
|
-
import { AiModelType, ChatModelPricing } from '
|
4
|
-
import { AiProviderSettings } from '
|
3
|
+
import { AiModelType, ChatModelPricing } from './aiModel';
|
4
|
+
import { AiProviderSettings } from './aiProvider';
|
5
5
|
|
6
6
|
export type ModelPriceCurrency = 'CNY' | 'USD';
|
7
7
|
|
@@ -1,12 +1,9 @@
|
|
1
1
|
import type { PartialDeep } from 'type-fest';
|
2
2
|
|
3
3
|
import { IFeatureFlags } from '@/config/featureFlags';
|
4
|
-
|
5
|
-
import {
|
6
|
-
|
7
|
-
UserDefaultAgent,
|
8
|
-
UserSystemAgentConfig,
|
9
|
-
} from '@/types/user/settings';
|
4
|
+
|
5
|
+
import { ChatModelCard } from './llm';
|
6
|
+
import { GlobalLLMProviderKey, UserDefaultAgent, UserSystemAgentConfig } from './user/settings';
|
10
7
|
|
11
8
|
export interface ServerModelProviderConfig {
|
12
9
|
enabled?: boolean;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { TraceEventType } from '
|
1
|
+
import { TraceEventType, TraceNameMap } from './enum';
|
2
2
|
|
3
3
|
export interface TraceEventBasePayload {
|
4
4
|
content: string;
|
@@ -29,3 +29,26 @@ export type TraceEventPayloads =
|
|
29
29
|
| TraceEventModifyMessage
|
30
30
|
| TraceEventDeleteAndRegenerateMessage
|
31
31
|
| TraceEventRegenerateMessage;
|
32
|
+
|
33
|
+
export interface TracePayload {
|
34
|
+
/**
|
35
|
+
* if user allow to trace
|
36
|
+
*/
|
37
|
+
enabled?: boolean;
|
38
|
+
observationId?: string;
|
39
|
+
/**
|
40
|
+
* chat session: agentId or groupId
|
41
|
+
*/
|
42
|
+
sessionId?: string;
|
43
|
+
tags?: string[];
|
44
|
+
/**
|
45
|
+
* chat topicId
|
46
|
+
*/
|
47
|
+
topicId?: string;
|
48
|
+
traceId?: string;
|
49
|
+
traceName?: TraceNameMap;
|
50
|
+
/**
|
51
|
+
* user uuid
|
52
|
+
*/
|
53
|
+
userId?: string;
|
54
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
export enum TraceNameMap {
|
2
|
+
ConnectivityChecker = 'Connectivity Checker',
|
3
|
+
Conversation = 'Conversation',
|
4
|
+
EmojiPicker = 'Emoji Picker',
|
5
|
+
FetchPluginAPI = 'Fetch Plugin API',
|
6
|
+
LanguageDetect = 'Language Detect',
|
7
|
+
SearchIntentRecognition = 'Search Intent Recognition',
|
8
|
+
SummaryAgentDescription = 'Summary Agent Description',
|
9
|
+
SummaryAgentTags = 'Summary Agent Tags',
|
10
|
+
SummaryAgentTitle = 'Summary Agent Title',
|
11
|
+
SummaryHistoryMessages = 'Summary History Messages',
|
12
|
+
SummaryTopicTitle = 'Summary Topic Title',
|
13
|
+
Translator = 'Translator',
|
14
|
+
}
|
15
|
+
|
16
|
+
export enum TraceEventType {
|
17
|
+
CopyMessage = 'Copy Message',
|
18
|
+
DeleteAndRegenerateMessage = 'Delete And Regenerate Message',
|
19
|
+
ModifyMessage = 'Modify Message',
|
20
|
+
RegenerateMessage = 'Regenerate Message',
|
21
|
+
}
|
22
|
+
|
23
|
+
export enum TraceTopicType {
|
24
|
+
AgentSettings = 'Agent Settings',
|
25
|
+
}
|
26
|
+
|
27
|
+
export enum TraceTagMap {
|
28
|
+
Chat = 'Chat Competition',
|
29
|
+
SystemChain = 'System Chain',
|
30
|
+
ToolCalling = 'Tool Calling',
|
31
|
+
ToolsCalling = 'Tools Calling',
|
32
|
+
}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import type { PartialDeep } from 'type-fest';
|
2
2
|
import { z } from 'zod';
|
3
3
|
|
4
|
-
import { Plans } from '
|
5
|
-
import { TopicDisplayMode } from '
|
6
|
-
import { UserSettings } from '
|
4
|
+
import { Plans } from '../subscription';
|
5
|
+
import { TopicDisplayMode } from '../topic';
|
6
|
+
import { UserSettings } from '../user/settings';
|
7
7
|
|
8
8
|
export interface LobeUser {
|
9
9
|
avatar?: string;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// @vitest-environment node
|
2
2
|
import { getAuth } from '@clerk/nextjs/server';
|
3
|
-
import { ChatErrorType } from '@lobechat/types
|
3
|
+
import { ChatErrorType } from '@lobechat/types';
|
4
4
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
5
5
|
|
6
6
|
import { checkAuthMethod } from '@/app/(backend)/middleware/auth/utils';
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { ChatErrorType, ErrorType } from '@lobechat/types
|
1
|
+
import { ChatErrorType, ErrorType , TraceNameMap } from '@lobechat/types';
|
2
2
|
import { PluginRequestPayload } from '@lobehub/chat-plugin-sdk';
|
3
3
|
import { createGatewayOnEdgeRuntime } from '@lobehub/chat-plugins-gateway';
|
4
4
|
|
5
5
|
import { LOBE_CHAT_AUTH_HEADER, OAUTH_AUTHORIZED, enableNextAuth } from '@/const/auth';
|
6
|
-
import { LOBE_CHAT_TRACE_ID
|
6
|
+
import { LOBE_CHAT_TRACE_ID } from '@/const/trace';
|
7
7
|
import { getAppConfig } from '@/envs/app';
|
8
8
|
import { AgentRuntimeError } from '@/libs/model-runtime';
|
9
9
|
import { TraceClient } from '@/libs/traces';
|
@@ -27,7 +27,8 @@ const Layout = memo<LayoutProps>(({ children, category }) => {
|
|
27
27
|
const activeKey = useActiveSettingsKey();
|
28
28
|
const theme = useTheme();
|
29
29
|
const pathname = usePathname();
|
30
|
-
|
30
|
+
|
31
|
+
const isSkip = SKIP_PATHS.some((path) => pathname.includes(path));
|
31
32
|
const isProvider = pathname.includes('/settings/provider/');
|
32
33
|
const providerName = useProviderName(activeKey);
|
33
34
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
3
|
import { CheckCircleFilled } from '@ant-design/icons';
|
4
|
+
import { TraceNameMap } from '@lobechat/types';
|
4
5
|
import { Alert, Button, Highlighter } from '@lobehub/ui';
|
5
6
|
import { useTheme } from 'antd-style';
|
6
7
|
import { memo, useState } from 'react';
|
7
8
|
import { useTranslation } from 'react-i18next';
|
8
9
|
import { Flexbox } from 'react-layout-kit';
|
9
10
|
|
10
|
-
import { TraceNameMap } from '@/const/trace';
|
11
11
|
import { useIsMobile } from '@/hooks/useIsMobile';
|
12
12
|
import { useProviderName } from '@/hooks/useProviderName';
|
13
13
|
import { chatService } from '@/services/chat';
|
@@ -8,6 +8,7 @@ import SettingContainer from '@/features/Setting/SettingContainer';
|
|
8
8
|
const Container = memo<PropsWithChildren>(({ children }) => {
|
9
9
|
const path = usePathname();
|
10
10
|
const isRoot = path === '/settings/provider';
|
11
|
+
|
11
12
|
return <SettingContainer variant={isRoot ? 'secondary' : undefined}>{children}</SettingContainer>;
|
12
13
|
});
|
13
14
|
export default Container;
|
@@ -1,20 +1,15 @@
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
2
2
|
import { Flexbox } from 'react-layout-kit';
|
3
3
|
|
4
|
-
import NProgress from '@/components/NProgress';
|
5
|
-
|
6
4
|
import ProviderMenu from '../../ProviderMenu';
|
7
5
|
import Container from './Container';
|
8
6
|
|
9
7
|
const Layout = ({ children }: PropsWithChildren) => {
|
10
8
|
return (
|
11
|
-
|
12
|
-
<
|
13
|
-
<
|
14
|
-
|
15
|
-
<Container>{children}</Container>
|
16
|
-
</Flexbox>
|
17
|
-
</>
|
9
|
+
<Flexbox horizontal width={'100%'}>
|
10
|
+
<ProviderMenu />
|
11
|
+
<Container>{children}</Container>
|
12
|
+
</Flexbox>
|
18
13
|
);
|
19
14
|
};
|
20
15
|
export default Layout;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
3
|
import { CheckCircleFilled } from '@ant-design/icons';
|
4
|
+
import { TraceNameMap } from '@lobechat/types';
|
4
5
|
import { ModelIcon } from '@lobehub/icons';
|
5
6
|
import { Alert, Button, Highlighter, Icon, Select } from '@lobehub/ui';
|
6
7
|
import { useTheme } from 'antd-style';
|
@@ -9,7 +10,6 @@ import { ReactNode, memo, useState } from 'react';
|
|
9
10
|
import { useTranslation } from 'react-i18next';
|
10
11
|
import { Flexbox } from 'react-layout-kit';
|
11
12
|
|
12
|
-
import { TraceNameMap } from '@/const/trace';
|
13
13
|
import { useProviderName } from '@/hooks/useProviderName';
|
14
14
|
import { chatService } from '@/services/chat';
|
15
15
|
import { aiModelSelectors, aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
|
@@ -31,7 +31,7 @@ const RootLayout = async ({ children, params, modal }: RootLayoutProps) => {
|
|
31
31
|
const direction = isRtlLang(locale) ? 'rtl' : 'ltr';
|
32
32
|
|
33
33
|
return (
|
34
|
-
<html dir={direction} lang={locale}
|
34
|
+
<html dir={direction} lang={locale}>
|
35
35
|
<head>
|
36
36
|
{process.env.DEBUG_REACT_SCAN === '1' && (
|
37
37
|
// eslint-disable-next-line @next/next/no-sync-scripts
|
@@ -46,6 +46,7 @@ const RootLayout = async ({ children, params, modal }: RootLayoutProps) => {
|
|
46
46
|
locale={locale}
|
47
47
|
neutralColor={neutralColor}
|
48
48
|
primaryColor={primaryColor}
|
49
|
+
variants={variants}
|
49
50
|
>
|
50
51
|
<AuthProvider>
|
51
52
|
{children}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
'use client';
|
2
|
+
|
3
|
+
import Link, { LinkProps } from 'next/link';
|
4
|
+
import { AnchorHTMLAttributes, ReactNode } from 'react';
|
5
|
+
|
6
|
+
import { useServerConfigStore } from '@/store/serverConfig';
|
7
|
+
|
8
|
+
interface InnerLinkProps
|
9
|
+
extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof LinkProps>,
|
10
|
+
LinkProps {
|
11
|
+
children?: ReactNode | undefined;
|
12
|
+
}
|
13
|
+
|
14
|
+
const InnerLink = ({ href, ...props }: InnerLinkProps) => {
|
15
|
+
const variants = useServerConfigStore((s) => s.segmentVariants);
|
16
|
+
|
17
|
+
return <Link {...props} as={href} href={`/${variants}${href}`} />;
|
18
|
+
};
|
19
|
+
|
20
|
+
export default InnerLink;
|
package/src/const/trace.ts
CHANGED
@@ -1,40 +1,9 @@
|
|
1
|
+
import { TraceNameMap } from '@/types/trace';
|
2
|
+
|
1
3
|
export const LOBE_CHAT_TRACE_HEADER = 'X-lobe-trace';
|
2
4
|
export const LOBE_CHAT_TRACE_ID = 'X-lobe-chat-trace-id';
|
3
5
|
export const LOBE_CHAT_OBSERVATION_ID = 'X-lobe-observation-id';
|
4
6
|
|
5
|
-
export enum TraceNameMap {
|
6
|
-
ConnectivityChecker = 'Connectivity Checker',
|
7
|
-
Conversation = 'Conversation',
|
8
|
-
EmojiPicker = 'Emoji Picker',
|
9
|
-
FetchPluginAPI = 'Fetch Plugin API',
|
10
|
-
LanguageDetect = 'Language Detect',
|
11
|
-
SearchIntentRecognition = 'Search Intent Recognition',
|
12
|
-
SummaryAgentDescription = 'Summary Agent Description',
|
13
|
-
SummaryAgentTags = 'Summary Agent Tags',
|
14
|
-
SummaryAgentTitle = 'Summary Agent Title',
|
15
|
-
SummaryHistoryMessages = 'Summary History Messages',
|
16
|
-
SummaryTopicTitle = 'Summary Topic Title',
|
17
|
-
Translator = 'Translator',
|
18
|
-
}
|
19
|
-
|
20
|
-
export enum TraceEventType {
|
21
|
-
CopyMessage = 'Copy Message',
|
22
|
-
DeleteAndRegenerateMessage = 'Delete And Regenerate Message',
|
23
|
-
ModifyMessage = 'Modify Message',
|
24
|
-
RegenerateMessage = 'Regenerate Message',
|
25
|
-
}
|
26
|
-
|
27
|
-
export enum TraceTopicType {
|
28
|
-
AgentSettings = 'Agent Settings',
|
29
|
-
}
|
30
|
-
|
31
|
-
export enum TraceTagMap {
|
32
|
-
Chat = 'Chat Competition',
|
33
|
-
SystemChain = 'System Chain',
|
34
|
-
ToolCalling = 'Tool Calling',
|
35
|
-
ToolsCalling = 'Tools Calling',
|
36
|
-
}
|
37
|
-
|
38
7
|
export interface TracePayload {
|
39
8
|
/**
|
40
9
|
* if user allow to trace
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import
|
1
|
+
import { TraceNameMap, TracePayload, TraceTopicType } from '@lobechat/types';
|
2
2
|
import { getSingletonAnalyticsOptional } from '@lobehub/analytics';
|
3
|
+
import type { PartialDeep } from 'type-fest';
|
3
4
|
import { StateCreator } from 'zustand/vanilla';
|
4
5
|
|
5
6
|
import { chainPickEmoji } from '@/chains/pickEmoji';
|
6
7
|
import { chainSummaryAgentName } from '@/chains/summaryAgentName';
|
7
8
|
import { chainSummaryDescription } from '@/chains/summaryDescription';
|
8
9
|
import { chainSummaryTags } from '@/chains/summaryTags';
|
9
|
-
import { TraceNameMap, TracePayload, TraceTopicType } from '@/const/trace';
|
10
10
|
import { chatService } from '@/services/chat';
|
11
11
|
import { useUserStore } from '@/store/user';
|
12
12
|
import { systemAgentSelectors } from '@/store/user/slices/settings/selectors';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ChatErrorType, ErrorType } from '@lobechat/types
|
1
|
+
import { ChatErrorType, ErrorType } from '@lobechat/types';
|
2
2
|
import { IPluginErrorType } from '@lobehub/chat-plugin-sdk';
|
3
3
|
import type { AlertProps } from '@lobehub/ui';
|
4
4
|
import { Skeleton } from 'antd';
|
@@ -115,11 +115,23 @@ export const UpdateModal = memo(() => {
|
|
115
115
|
const closeDownloadedModal = () => setDownloadedInfo(null);
|
116
116
|
const closeLatestVersionModal = () => setLatestVersionInfo(null);
|
117
117
|
|
118
|
+
const handleCancelCheck = () => {
|
119
|
+
setIsChecking(false);
|
120
|
+
setUpdateAvailableInfo(null);
|
121
|
+
setDownloadedInfo(null);
|
122
|
+
setProgress(null);
|
123
|
+
setLatestVersionInfo(null);
|
124
|
+
};
|
125
|
+
|
118
126
|
const renderCheckingModal = () => (
|
119
127
|
<Modal
|
120
|
-
closable
|
121
|
-
footer={
|
122
|
-
|
128
|
+
closable
|
129
|
+
footer={[
|
130
|
+
<Button key="cancel" onClick={handleCancelCheck}>
|
131
|
+
{t('cancel', { ns: 'common' })}
|
132
|
+
</Button>,
|
133
|
+
]}
|
134
|
+
onCancel={handleCancelCheck}
|
123
135
|
open={isChecking}
|
124
136
|
title={t('updater.checkingUpdate')}
|
125
137
|
>
|
package/src/hooks/usePlatform.ts
CHANGED
@@ -23,6 +23,7 @@ interface GlobalLayoutProps {
|
|
23
23
|
locale: string;
|
24
24
|
neutralColor?: string;
|
25
25
|
primaryColor?: string;
|
26
|
+
variants?: string;
|
26
27
|
}
|
27
28
|
|
28
29
|
const GlobalLayout = async ({
|
@@ -32,6 +33,7 @@ const GlobalLayout = async ({
|
|
32
33
|
locale: userLocale,
|
33
34
|
appearance,
|
34
35
|
isMobile,
|
36
|
+
variants,
|
35
37
|
}: GlobalLayoutProps) => {
|
36
38
|
const antdLocale = await getAntdLocale(userLocale);
|
37
39
|
|
@@ -52,6 +54,7 @@ const GlobalLayout = async ({
|
|
52
54
|
<ServerConfigStoreProvider
|
53
55
|
featureFlags={serverFeatureFlags}
|
54
56
|
isMobile={isMobile}
|
57
|
+
segmentVariants={variants}
|
55
58
|
serverConfig={serverConfig}
|
56
59
|
>
|
57
60
|
<QueryProvider>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
// @vitest-environment node
|
2
|
+
import { TraceNameMap } from '@lobechat/types';
|
2
3
|
import { Langfuse } from 'langfuse';
|
3
4
|
import { LangfuseGenerationClient, LangfuseTraceClient } from 'langfuse-core';
|
4
5
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
5
6
|
|
6
7
|
import * as langfuseCfg from '@/config/langfuse';
|
7
8
|
import { ClientSecretPayload } from '@/const/auth';
|
8
|
-
import { TraceNameMap } from '@/const/trace';
|
9
9
|
import { ChatStreamPayload, LobeOpenAI, ModelProvider, ModelRuntime } from '@/libs/model-runtime';
|
10
10
|
import { providerRuntimeMap } from '@/libs/model-runtime/runtimeMap';
|
11
11
|
import { CreateImagePayload } from '@/libs/model-runtime/types/image';
|
@@ -1,7 +1,6 @@
|
|
1
|
+
import type { TracePayload } from '@lobechat/types';
|
1
2
|
import { ClientOptions } from 'openai';
|
2
3
|
|
3
|
-
import type { TracePayload } from '@/const/trace';
|
4
|
-
|
5
4
|
import { LobeRuntimeAI } from './BaseAI';
|
6
5
|
import { LobeBedrockAIParams } from './bedrock';
|
7
6
|
import { LobeCloudflareParams } from './cloudflare';
|
@@ -1,9 +1,8 @@
|
|
1
|
+
import { TraceEventType } from '@lobechat/types';
|
1
2
|
import { diffChars } from 'diff';
|
2
3
|
import { LangfuseTraceClient } from 'langfuse-core';
|
3
4
|
import { describe, expect, it } from 'vitest';
|
4
5
|
|
5
|
-
import { TraceEventType } from '@/const/trace';
|
6
|
-
|
7
6
|
import { EventScore, TraceEventClient } from './event';
|
8
7
|
|
9
8
|
describe('TraceEventClient', () => {
|
package/src/libs/traces/event.ts
CHANGED
package/src/server/ld.ts
CHANGED
@@ -22,7 +22,7 @@ export const AUTHOR_LIST = {
|
|
22
22
|
avatar: 'https://avatars.githubusercontent.com/u/17870709?v=4',
|
23
23
|
desc: 'Founder, Design Engineer',
|
24
24
|
name: 'CanisMinor',
|
25
|
-
url: 'https://github.com/
|
25
|
+
url: 'https://github.com/canisminor1990',
|
26
26
|
},
|
27
27
|
lobehub: {
|
28
28
|
avatar: 'https://avatars.githubusercontent.com/u/131470832?v=4',
|
@@ -1,12 +1,8 @@
|
|
1
|
+
import { TracePayload, TraceTagMap } from '@lobechat/types';
|
1
2
|
import { after } from 'next/server';
|
2
3
|
|
3
4
|
import { INBOX_SESSION_ID } from '@/const/session';
|
4
|
-
import {
|
5
|
-
LOBE_CHAT_OBSERVATION_ID,
|
6
|
-
LOBE_CHAT_TRACE_ID,
|
7
|
-
TracePayload,
|
8
|
-
TraceTagMap,
|
9
|
-
} from '@/const/trace';
|
5
|
+
import { LOBE_CHAT_OBSERVATION_ID, LOBE_CHAT_TRACE_ID } from '@/const/trace';
|
10
6
|
import { ChatStreamCallbacks, ChatStreamPayload } from '@/libs/model-runtime';
|
11
7
|
import { TraceClient } from '@/libs/traces';
|
12
8
|
|
package/src/services/chat.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ChatErrorType } from '@lobechat/types
|
1
|
+
import { ChatErrorType , TracePayload, TraceTagMap } from '@lobechat/types';
|
2
2
|
import { PluginRequestPayload, createHeadersWithPluginSettings } from '@lobehub/chat-plugin-sdk';
|
3
3
|
import { produce } from 'immer';
|
4
4
|
import { merge } from 'lodash-es';
|
@@ -7,7 +7,6 @@ import { enableAuth } from '@/const/auth';
|
|
7
7
|
import { INBOX_GUIDE_SYSTEMROLE } from '@/const/guide';
|
8
8
|
import { INBOX_SESSION_ID } from '@/const/session';
|
9
9
|
import { DEFAULT_AGENT_CONFIG } from '@/const/settings';
|
10
|
-
import { TracePayload, TraceTagMap } from '@/const/trace';
|
11
10
|
import { isDeprecatedEdition, isDesktop, isServerMode } from '@/const/version';
|
12
11
|
import {
|
13
12
|
AgentRuntimeError,
|
@@ -1,12 +1,12 @@
|
|
1
1
|
/* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
|
2
2
|
// Disable the auto sort key eslint rule to make the code more logic and readable
|
3
|
+
import { TraceEventType, TraceNameMap } from '@lobechat/types';
|
3
4
|
import { t } from 'i18next';
|
4
5
|
import { produce } from 'immer';
|
5
6
|
import { template } from 'lodash-es';
|
6
7
|
import { StateCreator } from 'zustand/vanilla';
|
7
8
|
|
8
9
|
import { LOADING_FLAT, MESSAGE_CANCEL_FLAT } from '@/const/message';
|
9
|
-
import { TraceEventType, TraceNameMap } from '@/const/trace';
|
10
10
|
import { isDesktop, isServerMode } from '@/const/version';
|
11
11
|
import { knowledgeBaseQAPrompts } from '@/prompts/knowledgeBaseQA';
|
12
12
|
import { chatService } from '@/services/chat';
|
@@ -1,7 +1,7 @@
|
|
1
|
+
import { TraceNameMap } from '@lobechat/types';
|
1
2
|
import { StateCreator } from 'zustand/vanilla';
|
2
3
|
|
3
4
|
import { chainSummaryHistory } from '@/chains/summaryHistory';
|
4
|
-
import { TraceNameMap } from '@/const/trace';
|
5
5
|
import { chatService } from '@/services/chat';
|
6
6
|
import { topicService } from '@/services/topic';
|
7
7
|
import { ChatStore } from '@/store/chat';
|
@@ -1,9 +1,9 @@
|
|
1
|
+
import { TraceEventType } from '@lobechat/types';
|
1
2
|
import * as lobeUIModules from '@lobehub/ui';
|
2
3
|
import { act, renderHook, waitFor } from '@testing-library/react';
|
3
4
|
import { mutate } from 'swr';
|
4
5
|
import { Mock, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
5
6
|
|
6
|
-
import { TraceEventType } from '@/const/trace';
|
7
7
|
import { messageService } from '@/services/message';
|
8
8
|
import { topicService } from '@/services/topic';
|
9
9
|
import { messageMapKey } from '@/store/chat/utils/messageMapKey';
|
@@ -1,12 +1,11 @@
|
|
1
1
|
/* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
|
2
2
|
// Disable the auto sort key eslint rule to make the code more logic and readable
|
3
|
-
import { ChatErrorType } from '@lobechat/types
|
3
|
+
import { ChatErrorType, TraceEventType } from '@lobechat/types';
|
4
4
|
import { copyToClipboard } from '@lobehub/ui';
|
5
5
|
import isEqual from 'fast-deep-equal';
|
6
6
|
import { SWRResponse, mutate } from 'swr';
|
7
7
|
import { StateCreator } from 'zustand/vanilla';
|
8
8
|
|
9
|
-
import { TraceEventType } from '@/const/trace';
|
10
9
|
import { useClientDataSWR } from '@/libs/swr';
|
11
10
|
import { messageService } from '@/services/message';
|
12
11
|
import { topicService } from '@/services/topic';
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
|
2
|
-
import { ChatErrorType } from '@lobechat/types
|
2
|
+
import { ChatErrorType } from '@lobechat/types';
|
3
3
|
import { PluginErrorType } from '@lobehub/chat-plugin-sdk';
|
4
4
|
import isEqual from 'fast-deep-equal';
|
5
5
|
import { t } from 'i18next';
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
|
2
2
|
// Note: To make the code more logic and readable, we just disable the auto sort key eslint rule
|
3
3
|
// DON'T REMOVE THE FIRST LINE
|
4
|
+
import { TraceNameMap } from '@lobechat/types';
|
4
5
|
import isEqual from 'fast-deep-equal';
|
5
6
|
import { t } from 'i18next';
|
6
7
|
import useSWR, { SWRResponse, mutate } from 'swr';
|
@@ -9,7 +10,6 @@ import { StateCreator } from 'zustand/vanilla';
|
|
9
10
|
import { chainSummaryTitle } from '@/chains/summaryTitle';
|
10
11
|
import { message } from '@/components/AntdStaticMethods';
|
11
12
|
import { LOADING_FLAT } from '@/const/message';
|
12
|
-
import { TraceNameMap } from '@/const/trace';
|
13
13
|
import { useClientDataSWR } from '@/libs/swr';
|
14
14
|
import { chatService } from '@/services/chat';
|
15
15
|
import { messageService } from '@/services/message';
|
@@ -1,9 +1,9 @@
|
|
1
|
+
import { TraceNameMap, TracePayload } from '@lobechat/types';
|
1
2
|
import { produce } from 'immer';
|
2
3
|
import { StateCreator } from 'zustand/vanilla';
|
3
4
|
|
4
5
|
import { chainLangDetect } from '@/chains/langDetect';
|
5
6
|
import { chainTranslate } from '@/chains/translate';
|
6
|
-
import { TraceNameMap, TracePayload } from '@/const/trace';
|
7
7
|
import { supportLocales } from '@/locales/resources';
|
8
8
|
import { chatService } from '@/services/chat';
|
9
9
|
import { messageService } from '@/services/message';
|
@@ -11,12 +11,17 @@ interface GlobalStoreProviderProps {
|
|
11
11
|
children: ReactNode;
|
12
12
|
featureFlags?: Partial<IFeatureFlags>;
|
13
13
|
isMobile?: boolean;
|
14
|
+
segmentVariants?: string;
|
14
15
|
serverConfig?: GlobalServerConfig;
|
15
16
|
}
|
16
17
|
|
17
18
|
export const ServerConfigStoreProvider = memo<GlobalStoreProviderProps>(
|
18
|
-
({ children, featureFlags, serverConfig, isMobile }) => (
|
19
|
-
<Provider
|
19
|
+
({ children, featureFlags, serverConfig, isMobile, segmentVariants }) => (
|
20
|
+
<Provider
|
21
|
+
createStore={() =>
|
22
|
+
createServerConfigStore({ featureFlags, isMobile, segmentVariants, serverConfig })
|
23
|
+
}
|
24
|
+
>
|
20
25
|
{children}
|
21
26
|
</Provider>
|
22
27
|
),
|
@@ -15,11 +15,13 @@ import { ServerConfigAction, createServerConfigSlice } from './action';
|
|
15
15
|
interface ServerConfigState {
|
16
16
|
featureFlags: IFeatureFlags;
|
17
17
|
isMobile?: boolean;
|
18
|
+
segmentVariants?: string;
|
18
19
|
serverConfig: GlobalServerConfig;
|
19
20
|
}
|
20
21
|
|
21
22
|
const initialState: ServerConfigState = {
|
22
23
|
featureFlags: DEFAULT_FEATURE_FLAGS,
|
24
|
+
segmentVariants: '',
|
23
25
|
serverConfig: { aiProvider: {}, telemetry: {} },
|
24
26
|
};
|
25
27
|
|
File without changes
|