@lobehub/chat 1.112.3 → 1.112.5

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 (33) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/changelog/v1.json +18 -0
  3. package/package.json +2 -1
  4. package/packages/prompts/package.json +9 -0
  5. package/{src/prompts → packages/prompts/src}/chatMessages/index.test.ts +1 -2
  6. package/{src/prompts → packages/prompts/src}/chatMessages/index.ts +1 -1
  7. package/{src/prompts → packages/prompts/src}/files/file.ts +1 -1
  8. package/{src/prompts → packages/prompts/src}/files/image.ts +1 -1
  9. package/{src/prompts → packages/prompts/src}/files/index.ts +1 -1
  10. package/packages/prompts/src/index.ts +5 -0
  11. package/{src/prompts → packages/prompts/src}/knowledgeBaseQA/chunk.ts +1 -1
  12. package/{src/prompts → packages/prompts/src}/knowledgeBaseQA/index.ts +5 -5
  13. package/{src/prompts → packages/prompts/src}/knowledgeBaseQA/knowledge.ts +1 -1
  14. package/{src/prompts → packages/prompts/src}/plugin/index.test.ts +1 -2
  15. package/packages/types/src/index.ts +3 -0
  16. package/packages/types/src/message/index.ts +1 -1
  17. package/src/app/[variants]/(main)/chat/(workspace)/features/TelemetryNotification.tsx +1 -4
  18. package/src/app/[variants]/(main)/settings/about/index.tsx +1 -4
  19. package/src/chains/summaryHistory.ts +3 -2
  20. package/src/server/routers/lambda/market/index.ts +0 -3
  21. package/src/services/chat.ts +1 -2
  22. package/src/services/discover.ts +6 -0
  23. package/src/services/mcp.ts +0 -2
  24. package/src/store/chat/slices/aiChat/actions/generateAIChat.ts +1 -1
  25. package/src/store/tool/selectors/tool.ts +1 -1
  26. /package/{src/prompts → packages/prompts/src}/files/index.test.ts +0 -0
  27. /package/{src/prompts → packages/prompts/src}/knowledgeBaseQA/__snapshots__/index.test.ts.snap +0 -0
  28. /package/{src/prompts → packages/prompts/src}/knowledgeBaseQA/index.test.ts +0 -0
  29. /package/{src/prompts → packages/prompts/src}/knowledgeBaseQA/userQuery.ts +0 -0
  30. /package/{src/prompts → packages/prompts/src}/plugin/index.ts +0 -0
  31. /package/{src/prompts → packages/prompts/src}/plugin/tools.test.ts +0 -0
  32. /package/{src/prompts → packages/prompts/src}/plugin/tools.ts +0 -0
  33. /package/{src/prompts → packages/prompts/src}/systemRole/index.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.112.5](https://github.com/lobehub/lobe-chat/compare/v1.112.4...v1.112.5)
6
+
7
+ <sup>Released on **2025-08-17**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Improve mcp tracing with user config.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Improve mcp tracing with user config, closes [#8827](https://github.com/lobehub/lobe-chat/issues/8827) ([5cab2ee](https://github.com/lobehub/lobe-chat/commit/5cab2ee))
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.112.4](https://github.com/lobehub/lobe-chat/compare/v1.112.3...v1.112.4)
31
+
32
+ <sup>Released on **2025-08-16**</sup>
33
+
34
+ #### ♻ Code Refactoring
35
+
36
+ - **misc**: Refactor prompts folder to the `@lobechat/prompts` pacakge.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### Code refactoring
44
+
45
+ - **misc**: Refactor prompts folder to the `@lobechat/prompts` pacakge, closes [#8810](https://github.com/lobehub/lobe-chat/issues/8810) ([d82e7bb](https://github.com/lobehub/lobe-chat/commit/d82e7bb))
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.112.3](https://github.com/lobehub/lobe-chat/compare/v1.112.2...v1.112.3)
6
56
 
7
57
  <sup>Released on **2025-08-16**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,22 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "fixes": [
5
+ "Improve mcp tracing with user config."
6
+ ]
7
+ },
8
+ "date": "2025-08-17",
9
+ "version": "1.112.5"
10
+ },
11
+ {
12
+ "children": {
13
+ "improvements": [
14
+ "Refactor prompts folder to the @lobechat/prompts pacakge."
15
+ ]
16
+ },
17
+ "date": "2025-08-16",
18
+ "version": "1.112.4"
19
+ },
2
20
  {
3
21
  "children": {
4
22
  "improvements": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.112.3",
3
+ "version": "1.112.5",
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",
@@ -145,6 +145,7 @@
145
145
  "@lobechat/electron-server-ipc": "workspace:*",
146
146
  "@lobechat/file-loaders": "workspace:*",
147
147
  "@lobechat/model-runtime": "workspace:*",
148
+ "@lobechat/prompts": "workspace:*",
148
149
  "@lobechat/web-crawler": "workspace:*",
149
150
  "@lobehub/analytics": "^1.6.0",
150
151
  "@lobehub/charts": "^2.0.0",
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@lobechat/prompts",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "main": "./src/index.ts",
6
+ "dependencies": {
7
+ "@lobechat/types": "workspace:*"
8
+ }
9
+ }
@@ -1,7 +1,6 @@
1
+ import { ChatMessage } from '@lobechat/types';
1
2
  import { describe, expect, it } from 'vitest';
2
3
 
3
- import { ChatMessage } from '@/types/message';
4
-
5
4
  import { chatHistoryPrompts } from './index';
6
5
 
7
6
  describe('chatHistoryPrompts', () => {
@@ -1,4 +1,4 @@
1
- import { ChatMessage } from '@/types/message';
1
+ import { ChatMessage } from '@lobechat/types';
2
2
 
3
3
  const chatMessage = (message: ChatMessage) => {
4
4
  return `<${message.role}>${message.content}</${message.role}>`;
@@ -1,4 +1,4 @@
1
- import { ChatFileItem } from '@/types/message';
1
+ import { ChatFileItem } from '@lobechat/types';
2
2
 
3
3
  const filePrompt = (item: ChatFileItem, addUrl: boolean) => {
4
4
  const content = item.content || '';
@@ -1,4 +1,4 @@
1
- import { ChatImageItem } from '@/types/message';
1
+ import { ChatImageItem } from '@lobechat/types';
2
2
 
3
3
  const imagePrompt = (item: ChatImageItem, attachUrl: boolean) =>
4
4
  attachUrl
@@ -1,4 +1,4 @@
1
- import { ChatFileItem, ChatImageItem } from '@/types/message';
1
+ import { ChatFileItem, ChatImageItem } from '@lobechat/types';
2
2
 
3
3
  import { filePrompts } from './file';
4
4
  import { imagesPrompts } from './image';
@@ -0,0 +1,5 @@
1
+ export * from './chatMessages';
2
+ export * from './files';
3
+ export * from './knowledgeBaseQA';
4
+ export * from './plugin';
5
+ export * from './systemRole';
@@ -1,4 +1,4 @@
1
- import { ChatSemanticSearchChunk } from '@/types/chunk';
1
+ import { ChatSemanticSearchChunk } from '@lobechat/types';
2
2
 
3
3
  const chunkPrompt = (item: ChatSemanticSearchChunk) =>
4
4
  `<chunk fileId="${item.fileId}" fileName="${item.fileName}" similarity="${item.similarity}" ${item.pageNumber ? ` pageNumber="${item.pageNumber}" ` : ''}>${item.text}</chunk>`;
@@ -1,8 +1,8 @@
1
- import { chunkPrompts } from '@/prompts/knowledgeBaseQA/chunk';
2
- import { knowledgePrompts } from '@/prompts/knowledgeBaseQA/knowledge';
3
- import { userQueryPrompt } from '@/prompts/knowledgeBaseQA/userQuery';
4
- import { ChatSemanticSearchChunk } from '@/types/chunk';
5
- import { KnowledgeItem } from '@/types/knowledgeBase';
1
+ import { ChatSemanticSearchChunk, KnowledgeItem } from '@lobechat/types';
2
+
3
+ import { chunkPrompts } from './chunk';
4
+ import { knowledgePrompts } from './knowledge';
5
+ import { userQueryPrompt } from './userQuery';
6
6
 
7
7
  export const knowledgeBaseQAPrompts = ({
8
8
  chunks,
@@ -1,4 +1,4 @@
1
- import { KnowledgeItem } from '@/types/knowledgeBase';
1
+ import { KnowledgeItem } from '@lobechat/types';
2
2
 
3
3
  const knowledgePrompt = (item: KnowledgeItem) =>
4
4
  `<knowledge id="${item.id}" name="${item.name}" type="${item.type}"${item.fileType ? ` fileType="${item.fileType}" ` : ''}>${item.description || ''}</knowledge>`;
@@ -1,6 +1,5 @@
1
- import { Tool } from '@/prompts/plugin/tools';
2
-
3
1
  import { pluginPrompts } from './index';
2
+ import { Tool } from './tools';
4
3
 
5
4
  describe('pluginPrompts', () => {
6
5
  it('should generate plugin prompts with tools', () => {
@@ -1,3 +1,6 @@
1
1
  export * from './artifact';
2
+ export * from './chunk';
2
3
  export * from './fetch';
4
+ export * from './knowledgeBase';
5
+ export * from './message';
3
6
  export * from './trace';
@@ -1,4 +1,4 @@
1
- import { UploadFileItem } from '@/types/files';
1
+ import { UploadFileItem } from '../files';
2
2
 
3
3
  export * from './base';
4
4
  export * from './chat';
@@ -11,8 +11,6 @@ import { Flexbox } from 'react-layout-kit';
11
11
  import Notification from '@/components/Notification';
12
12
  import { BRANDING_NAME } from '@/const/branding';
13
13
  import { PRIVACY_URL } from '@/const/url';
14
- import { useServerConfigStore } from '@/store/serverConfig';
15
- import { serverConfigSelectors } from '@/store/serverConfig/selectors';
16
14
  import { useUserStore } from '@/store/user';
17
15
  import { preferenceSelectors } from '@/store/user/selectors';
18
16
 
@@ -30,7 +28,6 @@ const TelemetryNotification = memo<{ mobile?: boolean }>(({ mobile }) => {
30
28
  const { styles, theme } = useStyles();
31
29
 
32
30
  const { t } = useTranslation('common');
33
- const shouldCheck = useServerConfigStore(serverConfigSelectors.enabledTelemetryChat);
34
31
  const isPreferenceInit = useUserStore(preferenceSelectors.isPreferenceInit);
35
32
 
36
33
  const [useCheckTrace, updatePreference] = useUserStore((s) => [
@@ -38,7 +35,7 @@ const TelemetryNotification = memo<{ mobile?: boolean }>(({ mobile }) => {
38
35
  s.updatePreference,
39
36
  ]);
40
37
 
41
- const { data: showModal, mutate } = useCheckTrace(shouldCheck && isPreferenceInit);
38
+ const { data: showModal, mutate } = useCheckTrace(isPreferenceInit);
42
39
 
43
40
  const updateTelemetry = (telemetry: boolean) => {
44
41
  updatePreference({ telemetry });
@@ -10,8 +10,6 @@ import { Flexbox } from 'react-layout-kit';
10
10
 
11
11
  import { BRANDING_EMAIL, BRANDING_NAME, SOCIAL_URL } from '@/const/branding';
12
12
  import { BLOG, OFFICIAL_SITE, PRIVACY_URL, TERMS_URL, mailTo } from '@/const/url';
13
- import { useServerConfigStore } from '@/store/serverConfig';
14
- import { serverConfigSelectors } from '@/store/serverConfig/selectors';
15
13
 
16
14
  import AboutList from './features/AboutList';
17
15
  import Analytics from './features/Analytics';
@@ -30,7 +28,6 @@ const useStyles = createStyles(({ css, token }) => ({
30
28
  const Page = memo<{ mobile?: boolean }>(({ mobile }) => {
31
29
  const { t } = useTranslation('common');
32
30
  const { styles } = useStyles();
33
- const enabledTelemetryChat = useServerConfigStore(serverConfigSelectors.enabledTelemetryChat);
34
31
 
35
32
  return (
36
33
  <>
@@ -122,7 +119,7 @@ const Page = memo<{ mobile?: boolean }>(({ mobile }) => {
122
119
  />
123
120
  </Flexbox>
124
121
  </Form.Group>
125
- {enabledTelemetryChat && <Analytics />}
122
+ <Analytics />
126
123
  </>
127
124
  );
128
125
  });
@@ -1,5 +1,6 @@
1
- import { chatHistoryPrompts } from '@/prompts/chatMessages';
2
- import { ChatMessage } from '@/types/message';
1
+ import { chatHistoryPrompts } from '@lobechat/prompts';
2
+ import { ChatMessage } from '@lobechat/types';
3
+
3
4
  import { ChatStreamPayload } from '@/types/openai/chat';
4
5
 
5
6
  export const chainSummaryHistory = (messages: ChatMessage[]): Partial<ChatStreamPayload> => ({
@@ -540,17 +540,14 @@ export const marketRouter = router({
540
540
  z.object({
541
541
  callDurationMs: z.number(),
542
542
  clientId: z.string().optional(),
543
- clientIp: z.string().optional(),
544
543
  customPluginInfo: z.any().optional(),
545
544
  errorCode: z.string().optional(),
546
545
  errorMessage: z.string().optional(),
547
546
  identifier: z.string(),
548
- inputParams: z.any().optional(),
549
547
  isCustomPlugin: z.boolean().optional(),
550
548
  metadata: z.record(z.any()).optional(),
551
549
  methodName: z.string(),
552
550
  methodType: z.enum(['tool', 'prompt', 'resource']),
553
- outputResult: z.any().optional(),
554
551
  platform: z.string().optional(),
555
552
  requestSizeBytes: z.number().optional(),
556
553
  responseSizeBytes: z.number().optional(),
@@ -4,6 +4,7 @@ import {
4
4
  ModelProvider,
5
5
  ModelRuntime,
6
6
  } from '@lobechat/model-runtime';
7
+ import { BuiltinSystemRolePrompts, filesPrompts } from '@lobechat/prompts';
7
8
  import { ChatErrorType, TracePayload, TraceTagMap } from '@lobechat/types';
8
9
  import { PluginRequestPayload, createHeadersWithPluginSettings } from '@lobehub/chat-plugin-sdk';
9
10
  import { produce } from 'immer';
@@ -15,8 +16,6 @@ import { INBOX_SESSION_ID } from '@/const/session';
15
16
  import { DEFAULT_AGENT_CONFIG } from '@/const/settings';
16
17
  import { isDeprecatedEdition, isDesktop, isServerMode } from '@/const/version';
17
18
  import { parseDataUri } from '@/libs/model-runtime/utils/uriParser';
18
- import { filesPrompts } from '@/prompts/files';
19
- import { BuiltinSystemRolePrompts } from '@/prompts/systemRole';
20
19
  import { getAgentStoreState } from '@/store/agent';
21
20
  import { agentChatConfigSelectors } from '@/store/agent/selectors';
22
21
  import { aiModelSelectors, aiProviderSelectors, getAiInfraStoreState } from '@/store/aiInfra';
@@ -3,6 +3,8 @@ import { CallReportRequest, InstallReportRequest } from '@lobehub/market-types';
3
3
 
4
4
  import { lambdaClient } from '@/libs/trpc/client';
5
5
  import { globalHelpers } from '@/store/global/helpers';
6
+ import { useUserStore } from '@/store/user';
7
+ import { preferenceSelectors } from '@/store/user/selectors';
6
8
  import {
7
9
  AssistantListResponse,
8
10
  AssistantQueryParams,
@@ -162,6 +164,10 @@ class DiscoverService {
162
164
  * 上报插件调用结果
163
165
  */
164
166
  reportPluginCall = async (reportData: CallReportRequest) => {
167
+ const allow = useUserStore(preferenceSelectors.userAllowTrace);
168
+
169
+ if (!allow) return;
170
+
165
171
  await this.injectMPToken();
166
172
 
167
173
  lambdaClient.market.reportCall.mutate(cleanObject(reportData)).catch((reportError) => {
@@ -103,7 +103,6 @@ class MCPService {
103
103
  errorCode,
104
104
  errorMessage,
105
105
  identifier,
106
- inputParams,
107
106
  isCustomPlugin,
108
107
  metadata: {
109
108
  appVersion: CURRENT_VERSION,
@@ -112,7 +111,6 @@ class MCPService {
112
111
  },
113
112
  methodName: apiName,
114
113
  methodType: 'tool' as const,
115
- outputResult: success ? result : undefined,
116
114
  requestSizeBytes,
117
115
  responseSizeBytes,
118
116
  sessionId: topicId,
@@ -1,5 +1,6 @@
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 { knowledgeBaseQAPrompts } from '@lobechat/prompts';
3
4
  import { TraceEventType, TraceNameMap } from '@lobechat/types';
4
5
  import { t } from 'i18next';
5
6
  import { produce } from 'immer';
@@ -8,7 +9,6 @@ import { StateCreator } from 'zustand/vanilla';
8
9
 
9
10
  import { LOADING_FLAT, MESSAGE_CANCEL_FLAT } from '@/const/message';
10
11
  import { isDesktop, isServerMode } from '@/const/version';
11
- import { knowledgeBaseQAPrompts } from '@/prompts/knowledgeBaseQA';
12
12
  import { chatService } from '@/services/chat';
13
13
  import { messageService } from '@/services/message';
14
14
  import { useAgentStore } from '@/store/agent';
@@ -1,6 +1,6 @@
1
+ import { pluginPrompts } from '@lobechat/prompts';
1
2
  import { LobeChatPluginManifest } from '@lobehub/chat-plugin-sdk';
2
3
 
3
- import { pluginPrompts } from '@/prompts/plugin';
4
4
  import { MetaData } from '@/types/meta';
5
5
  import { ChatCompletionTool } from '@/types/openai/chat';
6
6
  import { LobeToolMeta } from '@/types/tool/tool';