@lobehub/chat 1.114.0 → 1.114.1

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 (74) 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 +1 -1
  14. package/.stylelintignore +39 -0
  15. package/CHANGELOG.md +25 -0
  16. package/changelog/v1.json +9 -0
  17. package/package.json +1 -1
  18. package/packages/const/src/index.ts +2 -0
  19. package/packages/model-runtime/src/utils/modelParse.ts +1 -2
  20. package/packages/prompts/package.json +1 -0
  21. package/{src → packages/prompts/src}/chains/__tests__/langDetect.test.ts +1 -2
  22. package/{src → packages/prompts/src}/chains/__tests__/pickEmoji.test.ts +1 -2
  23. package/{src → packages/prompts/src}/chains/__tests__/summaryAgentName.test.ts +2 -15
  24. package/{src → packages/prompts/src}/chains/__tests__/summaryDescription.test.ts +2 -12
  25. package/{src → packages/prompts/src}/chains/__tests__/summaryHistory.test.ts +1 -5
  26. package/{src → packages/prompts/src}/chains/__tests__/summaryTags.test.ts +1 -14
  27. package/{src → packages/prompts/src}/chains/__tests__/summaryTitle.test.ts +2 -11
  28. package/{src → packages/prompts/src}/chains/abstractChunk.ts +2 -2
  29. package/{src → packages/prompts/src}/chains/answerWithContext.ts +1 -1
  30. package/packages/prompts/src/chains/index.ts +12 -0
  31. package/{src → packages/prompts/src}/chains/langDetect.ts +1 -1
  32. package/{src → packages/prompts/src}/chains/pickEmoji.ts +1 -1
  33. package/{src → packages/prompts/src}/chains/rewriteQuery.ts +2 -2
  34. package/{src → packages/prompts/src}/chains/summaryAgentName.ts +6 -5
  35. package/{src → packages/prompts/src}/chains/summaryDescription.ts +7 -5
  36. package/{src → packages/prompts/src}/chains/summaryGenerationTitle.ts +3 -5
  37. package/{src → packages/prompts/src}/chains/summaryHistory.ts +2 -3
  38. package/{src → packages/prompts/src}/chains/summaryTags.ts +3 -4
  39. package/{src → packages/prompts/src}/chains/summaryTitle.ts +5 -5
  40. package/{src → packages/prompts/src}/chains/translate.ts +1 -1
  41. package/packages/prompts/src/index.ts +2 -5
  42. package/packages/prompts/src/{files → prompts/files}/index.test.ts +1 -2
  43. package/packages/prompts/src/prompts/index.ts +5 -0
  44. package/packages/prompts/src/{knowledgeBaseQA → prompts/knowledgeBaseQA}/index.test.ts +1 -3
  45. package/packages/types/src/index.ts +3 -0
  46. package/src/features/AgentSetting/store/action.ts +19 -7
  47. package/src/server/routers/async/ragEval.ts +1 -1
  48. package/src/store/chat/slices/aiChat/actions/memory.ts +1 -1
  49. package/src/store/chat/slices/aiChat/actions/rag.ts +1 -1
  50. package/src/store/chat/slices/thread/action.ts +3 -2
  51. package/src/store/chat/slices/topic/action.ts +3 -2
  52. package/src/store/chat/slices/translate/action.test.ts +2 -2
  53. package/src/store/chat/slices/translate/action.ts +1 -2
  54. package/src/store/image/slices/generationTopic/action.ts +6 -2
  55. package/tsconfig.json +1 -1
  56. package/.github/workflows/claude-code-review.yml +0 -78
  57. package/.github/workflows/wiki-sync.yml +0 -19
  58. /package/{src → packages/prompts/src}/chains/__tests__/__snapshots__/summaryHistory.test.ts.snap +0 -0
  59. /package/{src → packages/prompts/src}/chains/__tests__/translate.test.ts +0 -0
  60. /package/packages/prompts/src/{chatMessages → prompts/chatMessages}/index.test.ts +0 -0
  61. /package/packages/prompts/src/{chatMessages → prompts/chatMessages}/index.ts +0 -0
  62. /package/packages/prompts/src/{files → prompts/files}/file.ts +0 -0
  63. /package/packages/prompts/src/{files → prompts/files}/image.ts +0 -0
  64. /package/packages/prompts/src/{files → prompts/files}/index.ts +0 -0
  65. /package/packages/prompts/src/{knowledgeBaseQA → prompts/knowledgeBaseQA}/__snapshots__/index.test.ts.snap +0 -0
  66. /package/packages/prompts/src/{knowledgeBaseQA → prompts/knowledgeBaseQA}/chunk.ts +0 -0
  67. /package/packages/prompts/src/{knowledgeBaseQA → prompts/knowledgeBaseQA}/index.ts +0 -0
  68. /package/packages/prompts/src/{knowledgeBaseQA → prompts/knowledgeBaseQA}/knowledge.ts +0 -0
  69. /package/packages/prompts/src/{knowledgeBaseQA → prompts/knowledgeBaseQA}/userQuery.ts +0 -0
  70. /package/packages/prompts/src/{plugin → prompts/plugin}/index.test.ts +0 -0
  71. /package/packages/prompts/src/{plugin → prompts/plugin}/index.ts +0 -0
  72. /package/packages/prompts/src/{plugin → prompts/plugin}/tools.test.ts +0 -0
  73. /package/packages/prompts/src/{plugin → prompts/plugin}/tools.ts +0 -0
  74. /package/packages/prompts/src/{systemRole → prompts/systemRole}/index.ts +0 -0
package/.eslintignore CHANGED
@@ -29,3 +29,20 @@ logs
29
29
  # misc
30
30
  # add other ignore file below
