@lobehub/chat 1.112.3 → 1.112.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.
Files changed (28) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/changelog/v1.json +9 -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/chains/summaryHistory.ts +3 -2
  18. package/src/services/chat.ts +1 -2
  19. package/src/store/chat/slices/aiChat/actions/generateAIChat.ts +1 -1
  20. package/src/store/tool/selectors/tool.ts +1 -1
  21. /package/{src/prompts → packages/prompts/src}/files/index.test.ts +0 -0
  22. /package/{src/prompts → packages/prompts/src}/knowledgeBaseQA/__snapshots__/index.test.ts.snap +0 -0
  23. /package/{src/prompts → packages/prompts/src}/knowledgeBaseQA/index.test.ts +0 -0
  24. /package/{src/prompts → packages/prompts/src}/knowledgeBaseQA/userQuery.ts +0 -0
  25. /package/{src/prompts → packages/prompts/src}/plugin/index.ts +0 -0
  26. /package/{src/prompts → packages/prompts/src}/plugin/tools.test.ts +0 -0
  27. /package/{src/prompts → packages/prompts/src}/plugin/tools.ts +0 -0
  28. /package/{src/prompts → packages/prompts/src}/systemRole/index.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.112.4](https://github.com/lobehub/lobe-chat/compare/v1.112.3...v1.112.4)
6
+
7
+ <sup>Released on **2025-08-16**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: Refactor prompts folder to the `@lobechat/prompts` pacakge.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **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))
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.112.3](https://github.com/lobehub/lobe-chat/compare/v1.112.2...v1.112.3)
6
31
 
7
32
  <sup>Released on **2025-08-16**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,13 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "improvements": [
5
+ "Refactor prompts folder to the @lobechat/prompts pacakge."
6
+ ]
7
+ },
8
+ "date": "2025-08-16",
9
+ "version": "1.112.4"
10
+ },
2
11
  {
3
12
  "children": {
4
13
  "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.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",
@@ -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';
@@ -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> => ({
@@ -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';
@@ -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';