@lobehub/lobehub 2.0.0-next.97 → 2.0.0-next.99

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 (150) hide show
  1. package/.console-log-whitelist.json +14 -0
  2. package/.github/workflows/check-console-log.yml +117 -0
  3. package/.github/workflows/desktop-pr-build.yml +4 -4
  4. package/.github/workflows/release-desktop-beta.yml +4 -4
  5. package/.github/workflows/release.yml +1 -1
  6. package/.github/workflows/test.yml +5 -5
  7. package/CHANGELOG.md +58 -0
  8. package/apps/desktop/src/main/services/__tests__/fileSrv.test.ts +603 -0
  9. package/changelog/v1.json +21 -0
  10. package/codecov.yml +1 -0
  11. package/docs/development/database-schema.dbml +1 -0
  12. package/e2e/package.json +1 -1
  13. package/locales/ar/file.json +9 -11
  14. package/locales/ar/plugin.json +34 -22
  15. package/locales/ar/tool.json +8 -0
  16. package/locales/bg-BG/file.json +8 -10
  17. package/locales/bg-BG/plugin.json +34 -22
  18. package/locales/bg-BG/tool.json +8 -0
  19. package/locales/de-DE/file.json +9 -11
  20. package/locales/de-DE/plugin.json +34 -22
  21. package/locales/de-DE/tool.json +8 -0
  22. package/locales/en-US/file.json +12 -14
  23. package/locales/en-US/plugin.json +34 -22
  24. package/locales/en-US/tool.json +8 -0
  25. package/locales/es-ES/file.json +7 -9
  26. package/locales/es-ES/plugin.json +34 -22
  27. package/locales/es-ES/tool.json +8 -0
  28. package/locales/fa-IR/file.json +9 -11
  29. package/locales/fa-IR/plugin.json +34 -22
  30. package/locales/fa-IR/tool.json +8 -0
  31. package/locales/fr-FR/file.json +6 -8
  32. package/locales/fr-FR/plugin.json +34 -22
  33. package/locales/fr-FR/tool.json +8 -0
  34. package/locales/it-IT/file.json +8 -10
  35. package/locales/it-IT/plugin.json +34 -22
  36. package/locales/it-IT/tool.json +8 -0
  37. package/locales/ja-JP/file.json +10 -12
  38. package/locales/ja-JP/plugin.json +34 -22
  39. package/locales/ja-JP/tool.json +8 -0
  40. package/locales/ko-KR/file.json +8 -10
  41. package/locales/ko-KR/plugin.json +34 -22
  42. package/locales/ko-KR/tool.json +8 -0
  43. package/locales/nl-NL/file.json +8 -10
  44. package/locales/nl-NL/plugin.json +34 -22
  45. package/locales/nl-NL/tool.json +8 -0
  46. package/locales/pl-PL/file.json +7 -9
  47. package/locales/pl-PL/plugin.json +34 -22
  48. package/locales/pl-PL/tool.json +8 -0
  49. package/locales/pt-BR/file.json +7 -9
  50. package/locales/pt-BR/plugin.json +34 -22
  51. package/locales/pt-BR/tool.json +8 -0
  52. package/locales/ru-RU/file.json +9 -11
  53. package/locales/ru-RU/plugin.json +34 -22
  54. package/locales/ru-RU/tool.json +8 -0
  55. package/locales/tr-TR/file.json +8 -10
  56. package/locales/tr-TR/plugin.json +34 -22
  57. package/locales/tr-TR/tool.json +8 -0
  58. package/locales/vi-VN/file.json +9 -11
  59. package/locales/vi-VN/plugin.json +34 -22
  60. package/locales/vi-VN/tool.json +8 -0
  61. package/locales/zh-CN/file.json +10 -12
  62. package/locales/zh-CN/plugin.json +34 -22
  63. package/locales/zh-CN/tool.json +8 -0
  64. package/locales/zh-TW/file.json +10 -12
  65. package/locales/zh-TW/plugin.json +34 -22
  66. package/locales/zh-TW/tool.json +8 -0
  67. package/package.json +3 -2
  68. package/packages/database/migrations/0047_add_slug_document.sql +6 -0
  69. package/packages/database/migrations/meta/0047_snapshot.json +7891 -0
  70. package/packages/database/migrations/meta/_journal.json +7 -0
  71. package/packages/database/src/core/migrations.json +16 -7
  72. package/packages/database/src/models/__tests__/document.test.ts +149 -0
  73. package/packages/database/src/models/chunk.ts +3 -1
  74. package/packages/database/src/models/document.ts +10 -4
  75. package/packages/database/src/schemas/file.ts +7 -1
  76. package/packages/model-bank/src/aiModels/qwen.ts +5 -3
  77. package/packages/model-runtime/src/core/openaiCompatibleFactory/index.ts +21 -21
  78. package/packages/obervability-otel/package.json +2 -2
  79. package/packages/prompts/src/prompts/knowledgeBaseQA/__snapshots__/formatFileContents.test.ts.snap +75 -0
  80. package/packages/prompts/src/prompts/knowledgeBaseQA/__snapshots__/formatNoSearchResults.test.ts.snap +45 -0
  81. package/packages/prompts/src/prompts/knowledgeBaseQA/__snapshots__/formatSearchResults.test.ts.snap +82 -0
  82. package/packages/prompts/src/prompts/knowledgeBaseQA/formatFileContents.test.ts +118 -0
  83. package/packages/prompts/src/prompts/knowledgeBaseQA/formatFileContents.ts +31 -0
  84. package/packages/prompts/src/prompts/knowledgeBaseQA/formatNoSearchResults.test.ts +25 -0
  85. package/packages/prompts/src/prompts/knowledgeBaseQA/formatNoSearchResults.ts +13 -0
  86. package/packages/prompts/src/prompts/knowledgeBaseQA/formatSearchResults.test.ts +191 -0
  87. package/packages/prompts/src/prompts/knowledgeBaseQA/formatSearchResults.ts +50 -0
  88. package/packages/prompts/src/prompts/knowledgeBaseQA/index.ts +6 -0
  89. package/packages/types/src/rag.ts +13 -4
  90. package/scripts/checkConsoleLog.mts +148 -0
  91. package/scripts/prebuild.mts +5 -5
  92. package/src/app/[variants]/(main)/changelog/index.tsx +1 -1
  93. package/src/app/[variants]/(main)/settings/_layout/Desktop/index.tsx +20 -16
  94. package/src/app/[variants]/(main)/settings/provider/(list)/ProviderGrid/Card.tsx +6 -3
  95. package/src/app/[variants]/(main)/settings/provider/(list)/index.tsx +3 -2
  96. package/src/app/[variants]/(main)/settings/provider/detail/index.tsx +14 -4
  97. package/src/app/[variants]/desktopRouter.config.tsx +23 -0
  98. package/src/app/[variants]/mobileRouter.config.tsx +23 -0
  99. package/src/features/ChatInput/ActionBar/Token/TokenTag.tsx +2 -2
  100. package/src/features/ChatInput/ActionBar/Token/TokenTagForGroupChat.tsx +2 -2
  101. package/src/features/ChatList/Messages/Group/Tool/Inspector/ToolTitle.tsx +5 -23
  102. package/src/features/ChatList/Messages/Tool/Inspector/ToolTitle.tsx +5 -25
  103. package/src/features/KnowledgeManager/DocumentExplorer/NoteEditorModal.tsx +0 -20
  104. package/src/features/KnowledgeManager/DocumentExplorer/index.tsx +3 -3
  105. package/src/features/KnowledgeManager/FileExplorer/MasonryFileItem/index.tsx +0 -20
  106. package/src/features/KnowledgeManager/Header/AddButton.tsx +0 -1
  107. package/src/features/KnowledgeManager/Header/NewNoteButton.tsx +1 -1
  108. package/src/features/KnowledgeManager/Header/TogglePanelButton.tsx +2 -2
  109. package/src/features/KnowledgeManager/Home/UploadEntries.tsx +2 -2
  110. package/src/features/KnowledgeManager/Home/index.tsx +4 -4
  111. package/src/features/PluginsUI/Render/BuiltinType/index.tsx +1 -1
  112. package/src/features/User/UserPanel/useMenu.tsx +7 -3
  113. package/src/helpers/toolEngineering/index.test.ts +3 -3
  114. package/src/helpers/toolEngineering/index.ts +17 -4
  115. package/src/libs/trpc/client/lambda.ts +0 -6
  116. package/src/locales/default/file.ts +11 -13
  117. package/src/locales/default/plugin.ts +34 -22
  118. package/src/locales/default/tool.ts +13 -5
  119. package/src/server/routers/lambda/chunk.ts +168 -41
  120. package/src/services/chat/chat.test.ts +3 -3
  121. package/src/services/chat/index.ts +2 -2
  122. package/src/services/rag.ts +6 -2
  123. package/src/store/chat/agents/__tests__/createAgentExecutors/helpers/testExecutor.ts +1 -4
  124. package/src/store/chat/slices/aiChat/actions/__tests__/conversationLifecycle.test.ts +11 -0
  125. package/src/store/chat/slices/aiChat/actions/__tests__/rag.test.ts +0 -87
  126. package/src/store/chat/slices/aiChat/actions/__tests__/streamingExecutor.test.ts +2 -69
  127. package/src/store/chat/slices/aiChat/actions/conversationLifecycle.ts +0 -2
  128. package/src/store/chat/slices/aiChat/actions/rag.ts +0 -47
  129. package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +8 -69
  130. package/src/store/chat/slices/builtinTool/actions/index.ts +4 -1
  131. package/src/store/chat/slices/builtinTool/actions/knowledgeBase.ts +174 -0
  132. package/src/store/chat/slices/operation/types.ts +1 -0
  133. package/src/store/chat/slices/thread/action.test.ts +0 -1
  134. package/src/store/chat/slices/thread/action.ts +0 -1
  135. package/src/tools/executionRuntimes.ts +3 -0
  136. package/src/tools/identifiers.ts +13 -0
  137. package/src/tools/index.ts +7 -0
  138. package/src/tools/knowledge-base/ExecutionRuntime/index.ts +96 -0
  139. package/src/tools/knowledge-base/Render/ReadKnowledge/FileCard.tsx +135 -0
  140. package/src/tools/knowledge-base/Render/ReadKnowledge/index.tsx +27 -0
  141. package/src/tools/knowledge-base/Render/SearchKnowledgeBase/Item/index.tsx +54 -0
  142. package/src/tools/knowledge-base/Render/SearchKnowledgeBase/Item/style.ts +51 -0
  143. package/src/tools/knowledge-base/Render/SearchKnowledgeBase/index.tsx +23 -0
  144. package/src/tools/knowledge-base/Render/index.ts +7 -0
  145. package/src/tools/knowledge-base/index.ts +64 -0
  146. package/src/tools/knowledge-base/systemRole.ts +102 -0
  147. package/src/tools/knowledge-base/type.ts +25 -0
  148. package/src/tools/local-system/Intervention/WriteFile/index.tsx +1 -1
  149. package/src/tools/renders.ts +4 -0
  150. package/src/store/chat/agents/createToolEngine.ts +0 -22
