@lobehub/chat 1.114.1 → 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 (27) hide show
  1. package/.github/workflows/test.yml +75 -13
  2. package/CHANGELOG.md +25 -0
  3. package/changelog/v1.json +9 -0
  4. package/package.json +1 -1
  5. package/packages/electron-server-ipc/package.json +2 -1
  6. package/packages/electron-server-ipc/vitest.config.ts +10 -0
  7. package/packages/file-loaders/package.json +2 -1
  8. package/packages/model-runtime/package.json +4 -0
  9. package/packages/model-runtime/src/baichuan/index.test.ts +1 -1
  10. package/packages/model-runtime/src/mistral/index.test.ts +1 -1
  11. package/packages/model-runtime/src/utils/anthropicHelpers.test.ts +1 -1
  12. package/packages/model-runtime/vitest.config.ts +16 -0
  13. package/packages/prompts/package.json +4 -0
  14. package/packages/prompts/src/chains/__tests__/summaryDescription.test.ts +2 -4
  15. package/packages/prompts/src/chains/__tests__/summaryTitle.test.ts +1 -11
  16. package/packages/prompts/src/prompts/plugin/index.test.ts +2 -0
  17. package/packages/prompts/vitest.config.ts +7 -0
  18. package/packages/types/src/index.ts +1 -0
  19. package/packages/web-crawler/package.json +4 -0
  20. package/packages/web-crawler/src/crawImpl/__tests__/jina.test.ts +1 -1
  21. package/packages/web-crawler/src/crawImpl/__tests__/search1api.test.ts +1 -1
  22. package/packages/web-crawler/src/utils/__tests__/withTimeout.test.ts +1 -1
  23. package/packages/web-crawler/src/utils/appUrlRules.test.ts +2 -0
  24. package/packages/web-crawler/src/utils/htmlToMarkdown.test.ts +1 -1
  25. package/packages/web-crawler/vitest.config.ts +7 -0
  26. package/src/app/[variants]/(main)/settings/provider/(detail)/[id]/ClientMode.tsx +4 -0
  27. package/vitest.config.ts +2 -0
@@ -2,8 +2,82 @@ name: Test CI
2
2
 
3
3
  on: [push, pull_request]
4
4
 
5
+ permissions:
6
+ contents: read
7
+
5
8
  jobs:
6
- test:
9
+ # Package tests - using each package's own test script
10
+ test-packages:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ package: [file-loaders, prompts, model-runtime, web-crawler, electron-server-ipc]
15
+
16
+ name: Test package ${{ matrix.package }}
17
+
18
+ steps:
19
+ - uses: actions/checkout@v5
20
+
21
+ - name: Setup Node.js
22
+ uses: actions/setup-node@v4
23
+ with:
24
+ node-version: 22
25
+
26
+ - uses: pnpm/action-setup@v4
27
+
28
+ - name: Install bun
29
+ uses: oven-sh/setup-bun@v1
30
+ with:
31
+ bun-version: ${{ secrets.BUN_VERSION }}
32
+
33
+ - name: Install deps
34
+ run: bun i
35
+
36
+ - name: Test ${{ matrix.package }} package with coverage
37
+ run: pnpm --filter @lobechat/${{ matrix.package }} test:coverage
38
+
39
+ - name: Upload ${{ matrix.package }} coverage to Codecov
40
+ uses: codecov/codecov-action@v4
41
+ with:
42
+ token: ${{ secrets.CODECOV_TOKEN }}
43
+ files: ./packages/${{ matrix.package }}/coverage/lcov.info
44
+ flags: packages/${{ matrix.package }}
45
+
46
+ # App tests
47
+ test-website:
48
+ name: Test Website
49
+
50
+ runs-on: ubuntu-latest
51
+
52
+ steps:
53
+ - uses: actions/checkout@v5
54
+
55
+ - name: Setup Node.js
56
+ uses: actions/setup-node@v4
57
+ with:
58
+ node-version: 22
59
+
60
+ - name: Install bun
61
+ uses: oven-sh/setup-bun@v1
62
+ with:
63
+ bun-version: ${{ secrets.BUN_VERSION }}
64
+
65
+ - name: Install deps
66
+ run: bun i
67
+
68
+ - name: Test App Coverage
69
+ run: bun run test-app:coverage
70
+
71
+ - name: Upload App Coverage to Codecov
72
+ uses: codecov/codecov-action@v4
73
+ with:
74
+ token: ${{ secrets.CODECOV_TOKEN }}
75
+ files: ./coverage/app/lcov.info
76
+ flags: app
77
+
78
+ test-server:
79
+ name: Test Database
80
+
7
81
  runs-on: ubuntu-latest
