@lobehub/chat 1.114.0 → 1.114.2

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 (92) hide show
  1. package/.eslintignore +17 -0
  2. package/.github/workflows/auto-i18n.yml +1 -1
  3. package/.github/workflows/claude.yml +1 -1
  4. package/.github/workflows/desktop-pr-build.yml +4 -4
  5. package/.github/workflows/docker-database.yml +3 -3
  6. package/.github/workflows/docker-pglite.yml +3 -3
  7. package/.github/workflows/docker.yml +3 -3
  8. package/.github/workflows/lighthouse.yml +2 -2
  9. package/.github/workflows/release-desktop-beta.yml +3 -3
  10. package/.github/workflows/release.yml +2 -2
  11. package/.github/workflows/sync-database-schema.yml +1 -1
  12. package/.github/workflows/sync.yml +1 -1
  13. package/.github/workflows/test.yml +76 -14
  14. package/.stylelintignore +39 -0
  15. package/CHANGELOG.md +50 -0
  16. package/changelog/v1.json +18 -0
  17. package/package.json +1 -1
  18. package/packages/const/src/index.ts +2 -0
  19. package/packages/electron-server-ipc/package.json +2 -1
  20. package/packages/electron-server-ipc/vitest.config.ts +10 -0
  21. package/packages/file-loaders/package.json +2 -1
  22. package/packages/model-runtime/package.json +4 -0
  23. package/packages/model-runtime/src/baichuan/index.test.ts +1 -1
  24. package/packages/model-runtime/src/mistral/index.test.ts +1 -1
  25. package/packages/model-runtime/src/utils/anthropicHelpers.test.ts +1 -1
  26. package/packages/model-runtime/src/utils/modelParse.ts +1 -2
  27. package/packages/model-runtime/vitest.config.ts +16 -0
  28. package/packages/prompts/package.json +5 -0
  29. package/{src → packages/prompts/src}/chains/__tests__/langDetect.test.ts +1 -2
  30. package/{src → packages/prompts/src}/chains/__tests__/pickEmoji.test.ts +1 -2
  31. package/{src → packages/prompts/src}/chains/__tests__/summaryAgentName.test.ts +2 -15
  32. package/{src → packages/prompts/src}/chains/__tests__/summaryDescription.test.ts +4 -16
  33. package/{src → packages/prompts/src}/chains/__tests__/summaryHistory.test.ts +1 -5
  34. package/{src → packages/prompts/src}/chains/__tests__/summaryTags.test.ts +1 -14
  35. package/{src → packages/prompts/src}/chains/__tests__/summaryTitle.test.ts +3 -22
  36. package/{src → packages/prompts/src}/chains/abstractChunk.ts +2 -2
  37. package/{src → packages/prompts/src}/chains/answerWithContext.ts +1 -1
  38. package/packages/prompts/src/chains/index.ts +12 -0
  39. package/{src → packages/prompts/src}/chains/langDetect.ts +1 -1
  40. package/{src → packages/prompts/src}/chains/pickEmoji.ts +1 -1
  41. package/{src → packages/prompts/src}/chains/rewriteQuery.ts +2 -2
  42. package/{src → packages/prompts/src}/chains/summaryAgentName.ts +6 -5
  43. package/{src → packages/prompts/src}/chains/summaryDescription.ts +7 -5
  44. package/{src → packages/prompts/src}/chains/summaryGenerationTitle.ts +3 -5
  45. package/{src → packages/prompts/src}/chains/summaryHistory.ts +2 -3
  46. package/{src → packages/prompts/src}/chains/summaryTags.ts +3 -4
  47. package/{src → packages/prompts/src}/chains/summaryTitle.ts +5 -5
  48. package/{src → packages/prompts/src}/chains/translate.ts +1 -1
  49. package/packages/prompts/src/index.ts +2 -5
  50. package/packages/prompts/src/{files → prompts/files}/index.test.ts +1 -2
  51. package/packages/prompts/src/prompts/index.ts +5 -0
  52. package/packages/prompts/src/{knowledgeBaseQA → prompts/knowledgeBaseQA}/index.test.ts +1 -3
  53. package/packages/prompts/src/{plugin → prompts/plugin}/index.test.ts +2 -0
  54. package/packages/prompts/vitest.config.ts +7 -0
  55. package/packages/types/src/index.ts +4 -0
  56. package/packages/web-crawler/package.json +4 -0
  57. package/packages/web-crawler/src/crawImpl/__tests__/jina.test.ts +1 -1
  58. package/packages/web-crawler/src/crawImpl/__tests__/search1api.test.ts +1 -1
  59. package/packages/web-crawler/src/utils/__tests__/withTimeout.test.ts +1 -1
  60. package/packages/web-crawler/src/utils/appUrlRules.test.ts +2 -0
  61. package/packages/web-crawler/src/utils/htmlToMarkdown.test.ts +1 -1
  62. package/packages/web-crawler/vitest.config.ts +7 -0
  63. package/src/app/[variants]/(main)/settings/provider/(detail)/[id]/ClientMode.tsx +4 -0
  64. package/src/features/AgentSetting/store/action.ts +19 -7
  65. package/src/server/routers/async/ragEval.ts +1 -1
  66. package/src/store/chat/slices/aiChat/actions/memory.ts +1 -1
  67. package/src/store/chat/slices/aiChat/actions/rag.ts +1 -1
  68. package/src/store/chat/slices/thread/action.ts +3 -2
  69. package/src/store/chat/slices/topic/action.ts +3 -2
  70. package/src/store/chat/slices/translate/action.test.ts +2 -2
  71. package/src/store/chat/slices/translate/action.ts +1 -2
  72. package/src/store/image/slices/generationTopic/action.ts +6 -2
  73. package/tsconfig.json +1 -1
  74. package/vitest.config.ts +2 -0
  75. package/.github/workflows/claude-code-review.yml +0 -78
  76. package/.github/workflows/wiki-sync.yml +0 -19
  77. /package/{src → packages/prompts/src}/chains/__tests__/__snapshots__/summaryHistory.test.ts.snap +0 -0
  78. /package/{src → packages/prompts/src}/chains/__tests__/translate.test.ts +0 -0
  79. /package/packages/prompts/src/{chatMessages → prompts/chatMessages}/index.test.ts +0 -0
  80. /package/packages/prompts/src/{chatMessages → prompts/chatMessages}/index.ts +0 -0
  81. /package/packages/prompts/src/{files → prompts/files}/file.ts +0 -0
  82. /package/packages/prompts/src/{files → prompts/files}/image.ts +0 -0
  83. /package/packages/prompts/src/{files → prompts/files}/index.ts +0 -0
  84. /package/packages/prompts/src/{knowledgeBaseQA → prompts/knowledgeBaseQA}/__snapshots__/index.test.ts.snap +0 -0
  85. /package/packages/prompts/src/{knowledgeBaseQA → prompts/knowledgeBaseQA}/chunk.ts +0 -0
  86. /package/packages/prompts/src/{knowledgeBaseQA → prompts/knowledgeBaseQA}/index.ts +0 -0
  87. /package/packages/prompts/src/{knowledgeBaseQA → prompts/knowledgeBaseQA}/knowledge.ts +0 -0
  88. /package/packages/prompts/src/{knowledgeBaseQA → prompts/knowledgeBaseQA}/userQuery.ts +0 -0
  89. /package/packages/prompts/src/{plugin → prompts/plugin}/index.ts +0 -0
  90. /package/packages/prompts/src/{plugin → prompts/plugin}/tools.test.ts +0 -0
  91. /package/packages/prompts/src/{plugin → prompts/plugin}/tools.ts +0 -0
  92. /package/packages/prompts/src/{systemRole → prompts/systemRole}/index.ts +0 -0