@@ -0,0 +1,14 @@
1
+ {
2
+ "files": ["drizzle.config.ts"],
3
+ "patterns": [
4
+ "scripts/**",
5
+ "**/*.test.ts",
6
+ "**/*.test.tsx",
7
+ "**/*.spec.ts",
8
+ "**/*.spec.tsx",
9
+ "**/examples/**",
10
+ "e2e/**",
11
+ ".github/scripts/**",
12
+ "apps/desktop/**"
13
+ ]
14
+ }
@@ -0,0 +1,117 @@
1
+ name: Check Console Log (Warning)
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ - next
8
+
9
+ permissions:
10
+ contents: read
11
+ pull-requests: write
12
+
13
+ jobs:
14
+ check-console-log:
15
+ name: Check for console.log statements (non-blocking)
16
+ runs-on: ubuntu-latest
17
+
18
+ steps:
19
+ - uses: actions/checkout@v5
20
+
21
+ - name: Install bun
22
+ uses: oven-sh/setup-bun@v2
23
+
24
+ - name: Run console.log check
25
+ id: check
26
+ run: |
27
+ OUTPUT=$(bunx tsx scripts/checkConsoleLog.mts 2>&1)
28
+ echo "$OUTPUT"
29
+
30
+ # Save output to file for later use
31
+ echo "$OUTPUT" > /tmp/console-log-output.txt
32
+
33
+ # Check if violations were found
34
+ if echo "$OUTPUT" | grep -q "Total violations:"; then
35
+ echo "has_violations=true" >> $GITHUB_OUTPUT
36
+ TOTAL=$(echo "$OUTPUT" | grep -oP "Total violations: \K\d+")
37
+ echo "total=$TOTAL" >> $GITHUB_OUTPUT
38
+ else
39
+ echo "has_violations=false" >> $GITHUB_OUTPUT
40
+ fi
41
+
42
+ - name: Comment on PR
43
+ if: steps.check.outputs.has_violations == 'true'
44
+ uses: actions/github-script@v7
45
+ env:
46
+ VIOLATION_COUNT: ${{ steps.check.outputs.total }}
47
+ with:
48
+ script: |
49
+ const fs = require('fs');
50
+ const output = fs.readFileSync('/tmp/console-log-output.txt', 'utf8');
51
+ const total = process.env.VIOLATION_COUNT || '0';
52
+
53
+ // Parse violations from output (format: " file:line" followed by " content")
54
+ const lines = output.split('\n');
55
+ const violations = [];
56
+ for (let i = 0; i < lines.length; i++) {
57
+ const line = lines[i];
58
+ // Match lines like " packages/database/src/client/db.ts:258"
59
+ const fileMatch = line.match(/^\s{2}(\S+:\d+)\s*$/);
60
+ if (fileMatch) {
61
+ const file = fileMatch[1];
62
+ const content = lines[i + 1]?.trim() || '';
63
+ violations.push({ file, content });
64
+ i++;
65
+ }
66
+ }
67
+
68
+ // Build comment body
69
+ const maxDisplay = 30;
70
+ let body = `## ⚠️ Console.log Check Warning\n\n`;
71
+ body += `Found **${total}** \`console.log\` statement(s) in this PR.\n\n`;
72
+
73
+ if (violations.length > 0) {
74
+ body += `<details>\n<summary>📋 Click to see violations (${Math.min(violations.length, maxDisplay)} of ${total} shown)</summary>\n\n`;
75
+ body += `| File | Code |\n|------|------|\n`;
76
+ violations.slice(0, maxDisplay).forEach(v => {
77
+ const escapedContent = v.content
78
+ .substring(0, 60)
79
+ .replace(/\|/g, '\\|')
80
+ .replace(/`/g, "'");
81
+ body += `| \`${v.file}\` | \`${escapedContent}${v.content.length > 60 ? '...' : ''}\` |\n`;
82
+ });
83
+ if (parseInt(total) > maxDisplay) {
84
+ body += `\n*...and ${parseInt(total) - maxDisplay} more violations*\n`;
85
+ }
86
+ body += `\n</details>\n\n`;
87
+ }
88
+
89
+ body += `> 💡 **Tip:** Remove \`console.log\` or add files to \`.console-log-whitelist.json\`\n`;
90
+ body += `> ✅ This check is **non-blocking** and won't prevent merging.`;
91
+
92
+ // Find existing comment to update instead of creating duplicates
93
+ const { data: comments } = await github.rest.issues.listComments({
94
+ owner: context.repo.owner,
95
+ repo: context.repo.repo,
96
+ issue_number: context.issue.number,
97
+ });
98
+
99
+ const botComment = comments.find(c =>
100
+ c.user.type === 'Bot' && c.body.includes('Console.log Check Warning')
101
+ );
102
+
103
+ if (botComment) {
104
+ await github.rest.issues.updateComment({
105
+ owner: context.repo.owner,
106
+ repo: context.repo.repo,
107
+ comment_id: botComment.id,
108
+ body,
109
+ });
110
+ } else {
111
+ await github.rest.issues.createComment({
112
+ owner: context.repo.owner,
113
+ repo: context.repo.repo,
114
+ issue_number: context.issue.number,
115
+ body,
116
+ });
117
+ }
@@ -32,7 +32,7 @@ jobs:
32
32
  - name: Setup Node.js
33
33
  uses: actions/setup-node@v6
34
34
  with:
35
- node-version: 24
35
+ node-version: 24.11.1
36
36
  package-manager-cache: false
37
37
 
38
38
  - name: Install bun
@@ -66,7 +66,7 @@ jobs:
66
66
  - name: Setup Node.js
67
67
  uses: actions/setup-node@v6
68
68
  with:
69
- node-version: 24
69
+ node-version: 24.11.1
70
70
  package-manager-cache: false
71
71
 
72
72
  # 主要逻辑:确定构建版本号
@@ -111,7 +111,7 @@ jobs:
111
111
  - name: Setup Node.js
112
112
  uses: actions/setup-node@v6
113
113
  with:
114
- node-version: 24
114
+ node-version: 24.11.1
115
115
  package-manager-cache: false
116
116
 
117
117
  # node-linker=hoisted 模式将可以确保 asar 压缩可用
@@ -232,7 +232,7 @@ jobs:
232
232
  - name: Setup Node.js
233
233
  uses: actions/setup-node@v6
234
234
  with:
235
- node-version: 24
235
+ node-version: 24.11.1
236
236
  package-manager-cache: false
237
237
 
238
238
  - name: Install bun
@@ -26,7 +26,7 @@ jobs:
26
26
  - name: Setup Node.js
27
27
  uses: actions/setup-node@v6
28
28
  with:
29
- node-version: 24
29
+ node-version: 24.11.1
30
30
  package-manager-cache: false
31
31
 
32
32
  - name: Install bun
@@ -55,7 +55,7 @@ jobs:
55
55
  - name: Setup Node.js
56
56
  uses: actions/setup-node@v6
57
57
  with:
58
- node-version: 24
58
+ node-version: 24.11.1
59
59
  package-manager-cache: false
60
60
 
61
61
  # 主要逻辑:确定构建版本号
@@ -96,7 +96,7 @@ jobs:
96
96
  - name: Setup Node.js
97
97
  uses: actions/setup-node@v6
98
98
  with:
99
- node-version: 24
99
+ node-version: 24.11.1
100
100
  package-manager-cache: false
101
101
 
102
102
  # node-linker=hoisted 模式将可以确保 asar 压缩可用
@@ -210,7 +210,7 @@ jobs:
210
210
  - name: Setup Node.js
211
211
  uses: actions/setup-node@v6
212
212
  with:
213
- node-version: 24
213
+ node-version: 24.11.1
214
214
  package-manager-cache: false
215
215
 
216
216
  - name: Install bun
@@ -35,7 +35,7 @@ jobs:
35
35
  - name: Setup Node.js
36
36
  uses: actions/setup-node@v6
37
37
  with:
38
- node-version: 24
38
+ node-version: 24.11.1
39
39
  package-manager-cache: false
40
40
 
41
41
  - name: Install bun
@@ -31,7 +31,7 @@ jobs:
31
31
  - name: Setup Node.js
32
32
  uses: actions/setup-node@v6
33
33
  with:
34
- node-version: 24
34
+ node-version: 24.11.1
35
35
  package-manager-cache: false
36
36
 
37
37
  - name: Install bun
@@ -66,7 +66,7 @@ jobs:
66
66
  - name: Setup Node.js
67
67
  uses: actions/setup-node@v6
68
68
  with:
69
- node-version: 24
69
+ node-version: 24.11.1
70
70
  package-manager-cache: false
71
71
 
72
72
  - name: Install bun
@@ -99,7 +99,7 @@ jobs:
99
99
  - name: Setup Node.js
100
100
  uses: actions/setup-node@v6
101
101
  with:
102
- node-version: 24
102
+ node-version: 24.11.1
103
103
  package-manager-cache: false
104
104
 
105
105
  - name: Install bun
@@ -131,7 +131,7 @@ jobs:
131
131
  - name: Setup Node.js
132
132
  uses: actions/setup-node@v6
133
133
  with:
134
- node-version: 24
134
+ node-version: 24.11.1
135
135
  package-manager-cache: false
136
136
 
137
137
  - name: Setup pnpm
@@ -179,7 +179,7 @@ jobs:
179
179
  - name: Setup Node.js
180
180
  uses: actions/setup-node@v6
181
181
  with:
182
- node-version: 24
182
+ node-version: 24.11.1
183
183
  package-manager-cache: false
184
184
 
185
185
  - name: Install pnpm
package/CHANGELOG.md CHANGED
@@ -2,6 +2,64 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 2.0.0-next.99](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.98...v2.0.0-next.99)
6
+
7
+ <sup>Released on **2025-11-21**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **misc**: Refactor to use kb search tool.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **misc**: Refactor to use kb search tool, closes [#10340](https://github.com/lobehub/lobe-chat/issues/10340) ([291ff3c](https://github.com/lobehub/lobe-chat/commit/291ff3c))
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 2.0.0-next.98](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.97...v2.0.0-next.98)
31
+
32
+ <sup>Released on **2025-11-21**</sup>
33
+
34
+ #### 🐛 Bug Fixes
35
+
36
+ - **misc**: Fixed changelog pages and open again.
37
+
38
+ #### 💄 Styles
39
+
40
+ - **misc**: Fix some translations.
41
+
42
+ <br/>
43
+
44
+ <details>
45
+ <summary><kbd>Improvements and Fixes</kbd></summary>
46
+
47
+ #### What's fixed
48
+
49
+ - **misc**: Fixed changelog pages and open again, closes [#10285](https://github.com/lobehub/lobe-chat/issues/10285) ([871d141](https://github.com/lobehub/lobe-chat/commit/871d141))
50
+
51
+ #### Styles
52
+
53
+ - **misc**: Fix some translations, closes [#10343](https://github.com/lobehub/lobe-chat/issues/10343) ([ed193e0](https://github.com/lobehub/lobe-chat/commit/ed193e0))
54
+
55
+ </details>
56
+
57
+ <div align="right">
58
+
59
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
60
+
61
+ </div>
62
+
5
63
  ## [Version 2.0.0-next.97](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.96...v2.0.0-next.97)
6
64
 
7
65
  <sup>Released on **2025-11-21**</sup>