@lobehub/chat 1.124.1 → 1.124.3

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 (119) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/changelog/v1.json +18 -0
  3. package/package.json +1 -1
  4. package/packages/const/package.json +3 -1
  5. package/packages/const/src/analytics.ts +1 -1
  6. package/packages/const/src/desktop.ts +3 -2
  7. package/packages/const/src/discover.ts +3 -2
  8. package/packages/const/src/guide.ts +2 -2
  9. package/packages/const/src/hotkeys.ts +1 -1
  10. package/packages/const/src/index.ts +2 -0
  11. package/packages/const/src/settings/common.ts +1 -1
  12. package/packages/const/src/settings/genUserLLMConfig.test.ts +1 -2
  13. package/packages/const/src/settings/genUserLLMConfig.ts +1 -2
  14. package/packages/const/src/settings/hotkey.ts +3 -2
  15. package/packages/const/src/settings/index.ts +1 -3
  16. package/packages/const/src/settings/knowledge.ts +1 -1
  17. package/packages/const/src/settings/llm.ts +2 -4
  18. package/packages/const/src/settings/systemAgent.ts +1 -5
  19. package/packages/const/src/settings/tts.ts +1 -1
  20. package/packages/const/src/trace.ts +1 -1
  21. package/packages/const/src/url.ts +2 -2
  22. package/packages/const/src/user.ts +1 -2
  23. package/packages/database/src/client/db.test.ts +19 -13
  24. package/packages/electron-server-ipc/src/ipcClient.test.ts +783 -1
  25. package/packages/file-loaders/src/loadFile.test.ts +61 -0
  26. package/packages/file-loaders/src/utils/isTextReadableFile.test.ts +43 -0
  27. package/packages/file-loaders/src/utils/parser-utils.test.ts +155 -0
  28. package/packages/model-runtime/package.json +2 -1
  29. package/packages/model-runtime/src/ai21/index.test.ts +2 -2
  30. package/packages/model-runtime/src/ai360/index.test.ts +2 -2
  31. package/packages/model-runtime/src/akashchat/index.test.ts +19 -0
  32. package/packages/model-runtime/src/anthropic/index.test.ts +1 -2
  33. package/packages/model-runtime/src/baichuan/index.test.ts +1 -2
  34. package/packages/model-runtime/src/bedrock/index.test.ts +1 -2
  35. package/packages/model-runtime/src/bfl/createImage.test.ts +1 -2
  36. package/packages/model-runtime/src/bfl/index.test.ts +1 -2
  37. package/packages/model-runtime/src/cloudflare/index.test.ts +1 -2
  38. package/packages/model-runtime/src/cohere/index.test.ts +19 -0
  39. package/packages/model-runtime/src/deepseek/index.test.ts +2 -2
  40. package/packages/model-runtime/src/fireworksai/index.test.ts +2 -2
  41. package/packages/model-runtime/src/giteeai/index.test.ts +2 -2
  42. package/packages/model-runtime/src/github/index.test.ts +2 -2
  43. package/packages/model-runtime/src/google/createImage.test.ts +1 -2
  44. package/packages/model-runtime/src/google/index.test.ts +1 -1
  45. package/packages/model-runtime/src/groq/index.test.ts +2 -3
  46. package/packages/model-runtime/src/higress/index.ts +2 -3
  47. package/packages/model-runtime/src/huggingface/index.test.ts +40 -0
  48. package/packages/model-runtime/src/hunyuan/index.test.ts +2 -3
  49. package/packages/model-runtime/src/internlm/index.test.ts +2 -2
  50. package/packages/model-runtime/src/jina/index.test.ts +19 -0
  51. package/packages/model-runtime/src/lmstudio/index.test.ts +2 -2
  52. package/packages/model-runtime/src/minimax/index.test.ts +19 -0
  53. package/packages/model-runtime/src/mistral/index.test.ts +2 -3
  54. package/packages/model-runtime/src/modelscope/index.test.ts +19 -0
  55. package/packages/model-runtime/src/moonshot/index.test.ts +1 -2
  56. package/packages/model-runtime/src/nebius/index.test.ts +19 -0
  57. package/packages/model-runtime/src/novita/index.test.ts +3 -4
  58. package/packages/model-runtime/src/nvidia/index.test.ts +19 -0
  59. package/packages/model-runtime/src/openrouter/index.test.ts +2 -3
  60. package/packages/model-runtime/src/perplexity/index.test.ts +2 -3
  61. package/packages/model-runtime/src/ppio/index.test.ts +3 -4
  62. package/packages/model-runtime/src/qwen/index.test.ts +2 -2
  63. package/packages/model-runtime/src/sambanova/index.test.ts +19 -0
  64. package/packages/model-runtime/src/search1api/index.test.ts +19 -0
  65. package/packages/model-runtime/src/sensenova/index.test.ts +2 -2
  66. package/packages/model-runtime/src/spark/index.test.ts +2 -2
  67. package/packages/model-runtime/src/stepfun/index.test.ts +2 -2
  68. package/packages/model-runtime/src/taichu/index.test.ts +4 -5
  69. package/packages/model-runtime/src/tencentcloud/index.test.ts +1 -1
  70. package/packages/model-runtime/src/togetherai/index.test.ts +1 -2
  71. package/packages/model-runtime/src/upstage/index.test.ts +1 -2
  72. package/packages/model-runtime/src/utils/openaiCompatibleFactory/index.test.ts +9 -7
  73. package/packages/model-runtime/src/utils/streams/anthropic.ts +2 -2
  74. package/packages/model-runtime/src/utils/streams/openai/openai.ts +20 -13
  75. package/packages/model-runtime/src/utils/streams/openai/responsesStream.test.ts +1 -2
  76. package/packages/model-runtime/src/utils/streams/openai/responsesStream.ts +2 -2
  77. package/packages/model-runtime/src/utils/streams/protocol.ts +2 -2
  78. package/packages/model-runtime/src/wenxin/index.test.ts +2 -3
  79. package/packages/model-runtime/src/xai/index.test.ts +2 -2
  80. package/packages/model-runtime/src/zeroone/index.test.ts +1 -2
  81. package/packages/model-runtime/src/zhipu/index.test.ts +2 -3
  82. package/packages/model-runtime/vitest.config.mts +0 -7
  83. package/packages/types/src/discover/index.ts +0 -8
  84. package/packages/types/src/index.ts +4 -0
  85. package/packages/types/src/message/base.ts +1 -1
  86. package/packages/types/src/openai/chat.ts +2 -3
  87. package/packages/types/src/tool/index.ts +1 -0
  88. package/packages/types/src/tool/tool.ts +1 -1
  89. package/packages/types/src/user/settings/index.ts +1 -2
  90. package/packages/utils/package.json +2 -1
  91. package/packages/utils/src/_deprecated/parseModels.test.ts +1 -1
  92. package/packages/utils/src/_deprecated/parseModels.ts +1 -1
  93. package/packages/utils/src/client/topic.test.ts +1 -2
  94. package/packages/utils/src/client/topic.ts +1 -2
  95. package/packages/utils/src/electron/desktopRemoteRPCFetch.ts +1 -1
  96. package/packages/utils/src/fetch/fetchSSE.ts +7 -8
  97. package/packages/utils/src/fetch/parseError.ts +1 -3
  98. package/packages/utils/src/format.test.ts +1 -2
  99. package/packages/utils/src/index.ts +1 -0
  100. package/packages/utils/src/toolManifest.ts +1 -2
  101. package/packages/utils/src/trace.ts +1 -1
  102. package/packages/utils/vitest.config.mts +1 -2
  103. package/packages/web-crawler/src/__tests__/urlRules.test.ts +275 -0
  104. package/packages/web-crawler/src/crawImpl/__tests__/exa.test.ts +269 -0
  105. package/packages/web-crawler/src/crawImpl/__tests__/firecrawl.test.ts +284 -0
  106. package/packages/web-crawler/src/crawImpl/__tests__/naive.test.ts +234 -0
  107. package/packages/web-crawler/src/crawImpl/__tests__/tavily.test.ts +359 -0
  108. package/packages/web-crawler/src/utils/__tests__/errorType.test.ts +217 -0
  109. package/packages/web-crawler/vitest.config.mts +3 -0
  110. package/src/app/(backend)/webapi/models/[provider]/pull/route.ts +0 -2
  111. package/src/app/(backend)/webapi/models/[provider]/route.ts +0 -2
  112. package/src/app/(backend)/webapi/text-to-image/[provider]/route.ts +0 -2
  113. package/src/app/(backend)/webapi/trace/route.ts +0 -2
  114. package/src/components/Thinking/index.tsx +2 -3
  115. package/src/features/ChatInput/StoreUpdater.tsx +2 -0
  116. package/src/libs/traces/index.ts +1 -1
  117. package/src/server/modules/ModelRuntime/trace.ts +1 -2
  118. package/packages/const/src/settings/sync.ts +0 -5
  119. package/packages/model-runtime/src/openrouter/__snapshots__/index.test.ts.snap +0 -113
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.124.3](https://github.com/lobehub/lobe-chat/compare/v1.124.2...v1.124.3)
6
+
7
+ <sup>Released on **2025-09-06**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: Refactor to remove edge runtime and add more tests.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **misc**: Refactor to remove edge runtime and add more tests, closes [#9133](https://github.com/lobehub/lobe-chat/issues/9133) ([6f87034](https://github.com/lobehub/lobe-chat/commit/6f87034))
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.124.2](https://github.com/lobehub/lobe-chat/compare/v1.124.1...v1.124.2)
31
+
32
+ <sup>Released on **2025-09-06**</sup>
33
+
34
+ #### 🐛 Bug Fixes
35
+
36
+ - **misc**: Fix ChatInput send command switch.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's fixed
44
+
45
+ - **misc**: Fix ChatInput send command switch, closes [#9131](https://github.com/lobehub/lobe-chat/issues/9131) ([4d5246a](https://github.com/lobehub/lobe-chat/commit/4d5246a))
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.124.1](https://github.com/lobehub/lobe-chat/compare/v1.124.0...v1.124.1)
6
56
 
7
57
  <sup>Released on **2025-09-06**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,22 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "improvements": [
5
+ "Refactor to remove edge runtime and add more tests."
6
+ ]
7
+ },
8
+ "date": "2025-09-06",
9
+ "version": "1.124.3"
10
+ },
11
+ {
12
+ "children": {
13
+ "fixes": [
14
+ "Fix ChatInput send command switch."
15
+ ]
16
+ },
17
+ "date": "2025-09-06",
18
+ "version": "1.124.2"
19
+ },
2
20
  {
3
21
  "children": {
4
22
  "fixes": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.124.1",
3
+ "version": "1.124.3",
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",
@@ -4,6 +4,8 @@
4
4
  "private": true,
5
5
  "main": "./src/index.ts",
6
6
  "dependencies": {
7
- "model-bank": "workspace:*"
7
+ "model-bank": "workspace:*",
8
+ "query-string": "^9.2.2",
9
+ "url-join": "^5.0.0"
8
10
  }
9
11
  }
@@ -1,3 +1,3 @@
1
- import { isDesktop } from '@/const/version';
1
+ import { isDesktop } from './version';
2
2
 
3
3
  export const BUSINESS_LINE = isDesktop ? 'lobe-chat-desktop' : 'lobe-chat';
@@ -1,5 +1,6 @@
1
- import { DESKTOP_HOTKEYS_REGISTRATION } from '@/const/hotkeys';
2
- import { DesktopHotkeyConfig } from '@/types/hotkey';
1
+ import { DesktopHotkeyConfig } from '@lobechat/types';
2
+
3
+ import { DESKTOP_HOTKEYS_REGISTRATION } from './hotkeys';
3
4
 
4
5
  export const DESKTOP_USER_ID = 'DEFAULT_DESKTOP_USER';
5
6
 
@@ -1,10 +1,11 @@
1
- import { DEFAULT_AGENT_CONFIG } from '@/const/settings';
2
1
  import {
3
2
  DiscoverAssistantDetail,
4
3
  DiscoverModelDetail,
5
4
  DiscoverPluginDetail,
6
5
  DiscoverProviderDetail,
7
- } from '@/types/discover';
6
+ } from '@lobechat/types';
7
+
8
+ import { DEFAULT_AGENT_CONFIG } from './settings';
8
9
 
9
10
  const DEFAULT_CREATED_AT = new Date().toISOString();
10
11
 
@@ -1,6 +1,6 @@
1
1
  import urlJoin from 'url-join';
2
2
 
3
- import { BRANDING_EMAIL } from '@/const/branding';
3
+ import { BRANDING_EMAIL } from './branding';
4
4
  import {
5
5
  BLOG,
6
6
  DOCKER_IMAGE,
@@ -11,7 +11,7 @@ import {
11
11
  SELF_HOSTING_DOCUMENTS,
12
12
  USAGE_DOCUMENTS,
13
13
  WIKI,
14
- } from '@/const/url';
14
+ } from './url';
15
15
 
16
16
  export const INBOX_GUIDE_SYSTEMROLE = `# Role: LobeChat Support Assistant
17
17
 
@@ -6,7 +6,7 @@ import {
6
6
  HotkeyItem,
7
7
  HotkeyScopeEnum,
8
8
  KeyEnum,
9
- } from '@/types/hotkey';
9
+ } from '@lobechat/types';
10
10
 
11
11
  const combineKeys = (keys: string[]) => keys.join('+');
12
12
 
@@ -1,9 +1,11 @@
1
1
  export * from './auth';
2
2
  export * from './branding';
3
3
  export * from './currency';
4
+ export * from './desktop';
4
5
  export * from './layoutTokens';
5
6
  export * from './message';
6
7
  export * from './session';
7
8
  export * from './settings';
9
+ export * from './trace';
8
10
  export * from './user';
9
11
  export * from './version';
@@ -1,4 +1,4 @@
1
- import { UserGeneralConfig } from '@/types/user/settings';
1
+ import { UserGeneralConfig } from '@lobechat/types';
2
2
 
3
3
  export const DEFAULT_COMMON_SETTINGS: UserGeneralConfig = {
4
4
  animationMode: 'agile',
@@ -1,7 +1,6 @@
1
+ import { ModelProviderCard } from '@lobechat/types';
1
2
  import { describe, expect, it, vi } from 'vitest';
2
3
 
3
- import { ModelProviderCard } from '@/types/index';
4
-
5
4
  import { genUserLLMConfig } from './genUserLLMConfig';
6
5
 
7
6
  // Mock ModelProvider enum
@@ -1,8 +1,7 @@
1
1
  import { ModelProvider } from '@lobechat/model-runtime';
2
- import { UserModelProviderConfig } from '@lobechat/types';
2
+ import { ModelProviderCard, UserModelProviderConfig } from '@lobechat/types';
3
3
 
4
4
  import * as ProviderCards from '@/config/modelProviders';
5
- import { ModelProviderCard } from '@/types/llm';
6
5
 
7
6
  export const genUserLLMConfig = (specificConfig: Record<any, any>): UserModelProviderConfig => {
8
7
  return Object.keys(ModelProvider).reduce((config, providerKey) => {
@@ -1,5 +1,6 @@
1
- import { HOTKEYS_REGISTRATION } from '@/const/hotkeys';
2
- import { UserHotkeyConfig } from '@/types/user/settings';
1
+ import { UserHotkeyConfig } from '@lobechat/types';
2
+
3
+ import { HOTKEYS_REGISTRATION } from '../hotkeys';
3
4
 
4
5
  export const DEFAULT_HOTKEY_CONFIG: UserHotkeyConfig = HOTKEYS_REGISTRATION.reduce(
5
6
  (acc: UserHotkeyConfig, item) => {
@@ -1,10 +1,9 @@
1
- import { UserSettings } from '@/types/user/settings';
1
+ import { UserSettings } from '@lobechat/types';
2
2
 
3
3
  import { DEFAULT_AGENT } from './agent';
4
4
  import { DEFAULT_COMMON_SETTINGS } from './common';
5
5
  import { DEFAULT_HOTKEY_CONFIG } from './hotkey';
6
6
  import { DEFAULT_LLM_CONFIG } from './llm';
7
- import { DEFAULT_SYNC_CONFIG } from './sync';
8
7
  import { DEFAULT_SYSTEM_AGENT_CONFIG } from './systemAgent';
9
8
  import { DEFAULT_TOOL_CONFIG } from './tool';
10
9
  import { DEFAULT_TTS_CONFIG } from './tts';
@@ -22,7 +21,6 @@ export const DEFAULT_SETTINGS: UserSettings = {
22
21
  hotkey: DEFAULT_HOTKEY_CONFIG,
23
22
  keyVaults: {},
24
23
  languageModel: DEFAULT_LLM_CONFIG,
25
- sync: DEFAULT_SYNC_CONFIG,
26
24
  systemAgent: DEFAULT_SYSTEM_AGENT_CONFIG,
27
25
  tool: DEFAULT_TOOL_CONFIG,
28
26
  tts: DEFAULT_TTS_CONFIG,
@@ -1,4 +1,4 @@
1
- import { FilesConfig, FilesConfigItem } from '@/types/user/settings/filesConfig';
1
+ import { FilesConfig, FilesConfigItem } from '@lobechat/types';
2
2
 
3
3
  import {
4
4
  DEFAULT_EMBEDDING_MODEL,
@@ -1,5 +1,3 @@
1
- import { ModelProvider } from '@lobechat/model-runtime';
2
-
3
1
  import { genUserLLMConfig } from './genUserLLMConfig';
4
2
 
5
3
  export const DEFAULT_LLM_CONFIG = genUserLLMConfig({
@@ -18,10 +16,10 @@ export const DEFAULT_LLM_CONFIG = genUserLLMConfig({
18
16
  export const DEFAULT_MODEL = 'gpt-5-mini';
19
17
 
20
18
  export const DEFAULT_EMBEDDING_MODEL = 'text-embedding-3-small';
21
- export const DEFAULT_EMBEDDING_PROVIDER = ModelProvider.OpenAI;
19
+ export const DEFAULT_EMBEDDING_PROVIDER = 'openai';
22
20
 
23
21
  export const DEFAULT_RERANK_MODEL = 'rerank-english-v3.0';
24
22
  export const DEFAULT_RERANK_PROVIDER = 'cohere';
25
23
  export const DEFAULT_RERANK_QUERY_MODE = 'full_text';
26
24
 
27
- export const DEFAULT_PROVIDER = ModelProvider.OpenAI;
25
+ export const DEFAULT_PROVIDER = 'openai';
@@ -1,8 +1,4 @@
1
- import {
2
- QueryRewriteSystemAgent,
3
- SystemAgentItem,
4
- UserSystemAgentConfig,
5
- } from '@/types/user/settings';
1
+ import { QueryRewriteSystemAgent, SystemAgentItem, UserSystemAgentConfig } from '@lobechat/types';
6
2
 
7
3
  import { DEFAULT_MODEL, DEFAULT_PROVIDER } from './llm';
8
4
 
@@ -1,4 +1,4 @@
1
- import { UserTTSConfig } from '@/types/user/settings';
1
+ import { UserTTSConfig } from '@lobechat/types';
2
2
 
3
3
  export const DEFAULT_TTS_CONFIG: UserTTSConfig = {
4
4
  openAI: {
@@ -1,4 +1,4 @@
1
- import { TraceNameMap } from '@/types/trace';
1
+ import { TraceNameMap } from '@lobechat/types';
2
2
 
3
3
  export const LOBE_CHAT_TRACE_HEADER = 'X-lobe-trace';
4
4
  export const LOBE_CHAT_TRACE_ID = 'X-lobe-chat-trace-id';
@@ -1,10 +1,10 @@
1
1
  import qs from 'query-string';
2
2
  import urlJoin from 'url-join';
3
3
 
4
- import { isDev } from '@/utils/env';
5
-
6
4
  import { INBOX_SESSION_ID } from './session';
7
5
 
6
+ const isDev = process.env.NODE_ENV === 'development';
7
+
8
8
  export const UTM_SOURCE = 'chat_preview';
9
9
 
10
10
  export const OFFICIAL_URL = 'https://lobechat.com';
@@ -1,5 +1,4 @@
1
- import { TopicDisplayMode } from '@/types/topic';
2
- import { UserPreference } from '@/types/user';
1
+ import { TopicDisplayMode, UserPreference } from '@lobechat/types';
3
2
 
4
3
  export const DEFAULT_PREFERENCE: UserPreference = {
5
4
  guide: {
@@ -58,19 +58,25 @@ beforeEach(() => {
58
58
 
59
59
  describe('DatabaseManager', () => {
60
60
  describe('Callback Handling', () => {
61
- it('should properly track loading states', async () => {
62
- await manager.initialize(callbacks);
63
-
64
- // 验证状态转换顺序
65
- expect(stateChanges).toEqual([
66
- DatabaseLoadingState.Initializing,
67
- DatabaseLoadingState.LoadingDependencies,
68
- DatabaseLoadingState.LoadingWasm,
69
- DatabaseLoadingState.Migrating,
70
- DatabaseLoadingState.Finished,
71
- DatabaseLoadingState.Ready,
72
- ]);
73
- });
61
+ it(
62
+ 'should properly track loading states',
63
+ async () => {
64
+ await manager.initialize(callbacks);
65
+
66
+ // 验证状态转换顺序
67
+ expect(stateChanges).toEqual([
68
+ DatabaseLoadingState.Initializing,
69
+ DatabaseLoadingState.LoadingDependencies,
70
+ DatabaseLoadingState.LoadingWasm,
71
+ DatabaseLoadingState.Migrating,
72
+ DatabaseLoadingState.Finished,
73
+ DatabaseLoadingState.Ready,
74
+ ]);
75
+ },
76
+ {
77
+ timeout: 15000,
78
+ },
79
+ );
74
80
 
75
81
  it('should report dependencies loading progress', async () => {
76
82
  await manager.initialize(callbacks);