8
82
 
9
83
  services:
@@ -13,8 +87,6 @@ jobs:
13
87
  POSTGRES_PASSWORD: postgres
14
88
  options: >-
15
89
  --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
16
-
17
-
18
90
  ports:
19
91
  - 5432:5432
20
92
 
@@ -53,13 +125,3 @@ jobs:
53
125
  token: ${{ secrets.CODECOV_TOKEN }}
54
126
  files: ./coverage/server/lcov.info
55
127
  flags: server
56
-
57
- - name: Test App Coverage
58
- run: bun run test-app:coverage
59
-
60
- - name: Upload App Coverage to Codecov
61
- uses: codecov/codecov-action@v4
62
- with:
63
- token: ${{ secrets.CODECOV_TOKEN }}
64
- files: ./coverage/app/lcov.info
65
- flags: app
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.114.2](https://github.com/lobehub/lobe-chat/compare/v1.114.1...v1.114.2)
6
+
7
+ <sup>Released on **2025-08-21**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Can't load custom provider config.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Can't load custom provider config, closes [#8880](https://github.com/lobehub/lobe-chat/issues/8880) ([9ec3315](https://github.com/lobehub/lobe-chat/commit/9ec3315))
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.1](https://github.com/lobehub/lobe-chat/compare/v1.114.0...v1.114.1)
6
31
 
7
32
  <sup>Released on **2025-08-21**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,13 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "fixes": [
5
+ "Can't load custom provider config."
6
+ ]
7
+ },
8
+ "date": "2025-08-21",
9
+ "version": "1.114.2"
10
+ },
2
11
  {
3
12
  "children": {
4
13
  "improvements": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.114.1",
3
+ "version": "1.114.2",
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",
@@ -5,7 +5,8 @@
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
7
7
  "scripts": {
8
- "test": "vitest"
8
+ "test": "vitest",
9
+ "test:coverage": "vitest --coverage"
9
10
  },
10
11
  "dependencies": {
11
12
  "debug": "^4.3.4"
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ coverage: {
6
+ all: false,
7
+ },
8
+ environment: 'node',
9
+ },
10
+ });
@@ -21,7 +21,8 @@
21
21
  "sideEffects": false,
22
22
  "main": "./src/index.ts",
23
23
  "scripts": {
24
- "test": "vitest"
24
+ "test": "vitest",
25
+ "test:coverage": "vitest --coverage"
25
26
  },