@@ -1,9 +1,8 @@
1
+ import { chainLangDetect , chainTranslate } from '@lobechat/prompts';
1
2
  import { TraceNameMap, TracePayload } from '@lobechat/types';
2
3
  import { produce } from 'immer';
3
4
  import { StateCreator } from 'zustand/vanilla';
4
5
 
5
- import { chainLangDetect } from '@/chains/langDetect';
6
- import { chainTranslate } from '@/chains/translate';
7
6
  import { supportLocales } from '@/locales/resources';
8
7
  import { chatService } from '@/services/chat';
9
8
  import { messageService } from '@/services/message';
@@ -1,13 +1,14 @@
1
+ import { chainSummaryGenerationTitle } from '@lobechat/prompts';
1
2
  import isEqual from 'fast-deep-equal';
2
3
  import { SWRResponse, mutate } from 'swr';
3
4
  import { StateCreator } from 'zustand/vanilla';
4
5
 
5
- import { chainSummaryGenerationTitle } from '@/chains/summaryGenerationTitle';
6
6
  import { LOADING_FLAT } from '@/const/message';
7
7
  import { useClientDataSWR } from '@/libs/swr';
8
8
  import { UpdateTopicValue } from '@/server/routers/lambda/generationTopic';
9
9
  import { chatService } from '@/services/chat';
10
10
  import { generationTopicService } from '@/services/generationTopic';
11
+ import { globalHelpers } from '@/store/global/helpers';
11
12
  import { useUserStore } from '@/store/user';
12
13
  import { systemAgentSelectors } from '@/store/user/selectors';
13
14
  import { ImageGenerationTopic } from '@/types/generation';
@@ -115,7 +116,10 @@ export const createGenerationTopicSlice: StateCreator<
115
116
  );
116
117
  // Auto generate topic title from prompt by AI
