@lobehub/chat 0.151.11 → 0.152.0
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/README.md +8 -8
- package/README.zh-CN.md +2 -2
- package/package.json +1 -1
- package/src/const/url.ts +1 -0
- package/src/hooks/useImportConfig.ts +20 -1
- package/src/layout/GlobalProvider/StoreInitialization.tsx +10 -1
- package/src/services/__tests__/share.test.ts +50 -5
- package/src/services/share.ts +29 -2
- package/src/store/chat/slices/share/action.test.ts +9 -11
- package/src/store/chat/slices/share/action.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 0.152.0](https://github.com/lobehub/lobe-chat/compare/v0.151.11...v0.152.0)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2024-04-30**</sup>
|
|
8
|
+
|
|
9
|
+
#### ✨ Features
|
|
10
|
+
|
|
11
|
+
- **misc**: Import settings from url.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's improved
|
|
19
|
+
|
|
20
|
+
- **misc**: Import settings from url, closes [#2226](https://github.com/lobehub/lobe-chat/issues/2226) ([b1f6c20](https://github.com/lobehub/lobe-chat/commit/b1f6c20))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
### [Version 0.151.11](https://github.com/lobehub/lobe-chat/compare/v0.151.10...v0.151.11)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2024-04-30**</sup>
|
package/README.md
CHANGED
|
@@ -261,14 +261,14 @@ Our marketplace is not just a showcase platform but also a collaborative space.
|
|
|
261
261
|
|
|
262
262
|
<!-- AGENT LIST -->
|
|
263
263
|
|
|
264
|
-
| Recent Submits
|
|
265
|
-
|
|
|
266
|
-
| [
|
|
267
|
-
| [
|
|
268
|
-
| [
|
|
269
|
-
| [
|
|
270
|
-
|
|
271
|
-
> 📊 Total agents: [<kbd>**
|
|
264
|
+
| Recent Submits | Description |
|
|
265
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
266
|
+
| [Sales Description Specialist](https://chat-preview.lobehub.com/market?agent=verkauf-kleinanzeigen)<br/><sup>By **[highseen](https://github.com/highseen)** on **2024-04-30**</sup> | Assists in the sale of used items through research, pricing, description, and title creation.<br/>`product-sales` `research` `description` |
|
|
267
|
+
| [Jailbreak Assistant DAN](https://chat-preview.lobehub.com/market?agent=gpt-4-dan-assistant)<br/><sup>By **[MapleEve](https://github.com/MapleEve)** on **2024-04-26**</sup> | Bypass OpenAI review mechanism, ChatGPT after jailbreak<br/>`creative` `artificial-intelligence` `conversation` `jailbreak` |
|
|
268
|
+
| [TailwindHelper](https://chat-preview.lobehub.com/market?agent=tailwind-helper)<br/><sup>By **[aototo](https://github.com/aototo)** on **2024-04-26**</sup> | TailwindHelper is a professional frontend designer with a solid foundation in design theory and rich practical experience. Created by a leading software development company, it aims to help developers and designers accelerate the development process of web interfaces. TailwindHelper is proficient in the Tailwind CSS framework and can translate complex design requirements into efficient and responsive CSS class names.<br/>`tailwindcss` `css` `tailwind-helper` |
|
|
269
|
+
| [yapi JSON-SCHEMA to Typescript](https://chat-preview.lobehub.com/market?agent=yapi-ts-helper)<br/><sup>By **[zcf0508](https://github.com/zcf0508)** on **2024-04-26**</sup> | Specializes in converting JSON schema to TypeScript types.<br/>`typescript` `development` |
|
|
270
|
+
|
|
271
|
+
> 📊 Total agents: [<kbd>**244**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
|
|
272
272
|
|
|
273
273
|
<!-- AGENT LIST -->
|
|
274
274
|
|
package/README.zh-CN.md
CHANGED
|
@@ -251,12 +251,12 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
|
|
|
251
251
|
|
|
252
252
|
| 最近新增 | 助手说明 |
|
|
253
253
|
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
254
|
+
| [销售描述专家](https://chat-preview.lobehub.com/market?agent=verkauf-kleinanzeigen)<br/><sup>By **[highseen](https://github.com/highseen)** on **2024-04-30**</sup> | 通过研究、定价、描述和标题设计帮助销售二手物品。<br/>`产品销售` `研究` `描述` |
|
|
254
255
|
| [越狱助手 DAN](https://chat-preview.lobehub.com/market?agent=gpt-4-dan-assistant)<br/><sup>By **[MapleEve](https://github.com/MapleEve)** on **2024-04-26**</sup> | 突破 OpenAI 审核机制,越狱之后的 ChatGPT<br/>`创意` `人工智能` `对话` `越狱` |
|
|
255
256
|
| [TailwindHelper](https://chat-preview.lobehub.com/market?agent=tailwind-helper)<br/><sup>By **[aototo](https://github.com/aototo)** on **2024-04-26**</sup> | TailwindHelper 是一位专业的前端设计师,拥有深厚的设计理论基础和丰富的实践经验。它由一家领先的软件开发公司创建,旨在帮助开发者和设计师加速 Web 界面的开发过程。TailwindHelper 精通 Tailwind CSS 框架,并能够理解复杂的设计要求,转化为高效且响应式的 CSS 类名。<br/>`tailwindcss` `css` `tailwind-helper` |
|
|
256
257
|
| [yapi JSON-SCHEMA to Typescript](https://chat-preview.lobehub.com/market?agent=yapi-ts-helper)<br/><sup>By **[zcf0508](https://github.com/zcf0508)** on **2024-04-26**</sup> | 擅长将 JSON schema 转换为 TypeScript 类型。<br/>`typescript` `开发` |
|
|
257
|
-
| [中文论文编辑师](https://chat-preview.lobehub.com/market?agent=chinese-paper-polishing)<br/><sup>By **[y22emc2](https://github.com/y22emc2)** on **2024-04-15**</sup> | 作为一名中文学术论文写作改进助理,你的任务是改进所提供文本的拼写、语法、清晰、简洁和整体可读性,提高文本的学术规范性、文学性,同时分解长句,减少重复,并提供改进建议。请先提供文本的更正版本,然后在 markdown 表格中列出修改的内容,并给出修改的理由。<br/>`学术论文写作` `校对` `文本编辑` |
|
|
258
258
|
|
|
259
|
-
> 📊 Total agents: [<kbd>**
|
|
259
|
+
> 📊 Total agents: [<kbd>**244**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
|
|
260
260
|
|
|
261
261
|
<!-- AGENT LIST -->
|
|
262
262
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.152.0",
|
|
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",
|
package/src/const/url.ts
CHANGED
|
@@ -43,6 +43,7 @@ export const SESSION_CHAT_URL = (id: string = INBOX_SESSION_ID, mobile?: boolean
|
|
|
43
43
|
|
|
44
44
|
export const imageUrl = (filename: string) => withBasePath(`/images/${filename}`);
|
|
45
45
|
|
|
46
|
+
export const LOBE_URL_IMPORT_NAME = 'settings';
|
|
46
47
|
export const EMAIL_SUPPORT = 'support@lobehub.com';
|
|
47
48
|
export const EMAIL_BUSINESS = 'hello@lobehub.com';
|
|
48
49
|
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
|
|
3
3
|
import { ImportResults, configService } from '@/services/config';
|
|
4
|
+
import { shareService } from '@/services/share';
|
|
4
5
|
import { useChatStore } from '@/store/chat';
|
|
5
6
|
import { useSessionStore } from '@/store/session';
|
|
7
|
+
import { useUserStore } from '@/store/user';
|
|
6
8
|
import { importConfigFile } from '@/utils/config';
|
|
7
9
|
|
|
8
10
|
export const useImportConfig = () => {
|
|
9
11
|
const refreshSessions = useSessionStore((s) => s.refreshSessions);
|
|
10
12
|
const [refreshMessages, refreshTopics] = useChatStore((s) => [s.refreshMessages, s.refreshTopic]);
|
|
13
|
+
const [setSettings] = useUserStore((s) => [s.setSettings]);
|
|
11
14
|
|
|
12
15
|
const importConfig = async (file: File) =>
|
|
13
16
|
new Promise<ImportResults | undefined>((resolve) => {
|
|
@@ -22,5 +25,21 @@ export const useImportConfig = () => {
|
|
|
22
25
|
});
|
|
23
26
|
});
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Import settings from a string in json format
|
|
30
|
+
* @param settingsParams
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
const importSettings = (settingsParams: string | null) => {
|
|
34
|
+
if (settingsParams) {
|
|
35
|
+
const importSettings = shareService.decodeShareSettings(settingsParams);
|
|
36
|
+
if (importSettings?.message || !importSettings?.data) {
|
|
37
|
+
// handle some error
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
setSettings(importSettings.data);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return useMemo(() => ({ importConfig, importSettings }), []);
|
|
26
45
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useRouter } from 'next/navigation';
|
|
3
|
+
import { useRouter, useSearchParams } from 'next/navigation';
|
|
4
4
|
import { memo, useEffect } from 'react';
|
|
5
5
|
import { createStoreUpdater } from 'zustand-utils';
|
|
6
6
|
|
|
7
|
+
import { LOBE_URL_IMPORT_NAME } from '@/const/url';
|
|
8
|
+
import { useImportConfig } from '@/hooks/useImportConfig';
|
|
7
9
|
import { useIsMobile } from '@/hooks/useIsMobile';
|
|
8
10
|
import { useEnabledDataSync } from '@/hooks/useSyncData';
|
|
9
11
|
import { useAgentStore } from '@/store/agent';
|
|
@@ -38,6 +40,13 @@ const StoreInitialization = memo(() => {
|
|
|
38
40
|
useStoreUpdater('isMobile', mobile);
|
|
39
41
|
useStoreUpdater('router', router);
|
|
40
42
|
|
|
43
|
+
// Import settings from the url
|
|
44
|
+
const { importSettings } = useImportConfig();
|
|
45
|
+
const searchParam = useSearchParams().get(LOBE_URL_IMPORT_NAME);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
importSettings(searchParam);
|
|
48
|
+
}, [searchParam]);
|
|
49
|
+
|
|
41
50
|
useEffect(() => {
|
|
42
51
|
router.prefetch('/chat');
|
|
43
52
|
router.prefetch('/chat/settings');
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { DeepPartial } from 'utility-types';
|
|
1
2
|
import { Mock, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
3
|
|
|
4
|
+
import { LOBE_URL_IMPORT_NAME } from '@/const/url';
|
|
5
|
+
import { GlobalSettings } from '@/types/settings';
|
|
3
6
|
import { ShareGPTConversation } from '@/types/share';
|
|
4
7
|
import { parseMarkdown } from '@/utils/parseMarkdown';
|
|
5
8
|
|
|
6
|
-
import { SHARE_GPT_URL,
|
|
9
|
+
import { SHARE_GPT_URL, shareService } from '../share';
|
|
7
10
|
|
|
8
11
|
// Mock dependencies
|
|
9
12
|
vi.mock('@/utils/parseMarkdown', () => ({
|
|
@@ -32,7 +35,7 @@ describe('ShareGPTService', () => {
|
|
|
32
35
|
});
|
|
33
36
|
|
|
34
37
|
// Act
|
|
35
|
-
const url = await
|
|
38
|
+
const url = await shareService.createShareGPTUrl(conversation);
|
|
36
39
|
|
|
37
40
|
// Assert
|
|
38
41
|
expect(parseMarkdown).toHaveBeenCalledWith('Hi there!');
|
|
@@ -48,7 +51,7 @@ describe('ShareGPTService', () => {
|
|
|
48
51
|
(fetch as Mock).mockRejectedValue(new Error('Network error'));
|
|
49
52
|
|
|
50
53
|
// Act & Assert
|
|
51
|
-
await expect(
|
|
54
|
+
await expect(shareService.createShareGPTUrl(conversation)).rejects.toThrow('Network error');
|
|
52
55
|
});
|
|
53
56
|
|
|
54
57
|
it('should not parse markdown for items not from gpt', async () => {
|
|
@@ -65,7 +68,7 @@ describe('ShareGPTService', () => {
|
|
|
65
68
|
});
|
|
66
69
|
|
|
67
70
|
// Act
|
|
68
|
-
await
|
|
71
|
+
await shareService.createShareGPTUrl(conversation);
|
|
69
72
|
|
|
70
73
|
// Assert
|
|
71
74
|
expect(parseMarkdown).not.toHaveBeenCalled();
|
|
@@ -81,6 +84,48 @@ describe('ShareGPTService', () => {
|
|
|
81
84
|
});
|
|
82
85
|
|
|
83
86
|
// Act & Assert
|
|
84
|
-
await expect(
|
|
87
|
+
await expect(shareService.createShareGPTUrl(conversation)).rejects.toThrow();
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
describe('ShareViaUrl', () => {
|
|
92
|
+
describe('createShareSettingsUrl', () => {
|
|
93
|
+
it('should create a share settings URL with the provided settings', () => {
|
|
94
|
+
const settings: DeepPartial<GlobalSettings> = {
|
|
95
|
+
languageModel: {
|
|
96
|
+
openai: {
|
|
97
|
+
apiKey: 'user-key',
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
const url = shareService.createShareSettingsUrl(settings);
|
|
102
|
+
expect(url).toBe(
|
|
103
|
+
`/?${LOBE_URL_IMPORT_NAME}=%7B%22languageModel%22:%7B%22openai%22:%7B%22apiKey%22:%22user-key%22%7D%7D%7D`,
|
|
104
|
+
);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
describe('decodeShareSettings', () => {
|
|
109
|
+
it('should decode share settings from search params', () => {
|
|
110
|
+
const settings = '{"languageModel":{"openai":{"apiKey":"user-key"}}}';
|
|
111
|
+
const decodedSettings = shareService.decodeShareSettings(settings);
|
|
112
|
+
expect(decodedSettings).toEqual({
|
|
113
|
+
data: {
|
|
114
|
+
languageModel: {
|
|
115
|
+
openai: {
|
|
116
|
+
apiKey: 'user-key',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('should return an error message if decoding fails', () => {
|
|
124
|
+
const settings = '%7B%22theme%22%3A%22dark%22%2C%22fontSize%22%3A16%';
|
|
125
|
+
const decodedSettings = shareService.decodeShareSettings(settings);
|
|
126
|
+
expect(decodedSettings).toEqual({
|
|
127
|
+
message: expect.any(String),
|
|
128
|
+
});
|
|
129
|
+
});
|
|
85
130
|
});
|
|
86
131
|
});
|
package/src/services/share.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import { DeepPartial } from 'utility-types';
|
|
2
|
+
|
|
3
|
+
import { LOBE_URL_IMPORT_NAME } from '@/const/url';
|
|
4
|
+
import { GlobalSettings } from '@/types/settings';
|
|
1
5
|
import { ShareGPTConversation } from '@/types/share';
|
|
6
|
+
import { withBasePath } from '@/utils/basePath';
|
|
2
7
|
import { parseMarkdown } from '@/utils/parseMarkdown';
|
|
3
8
|
|
|
4
9
|
export const SHARE_GPT_URL = 'https://sharegpt.com/api/conversations';
|
|
5
10
|
|
|
6
|
-
class
|
|
11
|
+
class ShareService {
|
|
7
12
|
public async createShareGPTUrl(conversation: ShareGPTConversation) {
|
|
8
13
|
const items = [];
|
|
9
14
|
|
|
@@ -29,6 +34,28 @@ class ShareGPTService {
|
|
|
29
34
|
// short link to the ShareGPT post
|
|
30
35
|
return `https://shareg.pt/${id}`;
|
|
31
36
|
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Creates a share settings URL with the provided settings.
|
|
40
|
+
* @param settings - The settings object to be encoded in the URL.
|
|
41
|
+
* @returns The share settings URL.
|
|
42
|
+
*/
|
|
43
|
+
public createShareSettingsUrl(settings: DeepPartial<GlobalSettings>) {
|
|
44
|
+
return withBasePath(`/?${LOBE_URL_IMPORT_NAME}=${encodeURI(JSON.stringify(settings))}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Decode share settings from search params
|
|
49
|
+
* @param settings
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
public decodeShareSettings(settings: string) {
|
|
53
|
+
try {
|
|
54
|
+
return { data: JSON.parse(settings) as DeepPartial<GlobalSettings> };
|
|
55
|
+
} catch (e) {
|
|
56
|
+
return { message: JSON.stringify(e) };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
32
59
|
}
|
|
33
60
|
|
|
34
|
-
export const
|
|
61
|
+
export const shareService = new ShareService();
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { act, renderHook } from '@testing-library/react';
|
|
2
2
|
|
|
3
3
|
import { DEFAULT_USER_AVATAR_URL } from '@/const/meta';
|
|
4
|
-
import {
|
|
4
|
+
import { shareService } from '@/services/share';
|
|
5
5
|
import { useChatStore } from '@/store/chat';
|
|
6
6
|
import { ChatMessage } from '@/types/message';
|
|
7
7
|
|
|
8
8
|
describe('shareSlice actions', () => {
|
|
9
|
-
let
|
|
9
|
+
let shareServiceSpy: any;
|
|
10
10
|
let windowOpenSpy;
|
|
11
11
|
|
|
12
12
|
beforeEach(() => {
|
|
13
|
-
|
|
14
|
-
.spyOn(shareGPTService, 'createShareGPTUrl')
|
|
15
|
-
.mockResolvedValue('test-url');
|
|
13
|
+
shareServiceSpy = vi.spyOn(shareService, 'createShareGPTUrl').mockResolvedValue('test-url');
|
|
16
14
|
windowOpenSpy = vi.spyOn(window, 'open');
|
|
17
15
|
});
|
|
18
16
|
|
|
@@ -23,7 +21,7 @@ describe('shareSlice actions', () => {
|
|
|
23
21
|
describe('shareToShareGPT', () => {
|
|
24
22
|
it('should share to ShareGPT and open a new window', async () => {
|
|
25
23
|
const { result } = renderHook(() => useChatStore());
|
|
26
|
-
const
|
|
24
|
+
const shareServiceSpy = vi.spyOn(shareService, 'createShareGPTUrl');
|
|
27
25
|
const windowOpenSpy = vi.spyOn(window, 'open');
|
|
28
26
|
const avatar = 'avatar-url';
|
|
29
27
|
const withPluginInfo = true;
|
|
@@ -33,7 +31,7 @@ describe('shareSlice actions', () => {
|
|
|
33
31
|
await result.current.shareToShareGPT({ avatar, withPluginInfo, withSystemRole });
|
|
34
32
|
});
|
|
35
33
|
|
|
36
|
-
expect(
|
|
34
|
+
expect(shareServiceSpy).toHaveBeenCalled();
|
|
37
35
|
expect(windowOpenSpy).toHaveBeenCalled();
|
|
38
36
|
});
|
|
39
37
|
it('should handle messages from different roles correctly', async () => {
|
|
@@ -67,7 +65,7 @@ describe('shareSlice actions', () => {
|
|
|
67
65
|
await result.current.shareToShareGPT({});
|
|
68
66
|
});
|
|
69
67
|
|
|
70
|
-
expect(
|
|
68
|
+
expect(shareServiceSpy).toHaveBeenCalledWith(
|
|
71
69
|
expect.objectContaining({
|
|
72
70
|
avatarUrl: DEFAULT_USER_AVATAR_URL,
|
|
73
71
|
}),
|
|
@@ -106,7 +104,7 @@ describe('shareSlice actions', () => {
|
|
|
106
104
|
await act(async () => {
|
|
107
105
|
result.current.shareToShareGPT({ withPluginInfo: true });
|
|
108
106
|
});
|
|
109
|
-
expect(
|
|
107
|
+
expect(shareServiceSpy).toHaveBeenCalledWith(
|
|
110
108
|
expect.objectContaining({
|
|
111
109
|
items: expect.arrayContaining([
|
|
112
110
|
expect.objectContaining({
|
|
@@ -139,7 +137,7 @@ describe('shareSlice actions', () => {
|
|
|
139
137
|
await act(async () => {
|
|
140
138
|
result.current.shareToShareGPT({ withPluginInfo: false });
|
|
141
139
|
});
|
|
142
|
-
expect(
|
|
140
|
+
expect(shareServiceSpy).toHaveBeenCalledWith(
|
|
143
141
|
expect.objectContaining({
|
|
144
142
|
items: expect.not.arrayContaining([
|
|
145
143
|
expect.objectContaining({
|
|
@@ -180,7 +178,7 @@ describe('shareSlice actions', () => {
|
|
|
180
178
|
});
|
|
181
179
|
});
|
|
182
180
|
|
|
183
|
-
expect(
|
|
181
|
+
expect(shareServiceSpy).toHaveBeenCalledWith(
|
|
184
182
|
expect.objectContaining({
|
|
185
183
|
items: [
|
|
186
184
|
expect.objectContaining({ from: 'gpt' }), // Agent meta info
|
|
@@ -3,7 +3,7 @@ import { produce } from 'immer';
|
|
|
3
3
|
import { StateCreator } from 'zustand/vanilla';
|
|
4
4
|
|
|
5
5
|
import { DEFAULT_USER_AVATAR_URL } from '@/const/meta';
|
|
6
|
-
import {
|
|
6
|
+
import { shareService } from '@/services/share';
|
|
7
7
|
import { useAgentStore } from '@/store/agent';
|
|
8
8
|
import { agentSelectors } from '@/store/agent/selectors';
|
|
9
9
|
import { useSessionStore } from '@/store/session';
|
|
@@ -104,7 +104,7 @@ export const chatShare: StateCreator<ChatStore, [['zustand/devtools', never]], [
|
|
|
104
104
|
|
|
105
105
|
set({ shareLoading: true });
|
|
106
106
|
|
|
107
|
-
const res = await
|
|
107
|
+
const res = await shareService.createShareGPTUrl({
|
|
108
108
|
avatarUrl: avatar || DEFAULT_USER_AVATAR_URL,
|
|
109
109
|
items: shareMsgs,
|
|
110
110
|
});
|