26
27
  "dependencies": {
27
28
  "@langchain/community": "^0.3.41",
@@ -3,6 +3,10 @@
3
3
  "version": "1.0.0",
4
4
  "private": true,
5
5
  "main": "./src/index.ts",
6
+ "scripts": {
7
+ "test": "vitest",
8
+ "test:coverage": "vitest --coverage"
9
+ },
6
10
  "dependencies": {
7
11
  "@aws-sdk/client-bedrock-runtime": "^3.862.0",
8
12
  "@lobechat/types": "workspace:*",
@@ -1,5 +1,5 @@
1
1
  // @vitest-environment node
2
- import { Mock } from 'vitest';
2
+ import { Mock, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
3
3
 
4
4
  import { LobeOpenAICompatibleRuntime, ModelProvider } from '@/libs/model-runtime';
5
5
 
@@ -1,5 +1,5 @@
1
1
  // @vitest-environment node
2
- import { Mock, afterEach, beforeEach, expect, it, vi } from 'vitest';
2
+ import { Mock, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
3
3
 
4
4
  import { LobeOpenAICompatibleRuntime } from '@/libs/model-runtime';
5
5
  import { testProvider } from '@/libs/model-runtime/providerTestUtils';
@@ -1,5 +1,5 @@
1
1
  import { OpenAI } from 'openai';
2
- import { describe, expect, it } from 'vitest';
2
+ import { describe, expect, it, vi } from 'vitest';
3
3
 
4
4
  import { imageUrlToBase64 } from '@/utils/imageToBase64';
5
5
 
@@ -0,0 +1,16 @@
1
+ import { resolve } from 'node:path';
2
+ import { defineConfig } from 'vitest/config';
3
+
4
+ export default defineConfig({
5
+ test: {
6
+ alias: {
7
+ /* eslint-disable sort-keys-fix/sort-keys-fix */
8
+ '@/libs/model-runtime': resolve(__dirname, './src'),
9
+ '@/types': resolve(__dirname, '../types/src'),
10
+ '@/const': resolve(__dirname, '../const/src'),
11
+ '@': resolve(__dirname, '../../src'),
12
+ /* eslint-enable */
13
+ },
14
+ environment: 'happy-dom',
15
+ },
16
+ });
@@ -3,6 +3,10 @@
3
3
  "version": "1.0.0",
4
4
  "private": true,
5
5
  "main": "./src/index.ts",
6
+ "scripts": {
7
+ "test": "vitest",
8
+ "test:coverage": "vitest --coverage"
9
+ },
6
10
  "dependencies": {
7
11
  "@lobechat/const": "workspace:*",
8
12
  "@lobechat/types": "workspace:*"
@@ -1,6 +1,4 @@
1
- import { Mock, describe, expect, it, vi } from 'vitest';
2
-
3
- import { globalHelpers } from '@/store/global/helpers';
1
+ import { describe, expect, it } from 'vitest';
4
2
 
5
3
  import { chainSummaryDescription } from '../summaryDescription';
6
4
 
@@ -10,7 +8,7 @@ describe('chainSummaryDescription', () => {
10
8
  const expectedOutput = {
11
9
  messages: [
12
10
  {
13
- content: `你是一名擅长技能总结的助理,你需要将用户的输入的内容总结为一个角色技能简介,不超过 20 个字。内容需要确保信息清晰、逻辑清晰,并有效地传达角色的技能和经验,需要并翻译为目标语言:${globalHelpers.getCurrentLanguage()}。格式要求如下:\n输入: {文本作为JSON引用字符串} [locale]\n输出: {简介}`,
11
+ content: `你是一名擅长技能总结的助理,你需要将用户的输入的内容总结为一个角色技能简介,不超过 20 个字。内容需要确保信息清晰、逻辑清晰,并有效地传达角色的技能和经验,需要并翻译为目标语言:en-US。格式要求如下:\n输入: {文本作为JSON引用字符串} [locale]\n输出: {简介}`,
14
12
  role: 'system',
15
13
  },
16
14
  {
@@ -1,17 +1,8 @@
1
1
  import { OpenAIChatMessage } from '@lobechat/types';
2
- import { Mock, describe, expect, it, vi } from 'vitest';
3
-
4
- import { chatHelpers } from '@/store/chat/helpers';
2
+ import { describe, expect, it, vi } from 'vitest';
5
3
 
6
4
  import { chainSummaryTitle } from '../summaryTitle';
7
5
 
8
- // Mock the chatHelpers.getMessagesTokenCount function
9
- vi.mock('@/store/chat/helpers', () => ({
10
- chatHelpers: {
11
- getMessagesTokenCount: vi.fn(),
12
- },
13
- }));
14
-
15
6
  describe('chainSummaryTitle', () => {
16
7
  it('should use the default model if the token count is below the GPT-3.5 limit', async () => {
17
8
  // Arrange
@@ -21,7 +12,6 @@ describe('chainSummaryTitle', () => {
21
12
  ];
22
13
  const currentLanguage = 'en-US';
23
14
  const tokenCount = 10000; // Arbitrary token count below the GPT-3.5 limit
24
- (chatHelpers.getMessagesTokenCount as Mock).mockResolvedValue(tokenCount);
25
15
 
26
16
  // Act
27
17
  const result = await chainSummaryTitle(messages, currentLanguage);
@@ -1,3 +1,5 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
1
3
  import { pluginPrompts } from './index';
2
4
  import { Tool } from './tools';
3
5
 
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ environment: 'happy-dom',
6
+ },
7
+ });
@@ -1,5 +1,6 @@
1
1
  export * from './artifact';
2
2
  export * from './chunk';
3
+ export * from './clientDB';
3
4
  export * from './fetch';
4
5
  export * from './knowledgeBase';
5
6
  export * from './message';
@@ -4,6 +4,10 @@
4
4
  "private": true,
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
7
+ "scripts": {
8
+ "test": "vitest",
9
+ "test:coverage": "vitest --coverage"
10
+ },
7
11
  "dependencies": {
8
12
  "@mozilla/readability": "^0.6.0",
9
13
  "happy-dom": "^17.0.0",
@@ -1,4 +1,4 @@
1
- import { describe, expect, it, vi } from 'vitest';
1
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
2
2
 
3
3
  import { jina } from '../jina';
4
4
 
@@ -1,4 +1,4 @@
1
- import { describe, expect, it, vi } from 'vitest';
1
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
2
2
 
3
3
  import { NetworkConnectionError, PageNotFoundError, TimeoutError } from '../../utils/errorType';
4
4
  import * as withTimeoutModule from '../../utils/withTimeout';
@@ -1,4 +1,4 @@
1
- import { describe, expect, it, vi } from 'vitest';
1
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
2
2
 
3
3
  import { TimeoutError } from '../errorType';
4
4
  import { DEFAULT_TIMEOUT, withTimeout } from '../withTimeout';
@@ -1,3 +1,5 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
1
3
  import { applyUrlRules } from './appUrlRules';
2
4
 
3
5
  describe('applyUrlRules', () => {
@@ -1,6 +1,6 @@
1
1
  import { readFileSync } from 'node:fs';
2
2
  import * as path from 'node:path';
3
- import { expect } from 'vitest';
3
+ import { describe, expect, it } from 'vitest';
4
4
 
5
5
  import { FilterOptions } from '../type';
6
6
  import { htmlToMarkdown } from './htmlToMarkdown';
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ environment: 'node',
6
+ },
7
+ });
@@ -7,11 +7,15 @@ import { Flexbox } from 'react-layout-kit';
7
7
  import Loading from '@/components/Loading/BrandTextLoading';
8
8
  import { useClientDataSWR } from '@/libs/swr';
9
9
  import { aiProviderService } from '@/services/aiProvider';
10
+ import { useAiInfraStore } from '@/store/aiInfra';
10
11
 
11
12
  import ModelList from '../../features/ModelList';
12
13
  import ProviderConfig from '../../features/ProviderConfig';
13
14
 
14
15
  const ClientMode = memo<{ id: string }>(({ id }) => {
16
+ const useFetchAiProviderItem = useAiInfraStore((s) => s.useFetchAiProviderItem);
17
+ useFetchAiProviderItem(id);
18
+
15
19
  const { data, isLoading } = useClientDataSWR('get-client-provider', () =>
16
20
  aiProviderService.getAiProviderById(id),
17
21
  );
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
  ],