@lobehub/lobehub 2.0.0-next.104 → 2.0.0-next.105
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.
- package/CHANGELOG.md +25 -0
- package/apps/desktop/package.json +2 -2
- package/changelog/v1.json +5 -0
- package/package.json +9 -3
- package/packages/database/src/repositories/knowledge/index.ts +5 -8
- package/packages/model-bank/src/aiModels/moonshot.ts +46 -0
- package/packages/model-runtime/src/core/contextBuilders/openai.ts +1 -1
- package/packages/model-runtime/src/providers/moonshot/index.ts +17 -4
- package/packages/types/src/user/settings/keyVaults.ts +0 -68
- package/packages/utils/src/client/parserPlaceholder.ts +1 -1
- package/src/services/__tests__/_auth.test.ts +1 -4
- package/src/services/_auth.ts +2 -3
- package/src/services/_header.ts +1 -8
- package/src/store/chat/agents/__tests__/createAgentExecutors/call-llm.test.ts +18 -0
- package/src/store/chat/agents/__tests__/createAgentExecutors/call-tool.test.ts +40 -11
- package/src/store/chat/agents/__tests__/createAgentExecutors/helpers/assertions.ts +3 -0
- package/src/store/chat/agents/__tests__/createAgentExecutors/request-human-approve.test.ts +15 -0
- package/src/store/chat/agents/__tests__/createAgentExecutors/resolve-aborted-tools.test.ts +37 -11
- package/src/store/chat/agents/createAgentExecutors.ts +22 -13
- package/src/store/chat/slices/aiChat/actions/conversationLifecycle.ts +4 -8
- package/src/store/chat/slices/builtinTool/actions/__tests__/search.test.ts +16 -2
- package/src/store/chat/slices/builtinTool/actions/localSystem.ts +5 -1
- package/src/store/chat/slices/builtinTool/actions/search.ts +5 -1
- package/src/store/chat/slices/message/actions/publicApi.ts +10 -2
- package/src/store/chat/slices/message/actions/query.ts +17 -4
- package/src/store/chat/slices/operation/__tests__/selectors.test.ts +93 -5
- package/src/store/chat/slices/operation/selectors.ts +16 -3
- package/src/store/chat/slices/plugin/actions/optimisticUpdate.ts +24 -18
- package/src/store/user/slices/settings/selectors/keyVaults.ts +0 -5
- package/src/features/ChatList/Error/AccessCodeForm.tsx +0 -63
- package/src/services/__tests__/share.test.ts +0 -61
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { PartialDeep } from 'type-fest';
|
|
2
|
-
import { Mock, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
-
|
|
4
|
-
import { LOBE_URL_IMPORT_NAME } from '@/const/url';
|
|
5
|
-
import { UserSettings } from '@/types/user/settings';
|
|
6
|
-
|
|
7
|
-
import { shareService } from '../share';
|
|
8
|
-
|
|
9
|
-
// Mock dependencies
|
|
10
|
-
vi.mock('@/utils/parseMarkdown', () => ({
|
|
11
|
-
parseMarkdown: vi.fn(),
|
|
12
|
-
}));
|
|
13
|
-
|
|
14
|
-
global.fetch = vi.fn();
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
vi.clearAllMocks();
|
|
18
|
-
});
|
|
19
|
-
describe('ShareGPTService', () => {
|
|
20
|
-
describe('ShareViaUrl', () => {
|
|
21
|
-
describe('createShareSettingsUrl', () => {
|
|
22
|
-
it('should create a share settings URL with the provided settings', () => {
|
|
23
|
-
const settings: PartialDeep<UserSettings> = {
|
|
24
|
-
keyVaults: {
|
|
25
|
-
openai: {
|
|
26
|
-
apiKey: 'user-key',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
const url = shareService.createShareSettingsUrl(settings);
|
|
31
|
-
expect(url).toBe(
|
|
32
|
-
`/?${LOBE_URL_IMPORT_NAME}=%7B%22keyVaults%22:%7B%22openai%22:%7B%22apiKey%22:%22user-key%22%7D%7D%7D`,
|
|
33
|
-
);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
describe('decodeShareSettings', () => {
|
|
38
|
-
it('should decode share settings from search params', () => {
|
|
39
|
-
const settings = '{"languageModel":{"openai":{"apiKey":"user-key"}}}';
|
|
40
|
-
const decodedSettings = shareService.decodeShareSettings(settings);
|
|
41
|
-
expect(decodedSettings).toEqual({
|
|
42
|
-
data: {
|
|
43
|
-
languageModel: {
|
|
44
|
-
openai: {
|
|
45
|
-
apiKey: 'user-key',
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('should return an error message if decoding fails', () => {
|
|
53
|
-
const settings = '%7B%22theme%22%3A%22dark%22%2C%22fontSize%22%3A16%';
|
|
54
|
-
const decodedSettings = shareService.decodeShareSettings(settings);
|
|
55
|
-
expect(decodedSettings).toEqual({
|
|
56
|
-
message: expect.any(String),
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
});
|