31
31
  .next
32
+
33
+ # temporary directories
34
+ tmp
35
+ temp
36
+ .temp
37
+ .local
38
+ docs/.local
39
+
40
+ # cache directories
41
+ .cache
42
+
43
+ # AI coding tools directories
44
+ .claude
45
+ .serena
46
+
47
+ # MCP tools
48
+ /.serena/**
@@ -21,7 +21,7 @@ jobs:
21
21
  git config --global user.name "lobehubbot"
22
22
  git config --global user.email "i@lobehub.com"
23
23
 
24
- - uses: actions/checkout@v4
24
+ - uses: actions/checkout@v5
25
25
  with:
26
26
  ref: ${{ github.event.pull_request.head.ref }}
27
27
 
@@ -26,7 +26,7 @@ jobs:
26
26
  actions: read # Required for Claude to read CI results on PRs
27
27
  steps:
28
28
  - name: Checkout repository
29
- uses: actions/checkout@v4
29
+ uses: actions/checkout@v5
30
30
  with:
31
31
  fetch-depth: 1
32
32
 
@@ -23,7 +23,7 @@ jobs:
23
23
  runs-on: ubuntu-latest # 只在 ubuntu 上运行一次检查
24
24
  steps:
25
25
  - name: Checkout base
26
- uses: actions/checkout@v4
26
+ uses: actions/checkout@v5
27
27
  with:
28
28
  fetch-depth: 0
29
29
 
@@ -56,7 +56,7 @@ jobs:
56
56
  # 输出版本信息,供后续 job 使用
57
57
  version: ${{ steps.set_version.outputs.version }}
58
58
  steps:
59
- - uses: actions/checkout@v4
59
+ - uses: actions/checkout@v5
60
60
  with:
61
61
  fetch-depth: 0
62
62
 
@@ -95,7 +95,7 @@ jobs:
95
95
  matrix:
96
96
  os: [macos-latest, windows-2025, ubuntu-latest]
97
97
  steps:
98
- - uses: actions/checkout@v4
98
+ - uses: actions/checkout@v5
99
99
  with:
100
100
  fetch-depth: 0
101
101
 
@@ -196,7 +196,7 @@ jobs:
196
196
  outputs:
197
197
  artifact_path: ${{ steps.set_path.outputs.path }}
198
198
  steps:
199
- - uses: actions/checkout@v4
199
+ - uses: actions/checkout@v5
200
200
  with:
201
201
  fetch-depth: 0
202
202
 
@@ -39,7 +39,7 @@ jobs:
39
39
  echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
40
40
 
41
41
  - name: Checkout base
42
- uses: actions/checkout@v4
42
+ uses: actions/checkout@v5
43
43
  with:
44
44
  fetch-depth: 0
45
45
 
@@ -80,7 +80,7 @@ jobs:
80
80
 
81
81
  - name: Build and export
82
82
  id: build
83
- uses: docker/build-push-action@v5
83
+ uses: docker/build-push-action@v6
84
84
  with:
85
85
  platforms: ${{ matrix.platform }}
86
86
  context: .
@@ -111,7 +111,7 @@ jobs:
111
111
  runs-on: ubuntu-latest
112
112
  steps:
113
113
  - name: Checkout base
114
- uses: actions/checkout@v4
114
+ uses: actions/checkout@v5
115
115
  with:
116
116
  fetch-depth: 0
117
117
 
@@ -39,7 +39,7 @@ jobs:
39
39
  echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
40
40
 
41
41
  - name: Checkout base
42
- uses: actions/checkout@v4
42
+ uses: actions/checkout@v5
43
43
  with:
44
44
  fetch-depth: 0
45
45
 
@@ -80,7 +80,7 @@ jobs:
80
80
 
81
81
  - name: Build and export
82
82
  id: build
83
- uses: docker/build-push-action@v5
83
+ uses: docker/build-push-action@v6
84
84
  with:
85
85
  platforms: ${{ matrix.platform }}
86
86
  context: .
@@ -111,7 +111,7 @@ jobs:
111
111
  runs-on: ubuntu-latest
112
112
  steps:
113
113
  - name: Checkout base
114
- uses: actions/checkout@v4
114
+ uses: actions/checkout@v5
115
115
  with:
116
116
  fetch-depth: 0
117
117
 
@@ -39,7 +39,7 @@ jobs:
39
39
  echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
40
40
 
41
41
  - name: Checkout base
42
- uses: actions/checkout@v4
42
+ uses: actions/checkout@v5
43
43
  with:
44
44
  fetch-depth: 0
45
45
 
@@ -80,7 +80,7 @@ jobs:
80
80
 
81
81
  - name: Build and export
82
82
  id: build
83
- uses: docker/build-push-action@v5
83
+ uses: docker/build-push-action@v6
84
84
  with:
85
85
  platforms: ${{ matrix.platform }}
86
86
  context: .
@@ -111,7 +111,7 @@ jobs:
111
111
  runs-on: ubuntu-latest
112
112
  steps:
113
113
  - name: Checkout base
114
- uses: actions/checkout@v4
114
+ uses: actions/checkout@v5
115
115
  with:
116
116
  fetch-depth: 0
117
117
 
@@ -42,12 +42,12 @@ jobs:
42
42
  echo "BRANCH=$BRANCH" >> $GITHUB_ENV
43
43
  env:
44
44
  REPO_BRANCH: ${{ matrix.REPO_BRANCH || env.REPO_BRANCH }}
45
- - uses: actions/checkout@v4
45
+ - uses: actions/checkout@v5
46
46
  with:
47
47
  repository: ${{ env.REPOSITORY }}
48
48
  token: ${{ secrets[matrix.TOKEN_NAME] || secrets[env.TOKEN_NAME] }}
49
49
  ref: ${{ env.BRANCH }}
50
- - uses: actions/checkout@v4
50
+ - uses: actions/checkout@v5
51
51
  with:
52
52
  repository: 'myactionway/lighthouse-badges'
53
53
  path: temp_lighthouse_badges_nested
@@ -19,7 +19,7 @@ jobs:
19
19
  runs-on: ubuntu-latest # 只在 ubuntu 上运行一次检查
20
20
  steps:
21
21
  - name: Checkout base
22
- uses: actions/checkout@v4
22
+ uses: actions/checkout@v5
23
23
  with:
24
24
  fetch-depth: 0
25
25
 
@@ -47,7 +47,7 @@ jobs:
47
47
  version: ${{ steps.set_version.outputs.version }}
48
48
  is_pr_build: ${{ steps.set_version.outputs.is_pr_build }}
49
49
  steps:
50
- - uses: actions/checkout@v4
50
+ - uses: actions/checkout@v5
51
51
  with:
52
52
  fetch-depth: 0
53
53
 
@@ -82,7 +82,7 @@ jobs:
82
82
  matrix:
83
83
  os: [macos-latest, windows-2025, ubuntu-latest]
84
84
  steps:
85
- - uses: actions/checkout@v4
85
+ - uses: actions/checkout@v5
86
86
  with:
87
87
  fetch-depth: 0
88
88
 
@@ -11,7 +11,7 @@ jobs:
11
11
 
12
12
  services:
13
13
  postgres:
14
- image: pgvector/pgvector:pg16
14
+ image: pgvector/pgvector:pg17
15
15
  env:
16
16
  POSTGRES_PASSWORD: postgres
17
17
  options: >-
@@ -20,7 +20,7 @@ jobs:
20
20
  - 5432:5432
21
21
 
22
22
  steps:
23
- - uses: actions/checkout@v4
23
+ - uses: actions/checkout@v5
24
24
 
25
25
  - name: Setup Node.js
26
26
  uses: actions/setup-node@v4
@@ -11,7 +11,7 @@ jobs:
11
11
  build:
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
- - uses: actions/checkout@v4
14
+ - uses: actions/checkout@v5
15
15
 
16
16
  - name: Install dbdocs
17
17
  run: sudo npm install -g dbdocs
@@ -17,7 +17,7 @@ jobs:
17
17
  if: ${{ github.event.repository.fork }}
18
18
 
19
19
  steps:
20
- - uses: actions/checkout@v4
20
+ - uses: actions/checkout@v5
21
21
 
22
22
  - name: Clean issue notice
23
23
  uses: actions-cool/issues-helper@v3
@@ -19,7 +19,7 @@ jobs:
19
19
  - 5432:5432
20
20
 
21
21
  steps:
22
- - uses: actions/checkout@v4
22
+ - uses: actions/checkout@v5
23
23
 
24
24
  - name: Setup Node.js
25
25
  uses: actions/setup-node@v4
@@ -0,0 +1,39 @@
1
+ # Stylelintignore for LobeHub
2
+ ################################################################
3
+
4
+ # dependencies
5
+ node_modules
6
+
7
+ # ci
8
+ coverage
9
+ .coverage
10
+
11
+ # production
12
+ dist
13
+ es
14
+ lib
15
+ logs
16
+
17
+ # framework specific
18
+ .next
19
+ .umi
20
+ .umi-production
21
+ .umi-test
22
+ .dumi/tmp*
23
+
24
+ # temporary directories
25
+ tmp
26
+ temp
27
+ .temp
28
+ .local
29
+ docs/.local
30
+
31
+ # cache directories
32
+ .cache
33
+
34
+ # AI coding tools directories
35
+ .claude
36
+ .serena
37
+
38
+ # MCP tools
39
+ /.serena/**
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.114.1](https://github.com/lobehub/lobe-chat/compare/v1.114.0...v1.114.1)
6
+
7
+ <sup>Released on **2025-08-21**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: Move chain into `@lobechat/prompts`.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **misc**: Move chain into `@lobechat/prompts`, closes [#8875](https://github.com/lobehub/lobe-chat/issues/8875) ([c576b97](https://github.com/lobehub/lobe-chat/commit/c576b97))
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.114.0](https://github.com/lobehub/lobe-chat/compare/v1.113.3...v1.114.0)
6
31
 
7
32
  <sup>Released on **2025-08-19**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,13 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "improvements": [
5
+ "Move chain into @lobechat/prompts."
6
+ ]
7
+ },
8
+ "date": "2025-08-21",
9
+ "version": "1.114.1"
10
+ },
2
11
  {
3
12
  "children": {},
4
13
  "date": "2025-08-19",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.114.0",
3
+ "version": "1.114.1",
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",
@@ -0,0 +1,2 @@
1
+ export * from './settings';
2
+ export * from './version';
@@ -358,8 +358,7 @@ export const processMultiProviderModelList = async (
358
358
  let providerLocalConfig: any[] | null = null;
359
359
  if (providerid) {
360
360
  try {
361
- const modulePath = `@/config/aiModels/${providerid}`;
362
- const moduleImport = await import(modulePath);
361
+ const moduleImport = await import(`@/config/aiModels/${providerid}`);
363
362
  providerLocalConfig = moduleImport.default;
364
363
  } catch {
365
364
  // 如果配置文件不存在或导入失败,保持为 null
@@ -4,6 +4,7 @@
4
4
  "private": true,
5
5
  "main": "./src/index.ts",
6
6
  "dependencies": {
7
+ "@lobechat/const": "workspace:*",
7
8
  "@lobechat/types": "workspace:*"
8
9
  }
9
10
  }
@@ -1,7 +1,6 @@
1
+ import { ChatStreamPayload } from '@lobechat/types';
1
2
  import { describe, expect, it } from 'vitest';
2
3
 
3
- import { ChatStreamPayload } from '@/types/openai/chat';
4
-
5
4
  import { chainLangDetect } from '../langDetect';
6
5
 
7
6
  // 描述测试块
@@ -1,7 +1,6 @@
1
+ import { ChatStreamPayload } from '@lobechat/types';
1
2
  import { describe, expect, it } from 'vitest';
2
3
 
3
- import { ChatStreamPayload } from '@/types/openai/chat';
4
-
5
4
  import { chainPickEmoji } from '../pickEmoji';
6
5
 
7
6
  // 描述测试块
@@ -1,25 +1,15 @@
1
- import { Mock, describe, expect, it } from 'vitest';
2
-
3
- import { globalHelpers } from '@/store/global/helpers';
1
+ import { describe, expect, it } from 'vitest';
4
2
 
5
3
  import { chainSummaryAgentName } from '../summaryAgentName';
6
4
 
7
- // Mock the getCurrentLanguage function
8
- vi.mock('@/store/global/helpers', () => ({
9
- globalHelpers: {
10
- getCurrentLanguage: vi.fn(),
11
- },
12
- }));
13
-
14
5
  describe('chainSummaryAgentName', () => {
15
6
  it('should create a payload with system and user messages including the provided content and current language', () => {
16
7
  // Arrange
17
8
  const content = '这是一段测试文本';
18
9
  const currentLanguage = 'en-US';
19
- (globalHelpers.getCurrentLanguage as Mock).mockReturnValue(currentLanguage);
20
10
 
21
11
  // Act
22
- const result = chainSummaryAgentName(content);
12
+ const result = chainSummaryAgentName(content, currentLanguage);
23
13
 
24
14
  // Assert
25
15
  expect(result).toEqual({
@@ -50,8 +40,5 @@ describe('chainSummaryAgentName', () => {
50
40
  { content: `输入: {${content}} [${currentLanguage}]`, role: 'user' },
51
41
  ],
52
42
  });
53
-
54
- // Verify that the getCurrentLanguage function was called
55
- expect(globalHelpers.getCurrentLanguage).toHaveBeenCalled();
56
43
  });
57
44
  });
@@ -4,13 +4,6 @@ import { globalHelpers } from '@/store/global/helpers';
4
4
 
5
5
  import { chainSummaryDescription } from '../summaryDescription';
6
6
 
7
- // Mock the globalHelpers.getCurrentLanguage function
8
- vi.mock('@/store/global/helpers', () => ({
9
- globalHelpers: {
10
- getCurrentLanguage: vi.fn(() => 'en-US'),
11
- },
12
- }));
13
-
14
7
  describe('chainSummaryDescription', () => {
15
8
  it('should return a payload with the correct structure and content based on the input', () => {
16
9
  const inputContent = '你是一个专业的JavaScript开发者';
@@ -64,17 +57,14 @@ nav: API
64
57
  temperature: 0,
65
58
  };
66
59
 
67
- const result = chainSummaryDescription(inputContent);
60
+ const result = chainSummaryDescription(inputContent, 'en-US');
68
61
 
69
62
  expect(result).toEqual(expectedOutput);
70
63
  });
71
64
 
72
65
  it('should handle different languages', () => {
73
- // Override the getCurrentLanguage mock to return a different language
74
- (globalHelpers.getCurrentLanguage as Mock).mockReturnValueOnce('zh-CN');
75
-
76
66
  const inputContent = '你是一个专业的JavaScript开发者';
77
- const result = chainSummaryDescription(inputContent);
67
+ const result = chainSummaryDescription(inputContent, 'zh-CN');
78
68
 
79
69
  // Verify that the language in the output matches the mocked language
80
70
  expect(result.messages![0].content).toContain('翻译为目标语言:zh-CN');
@@ -1,10 +1,6 @@
1
+ import { ChatMessage } from '@lobechat/types';
1
2
  import { Mock, describe, expect, it, vi } from 'vitest';
2
3
 
3
- import { chatHelpers } from '@/store/chat/helpers';
4
- import { globalHelpers } from '@/store/global/helpers';
5
- import { ChatMessage } from '@/types/message';
6
- import { OpenAIChatMessage } from '@/types/openai/chat';
7
-
8
4
  import { chainSummaryHistory } from '../summaryHistory';
9
5
 
10
6
  describe('chainSummaryHistory', () => {
@@ -1,25 +1,15 @@
1
1
  import { Mock, describe, expect, it } from 'vitest';
2
2
 
3
- import { globalHelpers } from '@/store/global/helpers';
4
-
5
3
  import { chainSummaryTags } from '../summaryTags';
6
4
 
7
- // Mock the getCurrentLanguage function
8
- vi.mock('@/store/global/helpers', () => ({
9
- globalHelpers: {
10
- getCurrentLanguage: vi.fn(),
11
- },
12
- }));
13
-
14
5
  describe('chainSummaryTags', () => {
15
6
  it('should create a payload with system and user messages including the provided content and current language', () => {
16
7
  // Arrange
17
8
  const content = '这是一段测试文本';
18
9
  const currentLanguage = 'en-US';
19
- (globalHelpers.getCurrentLanguage as Mock).mockReturnValue(currentLanguage);
20
10
 
21
11
  // Act
22
- const result = chainSummaryTags(content);
12
+ const result = chainSummaryTags(content, currentLanguage);
23
13
 
24
14
  // Assert
25
15
  expect(result).toEqual({
@@ -47,8 +37,5 @@ describe('chainSummaryTags', () => {
47
37
  { content: `输入: {${content}} [${currentLanguage}]`, role: 'user' },
48
38
  ],
49
39
  });
50
-
51
- // Verify that the getCurrentLanguage function was called
52
- expect(globalHelpers.getCurrentLanguage).toHaveBeenCalled();
53
40
  });
54
41
  });
@@ -1,18 +1,10 @@
1
+ import { OpenAIChatMessage } from '@lobechat/types';
1
2
  import { Mock, describe, expect, it, vi } from 'vitest';
2
3
 
3
4
  import { chatHelpers } from '@/store/chat/helpers';
4
- import { globalHelpers } from '@/store/global/helpers';
5
- import { OpenAIChatMessage } from '@/types/openai/chat';
6
5
 
7
6
  import { chainSummaryTitle } from '../summaryTitle';
8
7
 
9
- // Mock the getCurrentLanguage function
10
- vi.mock('@/store/global/helpers', () => ({
11
- globalHelpers: {
12
- getCurrentLanguage: vi.fn(),
13
- },
14
- }));
15
-
16
8
  // Mock the chatHelpers.getMessagesTokenCount function
17
9
  vi.mock('@/store/chat/helpers', () => ({
18
10
  chatHelpers: {
@@ -29,11 +21,10 @@ describe('chainSummaryTitle', () => {
29
21
  ];
30
22
  const currentLanguage = 'en-US';
31
23
  const tokenCount = 10000; // Arbitrary token count below the GPT-3.5 limit
32
- (globalHelpers.getCurrentLanguage as Mock).mockReturnValue(currentLanguage);
33
24
  (chatHelpers.getMessagesTokenCount as Mock).mockResolvedValue(tokenCount);
34
25
 
35
26
  // Act
36
- const result = await chainSummaryTitle(messages);
27
+ const result = await chainSummaryTitle(messages, currentLanguage);
37
28
 
38
29
  // Assert
39
30
  expect(result).toEqual({
@@ -1,5 +1,5 @@
1
- import { DEFAULT_MODEL } from '@/const/settings';
2
- import { ChatStreamPayload } from '@/types/openai/chat';
1
+ import { DEFAULT_MODEL } from '@lobechat/const';
2
+ import { ChatStreamPayload } from '@lobechat/types';
3
3
 
4
4
  export const chainAbstractChunkText = (text: string): Partial<ChatStreamPayload> => {
5
5
  return {
@@ -1,4 +1,4 @@
1
- import { ChatStreamPayload } from '@/types/openai/chat';
1
+ import { ChatStreamPayload } from '@lobechat/types';
2
2
 
3
3
  export const chainAnswerWithContext = ({
4
4
  context,
@@ -0,0 +1,12 @@
1
+ export * from './abstractChunk';
2
+ export * from './answerWithContext';
3
+ export * from './langDetect';
4
+ export * from './pickEmoji';
5
+ export * from './rewriteQuery';
6
+ export * from './summaryAgentName';
7
+ export * from './summaryDescription';
8
+ export * from './summaryGenerationTitle';
9
+ export * from './summaryHistory';
10
+ export * from './summaryTags';
11
+ export * from './summaryTitle';
12
+ export * from './translate';
@@ -1,4 +1,4 @@
1
- import { ChatStreamPayload } from '@/types/openai/chat';
1
+ import { ChatStreamPayload } from '@lobechat/types';
2
2
 
3
3
  export const chainLangDetect = (content: string): Partial<ChatStreamPayload> => ({
4
4
  messages: [
@@ -1,4 +1,4 @@
1
- import { ChatStreamPayload } from '@/types/openai/chat';
1
+ import { ChatStreamPayload } from '@lobechat/types';
2
2
 
3
3
  /**
4
4
  * pick emoji for user prompt
@@ -1,5 +1,5 @@
1
- import { DEFAULT_REWRITE_QUERY } from '@/const/settings';
2
- import { ChatStreamPayload } from '@/types/openai/chat';
1
+ import { DEFAULT_REWRITE_QUERY } from '@lobechat/const';
2
+ import { ChatStreamPayload } from '@lobechat/types';
3
3
 
4
4
  export const chainRewriteQuery = (
5
5
  query: string,
@@ -1,11 +1,12 @@
1
- import { globalHelpers } from '@/store/global/helpers';
2
- import { ChatStreamPayload } from '@/types/openai/chat';
1
+ import { ChatStreamPayload } from '@lobechat/types';
3
2
 
4
3
  /**
5
4
  * summary agent name for user prompt
6
- * @param content
7
5
  */