117
118
  await chatService.fetchPresetTaskResult({
118
- params: merge(generationTopicAgentConfig, chainSummaryGenerationTitle(prompts, 'image')),
119
+ params: merge(
120
+ generationTopicAgentConfig,
121
+ chainSummaryGenerationTitle(prompts, 'image', globalHelpers.getCurrentLanguage()),
122
+ ),
119
123
  onError: async () => {
120
124
  const fallbackTitle = generateFallbackTitle();
121
125
  internal_updateGenerationTopicTitleInSummary(topicId, fallbackTitle);
package/tsconfig.json CHANGED
@@ -31,7 +31,7 @@
31
31
  }
32
32
  ]
33
33
  },
34
- "exclude": ["node_modules", "public/sw.js", "apps/desktop"],
34
+ "exclude": ["node_modules", "public/sw.js", "apps/desktop", "tmp", "temp", ".temp"],
35
35
  "include": [
36
36
  "**/*.d.ts",
37
37
  "**/*.ts",
package/vitest.config.ts CHANGED
@@ -22,6 +22,7 @@ export default defineConfig({
22
22
  // https://github.com/lobehub/lobe-chat/pull/7265
23
23
  ...coverageConfigDefaults.exclude,
24
24
  '__mocks__/**',
25
+ '**/packages/**',
25
26
  // just ignore the migration code
26
27
  // we will use pglite in the future
27
28
  // so the coverage of this file is not important
@@ -38,6 +39,7 @@ export default defineConfig({
38
39
  '**/dist/**',
39
40
  '**/build/**',
40
41
  '**/apps/desktop/**',
42
+ '**/packages/**',
41
43
  'src/database/server/**/**',
42
44
  'src/database/repositories/dataImporter/deprecated/**/**',
43
45
  ],
@@ -1,78 +0,0 @@
1
- name: Claude Code Review
2
-
3
- on:
4
- pull_request:
5
- types: [opened, synchronize]
6
- # Optional: Only run on specific file changes
7
- # paths:
8
- # - "src/**/*.ts"
9
- # - "src/**/*.tsx"
10
- # - "src/**/*.js"
11
- # - "src/**/*.jsx"
12
-
13
- jobs:
14
- claude-review:
15
- # Optional: Filter by PR author
16
- # if: |
17
- # github.event.pull_request.user.login == 'external-contributor' ||
18
- # github.event.pull_request.user.login == 'new-developer' ||
19
- # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20
-
21
- runs-on: ubuntu-latest
22
- permissions:
23
- contents: read
24
- pull-requests: read
25
- issues: read
26
- id-token: write
27
-
28
- steps:
29
- - name: Checkout repository
30
- uses: actions/checkout@v4
31
- with:
32
- fetch-depth: 1
33
-
34
- - name: Run Claude Code Review
35
- id: claude-review
36
- uses: anthropics/claude-code-action@beta
37
- with:
38
- claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39
-
40
- # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
41
- model: 'claude-opus-4-1-20250805'
42
- allowed_bots: 'bot'
43
-
44
- # Direct prompt for automated review (no @claude mention needed)
45
- direct_prompt: |
46
- Please review this pull request and provide feedback on:
47
- - Code quality and best practices
48
- - Potential bugs or issues
49
- - Performance considerations
50
- - Security concerns
51
- - Test coverage
52
-
53
- Be constructive and helpful in your feedback.
54
-
55
- # Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
56
- # use_sticky_comment: true
57
-
58
- # Optional: Customize review based on file types
59
- # direct_prompt: |
60
- # Review this PR focusing on:
61
- # - For TypeScript files: Type safety and proper interface usage
62
- # - For API endpoints: Security, input validation, and error handling
63
- # - For React components: Performance, accessibility, and best practices
64
- # - For tests: Coverage, edge cases, and test quality
65
-
66
- # Optional: Different prompts for different authors
67
- # direct_prompt: |
68
- # ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
69
- # 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
70
- # 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
71
-
72
- # Optional: Add specific tools for running tests or linting
73
- allowed_tools: 'Bash(bun run:*),Bash(pnpm run:*),Bash(npm run:*),Bash(npx vitest:*),Bash(rg:*),Bash(find:*),Bash(sed:*),Bash(grep:*),Bash(awk:*),Bash(wc:*),Bash(xargs:*)'
74
-
75
- # Optional: Skip review for certain conditions
76
- # if: |
77
- # !contains(github.event.pull_request.title, '[skip-review]') &&
78
- # !contains(github.event.pull_request.title, '[WIP]')
@@ -1,19 +0,0 @@
1
- name: Wiki Sync
2
-
3
- on:
4
- workflow_dispatch:
5
- push:
6
- paths:
7
- - 'docs/wiki/**'
8
- branches:
9
- - main
10
-
11
- jobs:
12
- update-wiki:
13
- runs-on: ubuntu-latest
14
- name: Wiki sync
15
- steps:
16
- - uses: OrlovM/Wiki-Action@v1
17
- with:
18
- path: 'docs/wiki'
19
- token: ${{ secrets.GH_TOKEN }}