@lobehub/chat 1.112.2 → 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 (70) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/changelog/v1.json +18 -0
  3. package/package.json +2 -1
  4. package/packages/const/package.json +6 -0
  5. package/{src/const → packages/const/src}/imageGeneration.ts +2 -4
  6. package/{src/const → packages/const/src}/url.ts +2 -3
  7. package/packages/prompts/package.json +9 -0
  8. package/{src/prompts → packages/prompts/src}/chatMessages/index.test.ts +1 -2
  9. package/{src/prompts → packages/prompts/src}/chatMessages/index.ts +1 -1
  10. package/{src/prompts → packages/prompts/src}/files/file.ts +1 -1
  11. package/{src/prompts → packages/prompts/src}/files/image.ts +1 -1
  12. package/{src/prompts → packages/prompts/src}/files/index.ts +1 -1
  13. package/packages/prompts/src/index.ts +5 -0
  14. package/{src/prompts → packages/prompts/src}/knowledgeBaseQA/chunk.ts +1 -1
  15. package/{src/prompts → packages/prompts/src}/knowledgeBaseQA/index.ts +5 -5
  16. package/{src/prompts → packages/prompts/src}/knowledgeBaseQA/knowledge.ts +1 -1
  17. package/{src/prompts → packages/prompts/src}/plugin/index.test.ts +1 -2
  18. package/packages/types/src/index.ts +3 -0
  19. package/packages/types/src/message/index.ts +1 -1
  20. package/src/chains/summaryHistory.ts +3 -2
  21. package/src/middleware.ts +1 -1
  22. package/src/services/chat.ts +1 -2
  23. package/src/store/chat/slices/aiChat/actions/generateAIChat.ts +1 -1
  24. package/src/store/tool/selectors/tool.ts +1 -1
  25. package/tsconfig.json +1 -0
  26. package/vitest.config.server.ts +1 -0
  27. package/vitest.config.ts +1 -0
  28. /package/{src/const → packages/const/src}/analytics.ts +0 -0
  29. /package/{src/const → packages/const/src}/auth.ts +0 -0
  30. /package/{src/const → packages/const/src}/branding.ts +0 -0
  31. /package/{src/const → packages/const/src}/cacheControl.ts +0 -0
  32. /package/{src/const → packages/const/src}/currency.ts +0 -0
  33. /package/{src/const → packages/const/src}/desktop.ts +0 -0
  34. /package/{src/const → packages/const/src}/discover.ts +0 -0
  35. /package/{src/const → packages/const/src}/fetch.ts +0 -0
  36. /package/{src/const → packages/const/src}/file.ts +0 -0
  37. /package/{src/const → packages/const/src}/guide.ts +0 -0
  38. /package/{src/const → packages/const/src}/hotkeys.ts +0 -0
  39. /package/{src/const → packages/const/src}/image.ts +0 -0
  40. /package/{src/const → packages/const/src}/layoutTokens.test.ts +0 -0
  41. /package/{src/const → packages/const/src}/layoutTokens.ts +0 -0
  42. /package/{src/const → packages/const/src}/locale.ts +0 -0
  43. /package/{src/const → packages/const/src}/message.ts +0 -0
  44. /package/{src/const → packages/const/src}/meta.ts +0 -0
  45. /package/{src/const → packages/const/src}/models.ts +0 -0
  46. /package/{src/const → packages/const/src}/plugin.test.ts +0 -0
  47. /package/{src/const → packages/const/src}/plugin.ts +0 -0
  48. /package/{src/const → packages/const/src}/session.ts +0 -0
  49. /package/{src/const → packages/const/src}/settings/agent.ts +0 -0
  50. /package/{src/const → packages/const/src}/settings/common.ts +0 -0
  51. /package/{src/const → packages/const/src}/settings/hotkey.ts +0 -0
  52. /package/{src/const → packages/const/src}/settings/index.ts +0 -0
  53. /package/{src/const → packages/const/src}/settings/knowledge.ts +0 -0
  54. /package/{src/const → packages/const/src}/settings/llm.ts +0 -0
  55. /package/{src/const → packages/const/src}/settings/sync.ts +0 -0
  56. /package/{src/const → packages/const/src}/settings/systemAgent.ts +0 -0
  57. /package/{src/const → packages/const/src}/settings/tool.ts +0 -0
  58. /package/{src/const → packages/const/src}/settings/tts.ts +0 -0
  59. /package/{src/const → packages/const/src}/theme.ts +0 -0
  60. /package/{src/const → packages/const/src}/trace.ts +0 -0
  61. /package/{src/const → packages/const/src}/user.ts +0 -0
  62. /package/{src/const → packages/const/src}/version.ts +0 -0
  63. /package/{src/prompts → packages/prompts/src}/files/index.test.ts +0 -0
  64. /package/{src/prompts → packages/prompts/src}/knowledgeBaseQA/__snapshots__/index.test.ts.snap +0 -0
  65. /package/{src/prompts → packages/prompts/src}/knowledgeBaseQA/index.test.ts +0 -0
  66. /package/{src/prompts → packages/prompts/src}/knowledgeBaseQA/userQuery.ts +0 -0
  67. /package/{src/prompts → packages/prompts/src}/plugin/index.ts +0 -0
  68. /package/{src/prompts → packages/prompts/src}/plugin/tools.test.ts +0 -0
  69. /package/{src/prompts → packages/prompts/src}/plugin/tools.ts +0 -0
  70. /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.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