8
- export const chainSummaryAgentName = (content: string): Partial<ChatStreamPayload> => ({
6
+ export const chainSummaryAgentName = (
7
+ content: string,
8
+ locale: string,
9
+ ): Partial<ChatStreamPayload> => ({
9
10
  messages: [
10
11
  {
11
12
  content: `你是一名擅长起名的起名大师,名字需要有文学内涵,注重精炼和赋子意境,你需要将用户的描述总结为 10 个字以内的角色,并翻译为目标语言。格式要求如下:\n输入: {文本作为JSON引用字符串} [locale]\n输出: {角色名}`,
@@ -30,6 +31,6 @@ export const chainSummaryAgentName = (content: string): Partial<ChatStreamPayloa
30
31
  role: 'user',
31
32
  },
32
33
  { content: '邮件优化助理', role: 'assistant' },
33
- { content: `输入: {${content}} [${globalHelpers.getCurrentLanguage()}]`, role: 'user' },
34
+ { content: `输入: {${content}} [${locale}]`, role: 'user' },
34
35
  ],
35
36
  });
@@ -1,10 +1,12 @@
1
- import { globalHelpers } from '@/store/global/helpers';
2
- import { ChatStreamPayload } from '@/types/openai/chat';
1
+ import { ChatStreamPayload } from '@lobechat/types';
3
2
 
4
- export const chainSummaryDescription = (content: string): Partial<ChatStreamPayload> => ({
3
+ export const chainSummaryDescription = (
4
+ content: string,
5
+ locale: string,
6
+ ): Partial<ChatStreamPayload> => ({
5
7
  messages: [
6
8
  {
7
- content: `你是一名擅长技能总结的助理,你需要将用户的输入的内容总结为一个角色技能简介,不超过 20 个字。内容需要确保信息清晰、逻辑清晰,并有效地传达角色的技能和经验,需要并翻译为目标语言:${globalHelpers.getCurrentLanguage()}。格式要求如下:\n输入: {文本作为JSON引用字符串} [locale]\n输出: {简介}`,
9
+ content: `你是一名擅长技能总结的助理,你需要将用户的输入的内容总结为一个角色技能简介,不超过 20 个字。内容需要确保信息清晰、逻辑清晰,并有效地传达角色的技能和经验,需要并翻译为目标语言:${locale}。格式要求如下:\n输入: {文本作为JSON引用字符串} [locale]\n输出: {简介}`,
8
10
  role: 'system',
9
11
  },
10
12
  {
@@ -43,7 +45,7 @@ nav: API
43
45
  role: 'user',
44
46
  },
45
47
  { content: '擅长创业计划撰写与咨询', role: 'assistant' },
46
- { content: `输入: {${content}} [${globalHelpers.getCurrentLanguage()}]`, role: 'user' },
48
+ { content: `输入: {${content}} [${locale}]`, role: 'user' },
47
49
  ],
48
50
  temperature: 0,
49
51
  });
@@ -1,19 +1,17 @@
1
- import { globalHelpers } from '@/store/global/helpers';
2
- import { ChatStreamPayload } from '@/types/openai/chat';
1
+ import { ChatStreamPayload } from '@lobechat/types';
3
2
 
4
3
  export const chainSummaryGenerationTitle = (
5
4
  prompts: string[],
6
5
  modal: 'image' | 'video',
6
+ locale: string,
7
7
  ): Partial<ChatStreamPayload> => {
8
- const lang = globalHelpers.getCurrentLanguage();
9
-
10
8
  // Format multiple prompts for better readability
11
9
  const formattedPrompts = prompts.map((prompt, index) => `${index + 1}. ${prompt}`).join('\n');
12
10
 
13
11
  return {
14
12
  messages: [
15
13
  {
16
- content: `你是一位资深的 AI 艺术创作者和语言大师。你需要根据用户提供的 AI ${modal} prompt 总结出一个标题。这个标题应简洁地描述创作的核心内容,将用于标识和管理该系列作品。字数需控制在10个字以内,不需要包含标点符号,输出语言为:${lang}。`,
14
+ content: `你是一位资深的 AI 艺术创作者和语言大师。你需要根据用户提供的 AI ${modal} prompt 总结出一个标题。这个标题应简洁地描述创作的核心内容,将用于标识和管理该系列作品。字数需控制在10个字以内,不需要包含标点符号,输出语言为:${locale}。`,
17
15
  role: 'system',
18
16
  },
19
17
  {
@@ -1,7 +1,6 @@
1
- import { chatHistoryPrompts } from '@lobechat/prompts';
2
- import { ChatMessage } from '@lobechat/types';
1
+ import { ChatMessage, ChatStreamPayload } from '@lobechat/types';
3
2
 
4
- import { ChatStreamPayload } from '@/types/openai/chat';
3
+ import { chatHistoryPrompts } from '../prompts';
5
4
 
6
5
  export const chainSummaryHistory = (messages: ChatMessage[]): Partial<ChatStreamPayload> => ({
7
6
  messages: [
@@ -1,7 +1,6 @@
1
- import { globalHelpers } from '@/store/global/helpers';
2
- import { ChatStreamPayload } from '@/types/openai/chat';
1
+ import { ChatStreamPayload } from '@lobechat/types';
3
2
 
4
- export const chainSummaryTags = (content: string): Partial<ChatStreamPayload> => ({
3
+ export const chainSummaryTags = (content: string, locale: string): Partial<ChatStreamPayload> => ({
5
4
  messages: [
6
5
  {
7
6
  content:
@@ -23,6 +22,6 @@ export const chainSummaryTags = (content: string): Partial<ChatStreamPayload> =>
23
22
  role: 'user',
24
23
  },
25
24
  { content: 'entrepreneurship,planning,consulting', role: 'assistant' },
26
- { content: `输入: {${content}} [${globalHelpers.getCurrentLanguage()}]`, role: 'user' },
25
+ { content: `输入: {${content}} [${locale}]`, role: 'user' },
27
26
  ],
28
27
  });
@@ -1,9 +1,9 @@
1
- import { globalHelpers } from '@/store/global/helpers';
2
1
  import { ChatStreamPayload, OpenAIChatMessage } from '@/types/openai/chat';
3
2
 
4
- export const chainSummaryTitle = (messages: OpenAIChatMessage[]): Partial<ChatStreamPayload> => {
5
- const lang = globalHelpers.getCurrentLanguage();
6
-
3
+ export const chainSummaryTitle = (
4
+ messages: OpenAIChatMessage[],
5
+ locale: string,
6
+ ): Partial<ChatStreamPayload> => {
7
7
  return {
8
8
  messages: [
9
9
  {
@@ -13,7 +13,7 @@ export const chainSummaryTitle = (messages: OpenAIChatMessage[]): Partial<ChatSt
13
13
  {
14
14
  content: `${messages.map((message) => `${message.role}: ${message.content}`).join('\n')}
15
15
 
16
- 请总结上述对话为10个字以内的标题,不需要包含标点符号,输出语言语种为:${lang}`,
16
+ 请总结上述对话为10个字以内的标题,不需要包含标点符号,输出语言语种为:${locale}`,
17
17
  role: 'user',
18
18
  },
19
19
  ],
@@ -1,4 +1,4 @@
1
- import { ChatStreamPayload } from '@/types/openai/chat';
1
+ import { ChatStreamPayload } from '@lobechat/types';
2
2
 
3
3
  export const chainTranslate = (
4
4
  content: string,
@@ -1,5 +1,2 @@
1
- export * from './chatMessages';
2
- export * from './files';
3
- export * from './knowledgeBaseQA';
4
- export * from './plugin';
5
- export * from './systemRole';
1
+ export * from './chains';
2
+ export * from './prompts';
@@ -1,7 +1,6 @@
1
+ import { ChatFileItem, ChatImageItem } from '@lobechat/types';
1
2
  import { describe, expect, it } from 'vitest';
2
3
 
3
- import { ChatFileItem, ChatImageItem } from '@/types/message';
4
-
5
4
  import { filesPrompts } from './index';
6
5
 
7
6
  describe('filesPrompts', () => {
@@ -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,8 +1,6 @@
1
+ import { ChatSemanticSearchChunk, KnowledgeItem, KnowledgeType } from '@lobechat/types';
1
2
  import { describe, expect, it } from 'vitest';
2
3
 
3
- import { ChatSemanticSearchChunk } from '@/types/chunk';
4
- import { KnowledgeItem, KnowledgeType } from '@/types/knowledgeBase';
5
-
6
4
  import { knowledgeBaseQAPrompts } from './index';
7
5
 
8
6
  describe('knowledgeBaseQAPrompts', () => {
@@ -3,4 +3,7 @@ export * from './chunk';
3
3
  export * from './fetch';
4
4
  export * from './knowledgeBase';
5
5
  export * from './message';
6
+ // FIXME: I think we need a refactor for the "openai" types
7
+ // it more likes the UI message payload
8
+ export * from './openai/chat';
6
9
  export * from './trace';
@@ -1,13 +1,16 @@
1
+ import {
2
+ chainPickEmoji,
3
+ chainSummaryAgentName,
4
+ chainSummaryDescription,
5
+ chainSummaryTags,
6
+ } from '@lobechat/prompts';
1
7
  import { TraceNameMap, TracePayload, TraceTopicType } from '@lobechat/types';
2
8
  import { getSingletonAnalyticsOptional } from '@lobehub/analytics';
3
9
  import type { PartialDeep } from 'type-fest';
4
10
  import { StateCreator } from 'zustand/vanilla';
5
11
 
6
- import { chainPickEmoji } from '@/chains/pickEmoji';
7
- import { chainSummaryAgentName } from '@/chains/summaryAgentName';
8
- import { chainSummaryDescription } from '@/chains/summaryDescription';
9
- import { chainSummaryTags } from '@/chains/summaryTags';
10
12
  import { chatService } from '@/services/chat';
13
+ import { globalHelpers } from '@/store/global/helpers';
11
14
  import { useUserStore } from '@/store/user';
12
15
  import { systemAgentSelectors } from '@/store/user/slices/settings/selectors';
13
16
  import { LobeAgentChatConfig, LobeAgentConfig } from '@/types/agent';
@@ -118,7 +121,10 @@ export const store: StateCreator<Store, [['zustand/devtools', never]]> = (set, g
118
121
  updateLoadingState('description', loading);
119
122
  },
120
123
  onMessageHandle: streamUpdateMetaString('description'),
121
- params: merge(get().internal_getSystemAgentForMeta(), chainSummaryDescription(systemRole)),
124
+ params: merge(
125
+ get().internal_getSystemAgentForMeta(),
126
+ chainSummaryDescription(systemRole, globalHelpers.getCurrentLanguage()),
127
+ ),
122
128
  trace: get().getCurrentTracePayload({ traceName: TraceNameMap.SummaryAgentDescription }),
123
129
  });
124
130
  },
@@ -145,7 +151,10 @@ export const store: StateCreator<Store, [['zustand/devtools', never]]> = (set, g
145
151
  onMessageHandle: streamUpdateMetaArray('tags'),
146
152
  params: merge(
147
153
  get().internal_getSystemAgentForMeta(),
148
- chainSummaryTags([meta.title, meta.description, systemRole].filter(Boolean).join(',')),
154
+ chainSummaryTags(
155
+ [meta.title, meta.description, systemRole].filter(Boolean).join(','),
156
+ globalHelpers.getCurrentLanguage(),
157
+ ),
149
158
  ),
150
159
  trace: get().getCurrentTracePayload({ traceName: TraceNameMap.SummaryAgentTags }),
151
160
  });
@@ -172,7 +181,10 @@ export const store: StateCreator<Store, [['zustand/devtools', never]]> = (set, g
172
181
  onMessageHandle: streamUpdateMetaString('title'),
173
182
  params: merge(
174
183
  get().internal_getSystemAgentForMeta(),
175
- chainSummaryAgentName([meta.description, systemRole].filter(Boolean).join(',')),
184
+ chainSummaryAgentName(
185
+ [meta.description, systemRole].filter(Boolean).join(','),
186
+ globalHelpers.getCurrentLanguage(),
187
+ ),
176
188
  ),
177
189
  trace: get().getCurrentTracePayload({ traceName: TraceNameMap.SummaryAgentTitle }),
178
190
  });
@@ -1,9 +1,9 @@
1
1
  import { ModelProvider } from '@lobechat/model-runtime';
2
+ import { chainAnswerWithContext } from '@lobechat/prompts';
2
3
  import { TRPCError } from '@trpc/server';
3
4
  import OpenAI from 'openai';
4
5
  import { z } from 'zod';
5
6
 
6
- import { chainAnswerWithContext } from '@/chains/answerWithContext';
7
7
  import { DEFAULT_EMBEDDING_MODEL, DEFAULT_MODEL } from '@/const/settings';
8
8
  import { ChunkModel } from '@/database/models/chunk';
9
9
  import { EmbeddingModel } from '@/database/models/embedding';
@@ -1,7 +1,7 @@
1
+ import { chainSummaryHistory } from '@lobechat/prompts';
1
2
  import { TraceNameMap } from '@lobechat/types';
2
3
  import { StateCreator } from 'zustand/vanilla';
3
4
 
4
- import { chainSummaryHistory } from '@/chains/summaryHistory';
5
5
  import { chatService } from '@/services/chat';
6
6
  import { topicService } from '@/services/topic';
7
7
  import { ChatStore } from '@/store/chat';
@@ -1,6 +1,6 @@
1
+ import { chainRewriteQuery } from '@lobechat/prompts';
1
2
  import { StateCreator } from 'zustand/vanilla';
2
3
 
3
- import { chainRewriteQuery } from '@/chains/rewriteQuery';
4
4
  import { chatService } from '@/services/chat';
5
5
  import { ragService } from '@/services/rag';
6
6
  import { useAgentStore } from '@/store/agent';
@@ -1,10 +1,10 @@
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 { chainSummaryTitle } from '@lobechat/prompts';
3
4
  import isEqual from 'fast-deep-equal';
4
5
  import { SWRResponse, mutate } from 'swr';
5
6
  import { StateCreator } from 'zustand/vanilla';
6
7
 
7
- import { chainSummaryTitle } from '@/chains/summaryTitle';
8
8
  import { LOADING_FLAT, THREAD_DRAFT_ID } from '@/const/message';
9
9
  import { isDeprecatedEdition } from '@/const/version';
10
10
  import { useClientDataSWR } from '@/libs/swr';
@@ -12,6 +12,7 @@ import { chatService } from '@/services/chat';
12
12
  import { threadService } from '@/services/thread';
13
13
  import { threadSelectors } from '@/store/chat/selectors';
14
14
  import { ChatStore } from '@/store/chat/store';
15
+ import { globalHelpers } from '@/store/global/helpers';
15
16
  import { useSessionStore } from '@/store/session';
16
17
  import { useUserStore } from '@/store/user';
17
18
  import { systemAgentSelectors } from '@/store/user/selectors';
@@ -280,7 +281,7 @@ export const chatThreadMessage: StateCreator<
280
281
 
281
282
  internal_updateThreadTitleInSummary(threadId, output);
282
283
  },
283
- params: merge(threadConfig, chainSummaryTitle(messages)),
284
+ params: merge(threadConfig, chainSummaryTitle(messages, globalHelpers.getCurrentLanguage())),
284
285
  });
285
286
  },
286
287
 
@@ -1,13 +1,13 @@
1
1
  /* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
2
2
  // Note: To make the code more logic and readable, we just disable the auto sort key eslint rule
3
3
  // DON'T REMOVE THE FIRST LINE
4
+ import { chainSummaryTitle } from '@lobechat/prompts';
4
5
  import { TraceNameMap } from '@lobechat/types';
5
6
  import isEqual from 'fast-deep-equal';
6
7
  import { t } from 'i18next';
7
8
  import useSWR, { SWRResponse, mutate } from 'swr';
8
9
  import { StateCreator } from 'zustand/vanilla';
9
10
 
10
- import { chainSummaryTitle } from '@/chains/summaryTitle';
11
11
  import { message } from '@/components/AntdStaticMethods';
12
12
  import { LOADING_FLAT } from '@/const/message';
13
13
  import { useClientDataSWR } from '@/libs/swr';
@@ -16,6 +16,7 @@ import { messageService } from '@/services/message';
16
16
  import { topicService } from '@/services/topic';
17
17
  import { CreateTopicParams } from '@/services/topic/type';
18
18
  import type { ChatStore } from '@/store/chat';
19
+ import { globalHelpers } from '@/store/global/helpers';
19
20
  import { useUserStore } from '@/store/user';
20
21
  import { systemAgentSelectors } from '@/store/user/selectors';
21
22
  import { ChatMessage } from '@/types/message';
@@ -167,7 +168,7 @@ export const chatTopic: StateCreator<
167
168
 
168
169
  internal_updateTopicTitleInSummary(topicId, output);
169
170
  },
170
- params: merge(topicConfig, chainSummaryTitle(messages)),
171
+ params: merge(topicConfig, chainSummaryTitle(messages, globalHelpers.getCurrentLanguage())),
171
172
  trace: get().getCurrentTracePayload({ traceName: TraceNameMap.SummaryTopicTitle, topicId }),
172
173
  });
173
174
  },
@@ -1,8 +1,8 @@
1
+ import { chainLangDetect } from '@lobechat/prompts';
2
+ import { chainTranslate } from '@lobechat/prompts';
1
3
  import { act, renderHook } from '@testing-library/react';
2
4
  import { Mock, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
3
5
 
4
- import { chainLangDetect } from '@/chains/langDetect';
5
- import { chainTranslate } from '@/chains/translate';
6
6
  import { chatService } from '@/services/chat';
7
7
  import { messageService } from '@/services/message';
8
8
  import { messageMapKey } from '@/store/chat/utils/messageMapKey';
@@ -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",
@@ -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 }}