+
30
+ ### [Version 1.112.3](https://github.com/lobehub/lobe-chat/compare/v1.112.2...v1.112.3)
31
+
32
+ <sup>Released on **2025-08-16**</sup>
33
+
34
+ #### ♻ Code Refactoring
35
+
36
+ - **misc**: Refactor const folder to a new package.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### Code refactoring
44
+
45
+ - **misc**: Refactor const folder to a new package, closes [#8756](https://github.com/lobehub/lobe-chat/issues/8756) ([30a4734](https://github.com/lobehub/lobe-chat/commit/30a4734))
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.2](https://github.com/lobehub/lobe-chat/compare/v1.112.1...v1.112.2)
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
+ "improvements": [
5
+ "Refactor prompts folder to the @lobechat/prompts pacakge."
6
+ ]
7
+ },
8
+ "date": "2025-08-16",
9
+ "version": "1.112.4"
10
+ },
11
+ {
12
+ "children": {
13
+ "improvements": [
14
+ "Refactor const folder to a new package."
15
+ ]
16
+ },
17
+ "date": "2025-08-16",
18
+ "version": "1.112.3"
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.2",
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,6 @@
1
+ {
2
+ "name": "@lobechat/const",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "main": "./src/index.ts"
6
+ }
@@ -2,17 +2,15 @@
2
2
  * Image generation and processing configuration constants
3
3
  */
4
4
  export const IMAGE_GENERATION_CONFIG = {
5
-
6
5
  /**
7
6
  * Maximum cover image size in pixels (longest edge)
8
7
  * Used for generating cover images from source images
9
8
  */
10
- COVER_MAX_SIZE: 256,
9
+ COVER_MAX_SIZE: 256,
11
10
 
12
-
13
11
  /**
14
12
  * Maximum thumbnail size in pixels (longest edge)
15
13
  * Used for generating thumbnail images from original images
16
14
  */
17
- THUMBNAIL_MAX_SIZE: 512,
15
+ THUMBNAIL_MAX_SIZE: 512,
18
16
  } as const;
@@ -4,7 +4,6 @@ import urlJoin from 'url-join';
4
4
  import { withBasePath } from '@/utils/basePath';
5
5
  import { isDev } from '@/utils/env';
6
6
 
7
- import pkg from '../../package.json';
8
7
  import { INBOX_SESSION_ID } from './session';
9
8
 
10
9
  export const UTM_SOURCE = 'chat_preview';
@@ -15,7 +14,7 @@ export const OFFICIAL_SITE = 'https://lobehub.com';
15
14
 
16
15
  export const OG_URL = '/og/cover.png?v=1';
17
16
 
18
- export const GITHUB = pkg.homepage;
17
+ export const GITHUB = 'https://github.com/lobehub/lobe-chat';
19
18
  export const GITHUB_ISSUES = urlJoin(GITHUB, 'issues/new/choose');
20
19
  export const CHANGELOG = 'https://lobehub.com/changelog';
21
20
  export const DOCKER_IMAGE = 'https://hub.docker.com/r/lobehub/lobe-chat';
@@ -36,7 +35,7 @@ export const MANUAL_UPGRADE_URL = urlJoin(SELF_HOSTING_DOCUMENTS, '/advanced/ups
36
35
  export const BLOG = urlJoin(OFFICIAL_SITE, 'blog');
37
36
 
38
37
  export const ABOUT = OFFICIAL_SITE;
39
- export const FEEDBACK = pkg.bugs.url;
38
+ export const FEEDBACK = 'https://github.com/lobehub/lobe-chat/issues/new/choose';
40
39
  export const PRIVACY_URL = urlJoin(OFFICIAL_SITE, '/privacy');
41
40
  export const TERMS_URL = urlJoin(OFFICIAL_SITE, '/terms');
42
41
 
@@ -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> => ({
package/src/middleware.ts CHANGED
@@ -5,6 +5,7 @@ import { UAParser } from 'ua-parser-js';
5
5
  import urlJoin from 'url-join';
6
6
 
7
7
  import { authEnv } from '@/config/auth';
8
+ import { OAUTH_AUTHORIZED } from '@/const/auth';
8
9
  import { LOBE_LOCALE_COOKIE } from '@/const/locale';
9
10
  import { LOBE_THEME_APPEARANCE } from '@/const/theme';
10
11
  import { appEnv } from '@/envs/app';
@@ -14,7 +15,6 @@ import { parseBrowserLanguage } from '@/utils/locale';
14
15
  import { parseDefaultThemeFromCountry } from '@/utils/server/geo';
15
16
  import { RouteVariants } from '@/utils/server/routeVariants';
16
17
 
17
- import { OAUTH_AUTHORIZED } from './const/auth';
18
18
  import { oidcEnv } from './envs/oidc';
19
19
 
20
20
  // Create debug logger instances
@@ -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';
package/tsconfig.json CHANGED
@@ -20,6 +20,7 @@
20
20
  "paths": {
21
21
  "@/libs/model-runtime": ["./packages/model-runtime/src/index.ts"],
22
22
  "@/libs/model-runtime/*": ["./packages/model-runtime/src/*"],
23
+ "@/const/*": ["./packages/const/src/*"],
23
24
  "@/types/*": ["./packages/types/src/*", "./src/types/*"],
24
25
  "@/*": ["./src/*"],
25
26
  "~test-utils": ["./tests/utils.tsx"]
@@ -5,6 +5,7 @@ export default defineConfig({
5
5
  test: {
6
6
  alias: {
7
7
  /* eslint-disable sort-keys-fix/sort-keys-fix */
8
+ '@/const': resolve(__dirname, './packages/const/src'),
8
9
  '@/types': resolve(__dirname, './packages/types/src'),
9
10
  '@': resolve(__dirname, './src'),
10
11
  /* eslint-enable */
package/vitest.config.ts CHANGED
@@ -11,6 +11,7 @@ export default defineConfig({
11
11
  /* eslint-disable sort-keys-fix/sort-keys-fix */
12
12
  '@/libs/model-runtime': resolve(__dirname, './packages/model-runtime/src'),
13
13
  '@/types': resolve(__dirname, './packages/types/src'),
14
+ '@/const': resolve(__dirname, './packages/const/src'),
14
15
  '@': resolve(__dirname, './src'),
15
16
  '~test-utils': resolve(__dirname, './tests/utils.tsx'),
16
17
  /* eslint-enable */
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes