@lobehub/chat 1.56.5 → 1.57.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.
- package/.github/ISSUE_TEMPLATE/1_bug_report.yml +11 -2
- package/.github/ISSUE_TEMPLATE/1_bug_report_cn.yml +9 -0
- package/CHANGELOG.md +50 -0
- package/Dockerfile +2 -0
- package/Dockerfile.database +2 -0
- package/changelog/v1.json +18 -0
- package/package.json +1 -1
- package/src/{features → app/[variants]/(main)/chat/(workspace)/@conversation/features}/ChatInput/Mobile/Files/FileItem/File.tsx +1 -1
- package/src/{features → app/[variants]/(main)/chat/(workspace)/@conversation/features}/ChatInput/Mobile/index.tsx +19 -9
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatInput/index.tsx +1 -2
- package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Main.tsx +15 -1
- package/src/app/[variants]/(main)/chat/(workspace)/_layout/Mobile/ChatHeader/index.tsx +0 -2
- package/src/app/[variants]/(main)/chat/(workspace)/features/AgentSettings/index.tsx +1 -1
- package/src/app/[variants]/(main)/chat/settings/page.tsx +95 -5
- package/src/app/[variants]/(main)/settings/llm/ProviderList/providers.tsx +2 -0
- package/src/config/aiModels/index.ts +3 -0
- package/src/config/aiModels/jina.ts +23 -0
- package/src/config/llm.ts +6 -0
- package/src/config/modelProviders/index.ts +4 -0
- package/src/config/modelProviders/jina.ts +21 -0
- package/src/features/AgentSetting/AgentMeta/index.tsx +19 -9
- package/src/features/AgentSetting/AgentPrompt/index.tsx +32 -2
- package/src/features/AgentSetting/AgentSettings.tsx +4 -5
- package/src/features/AgentSetting/AgentSettingsProvider.tsx +17 -0
- package/src/features/AgentSetting/StoreUpdater.tsx +5 -2
- package/src/features/AgentSetting/index.tsx +1 -1
- package/src/features/AgentSetting/store/initialState.ts +2 -1
- package/src/hooks/useInterceptingRoutes.test.ts +1 -1
- package/src/hooks/useInterceptingRoutes.ts +1 -1
- package/src/layout/GlobalProvider/StoreInitialization.tsx +1 -1
- package/src/libs/agent-runtime/AgentRuntime.ts +7 -0
- package/src/libs/agent-runtime/jina/index.ts +49 -0
- package/src/libs/agent-runtime/types/type.ts +1 -0
- package/src/store/agent/slices/chat/action.test.ts +3 -3
- package/src/store/agent/slices/chat/action.ts +2 -5
- package/src/types/user/settings/keyVaults.ts +1 -0
- package/src/app/[variants]/(main)/chat/settings/features/EditPage.tsx +0 -45
- package/src/features/AgentSetting/AgentSettingsStore.tsx +0 -14
- /package/src/{features → app/[variants]/(main)/chat/(workspace)/@conversation/features}/ChatInput/Mobile/Files/FileItem/Image.tsx +0 -0
- /package/src/{features → app/[variants]/(main)/chat/(workspace)/@conversation/features}/ChatInput/Mobile/Files/FileItem/index.tsx +0 -0
- /package/src/{features → app/[variants]/(main)/chat/(workspace)/@conversation/features}/ChatInput/Mobile/Files/FileItem/style.ts +0 -0
- /package/src/{features → app/[variants]/(main)/chat/(workspace)/@conversation/features}/ChatInput/Mobile/Files/index.tsx +0 -0
- /package/src/{features → app/[variants]/(main)/chat/(workspace)/@conversation/features}/ChatInput/Mobile/InputArea/Container.tsx +0 -0
- /package/src/{features → app/[variants]/(main)/chat/(workspace)/@conversation/features}/ChatInput/Mobile/InputArea/index.tsx +0 -0
- /package/src/{features → app/[variants]/(main)/chat/(workspace)/@conversation/features}/ChatInput/Mobile/Send.tsx +0 -0
@@ -5,7 +5,7 @@ labels: ['🐛 Bug']
|
|
5
5
|
body:
|
6
6
|
- type: dropdown
|
7
7
|
attributes:
|
8
|
-
label: '📦
|
8
|
+
label: '📦 Platform'
|
9
9
|
multiple: true
|
10
10
|
options:
|
11
11
|
- 'Official Preview'
|
@@ -13,10 +13,19 @@ body:
|
|
13
13
|
- 'Zeabur'
|
14
14
|
- 'Sealos'
|
15
15
|
- 'Netlify'
|
16
|
-
- 'Docker'
|
16
|
+
- 'Self hosting Docker'
|
17
17
|
- 'Other'
|
18
18
|
validations:
|
19
19
|
required: true
|
20
|
+
- type: dropdown
|
21
|
+
attributes:
|
22
|
+
label: '📦 Deploymenet mode'
|
23
|
+
multiple: true
|
24
|
+
options:
|
25
|
+
- 'client db (lobe-chat image)'
|
26
|
+
- 'server db(lobe-chat-database image)'
|
27
|
+
validations:
|
28
|
+
required: true
|
20
29
|
- type: input
|
21
30
|
attributes:
|
22
31
|
label: '📌 Version'
|
@@ -17,6 +17,15 @@ body:
|
|
17
17
|
- 'Other'
|
18
18
|
validations:
|
19
19
|
required: true
|
20
|
+
- type: dropdown
|
21
|
+
attributes:
|
22
|
+
label: '📦 部署模式'
|
23
|
+
multiple: true
|
24
|
+
options:
|
25
|
+
- '客户端模式(lobe-chat 镜像)'
|
26
|
+
- '服务端模式(lobe-chat-database 镜像)'
|
27
|
+
validations:
|
28
|
+
required: true
|
20
29
|
- type: input
|
21
30
|
attributes:
|
22
31
|
label: '📌 软件版本'
|
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,56 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.57.1](https://github.com/lobehub/lobe-chat/compare/v1.57.0...v1.57.1)
|
6
|
+
|
7
|
+
<sup>Released on **2025-02-16**</sup>
|
8
|
+
|
9
|
+
#### 💄 Styles
|
10
|
+
|
11
|
+
- **misc**: Fix mobile agent settings not show correctly.
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
<details>
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
17
|
+
|
18
|
+
#### Styles
|
19
|
+
|
20
|
+
- **misc**: Fix mobile agent settings not show correctly, closes [#6203](https://github.com/lobehub/lobe-chat/issues/6203) ([0285d95](https://github.com/lobehub/lobe-chat/commit/0285d95))
|
21
|
+
|
22
|
+
</details>
|
23
|
+
|
24
|
+
<div align="right">
|
25
|
+
|
26
|
+
[](#readme-top)
|
27
|
+
|
28
|
+
</div>
|
29
|
+
|
30
|
+
## [Version 1.57.0](https://github.com/lobehub/lobe-chat/compare/v1.56.5...v1.57.0)
|
31
|
+
|
32
|
+
<sup>Released on **2025-02-16**</sup>
|
33
|
+
|
34
|
+
#### ✨ Features
|
35
|
+
|
36
|
+
- **misc**: Add Jina AI model provider support.
|
37
|
+
|
38
|
+
<br/>
|
39
|
+
|
40
|
+
<details>
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
42
|
+
|
43
|
+
#### What's improved
|
44
|
+
|
45
|
+
- **misc**: Add Jina AI model provider support, closes [#6140](https://github.com/lobehub/lobe-chat/issues/6140) ([6b4c15b](https://github.com/lobehub/lobe-chat/commit/6b4c15b))
|
46
|
+
|
47
|
+
</details>
|
48
|
+
|
49
|
+
<div align="right">
|
50
|
+
|
51
|
+
[](#readme-top)
|
52
|
+
|
53
|
+
</div>
|
54
|
+
|
5
55
|
### [Version 1.56.5](https://github.com/lobehub/lobe-chat/compare/v1.56.4...v1.56.5)
|
6
56
|
|
7
57
|
<sup>Released on **2025-02-16**</sup>
|
package/Dockerfile
CHANGED
@@ -183,6 +183,8 @@ ENV \
|
|
183
183
|
HUNYUAN_API_KEY="" HUNYUAN_MODEL_LIST="" \
|
184
184
|
# InternLM
|
185
185
|
INTERNLM_API_KEY="" INTERNLM_MODEL_LIST="" \
|
186
|
+
# Jina
|
187
|
+
JINA_API_KEY="" JINA_MODEL_LIST="" JINA_PROXY_URL="" \
|
186
188
|
# Minimax
|
187
189
|
MINIMAX_API_KEY="" MINIMAX_MODEL_LIST="" \
|
188
190
|
# Mistral
|
package/Dockerfile.database
CHANGED
@@ -220,6 +220,8 @@ ENV \
|
|
220
220
|
HUNYUAN_API_KEY="" HUNYUAN_MODEL_LIST="" \
|
221
221
|
# InternLM
|
222
222
|
INTERNLM_API_KEY="" INTERNLM_MODEL_LIST="" \
|
223
|
+
# Jina
|
224
|
+
JINA_API_KEY="" JINA_MODEL_LIST="" JINA_PROXY_URL="" \
|
223
225
|
# Minimax
|
224
226
|
MINIMAX_API_KEY="" MINIMAX_MODEL_LIST="" \
|
225
227
|
# Mistral
|
package/changelog/v1.json
CHANGED
@@ -1,4 +1,22 @@
|
|
1
1
|
[
|
2
|
+
{
|
3
|
+
"children": {
|
4
|
+
"improvements": [
|
5
|
+
"Fix mobile agent settings not show correctly."
|
6
|
+
]
|
7
|
+
},
|
8
|
+
"date": "2025-02-16",
|
9
|
+
"version": "1.57.1"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"children": {
|
13
|
+
"features": [
|
14
|
+
"Add Jina AI model provider support."
|
15
|
+
]
|
16
|
+
},
|
17
|
+
"date": "2025-02-16",
|
18
|
+
"version": "1.57.0"
|
19
|
+
},
|
2
20
|
{
|
3
21
|
"children": {
|
4
22
|
"fixes": [
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.57.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",
|
@@ -8,7 +8,7 @@ import { Flexbox } from 'react-layout-kit';
|
|
8
8
|
import FileIcon from '@/components/FileIcon';
|
9
9
|
import { UploadFileItem } from '@/types/files';
|
10
10
|
|
11
|
-
import UploadDetail from '
|
11
|
+
import UploadDetail from '../../../../../../../../../../../features/ChatInput/components/UploadDetail';
|
12
12
|
|
13
13
|
const useStyles = createStyles(({ css, token }) => ({
|
14
14
|
container: css`
|
@@ -1,8 +1,10 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
|
+
import { Skeleton } from 'antd';
|
3
4
|
import { useTheme } from 'antd-style';
|
4
5
|
import { TextAreaRef } from 'antd/es/input/TextArea';
|
5
6
|
import { memo, useRef, useState } from 'react';
|
7
|
+
import { Flexbox } from 'react-layout-kit';
|
6
8
|
|
7
9
|
import ActionBar from '@/features/ChatInput/ActionBar';
|
8
10
|
import { ActionKeys } from '@/features/ChatInput/ActionBar/config';
|
@@ -12,6 +14,7 @@ import { useSendMessage } from '@/features/ChatInput/useSend';
|
|
12
14
|
import { useChatStore } from '@/store/chat';
|
13
15
|
import { chatSelectors } from '@/store/chat/selectors';
|
14
16
|
|
17
|
+
import { useInitAgentConfig } from '../../../../_layout/useInitAgentConfig';
|
15
18
|
import Files from './Files';
|
16
19
|
import InputArea from './InputArea';
|
17
20
|
import SendButton from './Send';
|
@@ -33,6 +36,7 @@ const MobileChatInput = memo(() => {
|
|
33
36
|
const ref = useRef<TextAreaRef>(null);
|
34
37
|
const [expand, setExpand] = useState<boolean>(false);
|
35
38
|
const { send: sendMessage, canSend } = useSendMessage();
|
39
|
+
const { isLoading } = useInitAgentConfig();
|
36
40
|
|
37
41
|
const [loading, value, onInput, onStop] = useChatStore((s) => [
|
38
42
|
chatSelectors.isAIGenerating(s),
|
@@ -63,15 +67,21 @@ const MobileChatInput = memo(() => {
|
|
63
67
|
<SendButton disabled={!canSend} loading={loading} onSend={sendMessage} onStop={onStop} />
|
64
68
|
}
|
65
69
|
topAddons={
|
66
|
-
|
67
|
-
<
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
70
|
+
isLoading ? (
|
71
|
+
<Flexbox paddingInline={8}>
|
72
|
+
<Skeleton.Button active block size={'small'} />
|
73
|
+
</Flexbox>
|
74
|
+
) : (
|
75
|
+
<>
|
76
|
+
<Files />
|
77
|
+
<ActionBar
|
78
|
+
leftActions={defaultLeftActions}
|
79
|
+
padding={'0 8px'}
|
80
|
+
rightActions={defaultRightActions}
|
81
|
+
rightAreaStartRender={<SaveTopic mobile />}
|
82
|
+
/>
|
83
|
+
</>
|
84
|
+
)
|
75
85
|
}
|
76
86
|
value={value}
|
77
87
|
/>
|
package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatInput/index.tsx
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
import MobileChatInput from '@/features/ChatInput/Mobile';
|
2
|
-
|
3
1
|
import DesktopChatInput from './Desktop';
|
2
|
+
import MobileChatInput from './Mobile';
|
4
3
|
|
5
4
|
const ChatInput = ({ mobile }: { mobile: boolean }) => {
|
6
5
|
const Input = mobile ? MobileChatInput : DesktopChatInput;
|
@@ -42,7 +42,21 @@ const Main = memo(() => {
|
|
42
42
|
const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);
|
43
43
|
|
44
44
|
return !init ? (
|
45
|
-
<Flexbox horizontal>
|
45
|
+
<Flexbox gap={4} horizontal>
|
46
|
+
{!isPinned && (
|
47
|
+
<ActionIcon
|
48
|
+
aria-label={t('agents')}
|
49
|
+
icon={showSessionPanel ? PanelLeftClose : PanelLeftOpen}
|
50
|
+
onClick={() => {
|
51
|
+
updateSystemStatus({
|
52
|
+
sessionsWidth: showSessionPanel ? 0 : 320,
|
53
|
+
showSessionPanel: !showSessionPanel,
|
54
|
+
});
|
55
|
+
}}
|
56
|
+
size={DESKTOP_HEADER_ICON_SIZE}
|
57
|
+
title={t('agents')}
|
58
|
+
/>
|
59
|
+
)}
|
46
60
|
<Skeleton
|
47
61
|
active
|
48
62
|
avatar={{ shape: 'circle', size: 'default' }}
|
@@ -3,7 +3,6 @@
|
|
3
3
|
import { MobileNavBar } from '@lobehub/ui/mobile';
|
4
4
|
import { memo, useState } from 'react';
|
5
5
|
|
6
|
-
import { useInitAgentConfig } from '@/app/[variants]/(main)/chat/(workspace)/_layout/useInitAgentConfig';
|
7
6
|
import { INBOX_SESSION_ID } from '@/const/session';
|
8
7
|
import { useQueryRoute } from '@/hooks/useQueryRoute';
|
9
8
|
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
@@ -17,7 +16,6 @@ const MobileHeader = memo(() => {
|
|
17
16
|
const [open, setOpen] = useState(false);
|
18
17
|
|
19
18
|
const { isAgentEditable } = useServerConfigStore(featureFlagsSelectors);
|
20
|
-
useInitAgentConfig();
|
21
19
|
|
22
20
|
return (
|
23
21
|
<MobileNavBar
|
@@ -101,7 +101,7 @@ const AgentSettings = memo(() => {
|
|
101
101
|
width={'100%'}
|
102
102
|
>
|
103
103
|
{tab === ChatSettingsTabs.Meta && <AgentMeta />}
|
104
|
-
{tab === ChatSettingsTabs.Prompt && <AgentPrompt
|
104
|
+
{tab === ChatSettingsTabs.Prompt && <AgentPrompt />}
|
105
105
|
{tab === ChatSettingsTabs.Chat && <AgentChat />}
|
106
106
|
{tab === ChatSettingsTabs.Modal && <AgentModal />}
|
107
107
|
{tab === ChatSettingsTabs.TTS && <AgentTTS />}
|
@@ -1,7 +1,97 @@
|
|
1
|
-
|
1
|
+
'use client';
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
};
|
3
|
+
import { TabsNav } from '@lobehub/ui';
|
4
|
+
import isEqual from 'fast-deep-equal';
|
5
|
+
import { memo, useState } from 'react';
|
6
|
+
import { useTranslation } from 'react-i18next';
|
6
7
|
|
7
|
-
|
8
|
+
import PageTitle from '@/components/PageTitle';
|
9
|
+
import { INBOX_SESSION_ID } from '@/const/session';
|
10
|
+
import { AgentSettingsProvider } from '@/features/AgentSetting';
|
11
|
+
import AgentChat from '@/features/AgentSetting/AgentChat';
|
12
|
+
import AgentMeta from '@/features/AgentSetting/AgentMeta';
|
13
|
+
import AgentModal from '@/features/AgentSetting/AgentModal';
|
14
|
+
import AgentPlugin from '@/features/AgentSetting/AgentPlugin';
|
15
|
+
import AgentPrompt from '@/features/AgentSetting/AgentPrompt';
|
16
|
+
import AgentTTS from '@/features/AgentSetting/AgentTTS';
|
17
|
+
import { useAgentStore } from '@/store/agent';
|
18
|
+
import { agentSelectors } from '@/store/agent/selectors';
|
19
|
+
import { ChatSettingsTabs } from '@/store/global/initialState';
|
20
|
+
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
21
|
+
import { useSessionStore } from '@/store/session';
|
22
|
+
import { sessionMetaSelectors } from '@/store/session/selectors';
|
23
|
+
|
24
|
+
const EditPage = memo(() => {
|
25
|
+
const { t } = useTranslation('setting');
|
26
|
+
const [tab, setTab] = useState(ChatSettingsTabs.Prompt);
|
27
|
+
|
28
|
+
const [id, updateAgentMeta, title] = useSessionStore((s) => [
|
29
|
+
s.activeId,
|
30
|
+
s.updateSessionMeta,
|
31
|
+
sessionMetaSelectors.currentAgentTitle(s),
|
32
|
+
]);
|
33
|
+
const [useFetchAgentConfig, updateAgentConfig] = useAgentStore((s) => [
|
34
|
+
s.useFetchAgentConfig,
|
35
|
+
s.updateAgentConfig,
|
36
|
+
]);
|
37
|
+
|
38
|
+
const config = useAgentStore(agentSelectors.currentAgentConfig, isEqual);
|
39
|
+
const meta = useSessionStore(sessionMetaSelectors.currentAgentMeta, isEqual);
|
40
|
+
|
41
|
+
const { isLoading } = useFetchAgentConfig(id);
|
42
|
+
const { enablePlugins } = useServerConfigStore(featureFlagsSelectors);
|
43
|
+
|
44
|
+
return (
|
45
|
+
<>
|
46
|
+
<PageTitle title={t('header.sessionWithName', { name: title })} />
|
47
|
+
|
48
|
+
<TabsNav
|
49
|
+
items={[
|
50
|
+
{
|
51
|
+
key: ChatSettingsTabs.Prompt,
|
52
|
+
label: t('settingAgent.prompt.title'),
|
53
|
+
},
|
54
|
+
(id !== INBOX_SESSION_ID && {
|
55
|
+
key: ChatSettingsTabs.Meta,
|
56
|
+
label: t('settingAgent.title'),
|
57
|
+
}) as any,
|
58
|
+
{
|
59
|
+
key: ChatSettingsTabs.Chat,
|
60
|
+
label: t('settingChat.title'),
|
61
|
+
},
|
62
|
+
{
|
63
|
+
key: ChatSettingsTabs.Modal,
|
64
|
+
label: t('settingModel.title'),
|
65
|
+
},
|
66
|
+
{
|
67
|
+
key: ChatSettingsTabs.TTS,
|
68
|
+
label: t('settingTTS.title'),
|
69
|
+
},
|
70
|
+
(enablePlugins && {
|
71
|
+
key: ChatSettingsTabs.Plugin,
|
72
|
+
label: t('settingPlugin.title'),
|
73
|
+
}) as any,
|
74
|
+
]}
|
75
|
+
onChange={(value) => setTab(value as ChatSettingsTabs)}
|
76
|
+
variant={'compact'}
|
77
|
+
/>
|
78
|
+
<AgentSettingsProvider
|
79
|
+
config={config}
|
80
|
+
id={id}
|
81
|
+
loading={isLoading}
|
82
|
+
meta={meta}
|
83
|
+
onConfigChange={updateAgentConfig}
|
84
|
+
onMetaChange={updateAgentMeta}
|
85
|
+
>
|
86
|
+
{tab === ChatSettingsTabs.Prompt && <AgentPrompt modal />}
|
87
|
+
{tab === ChatSettingsTabs.Meta && <AgentMeta />}
|
88
|
+
{tab === ChatSettingsTabs.Chat && <AgentChat />}
|
89
|
+
{tab === ChatSettingsTabs.Modal && <AgentModal />}
|
90
|
+
{tab === ChatSettingsTabs.TTS && <AgentTTS />}
|
91
|
+
{tab === ChatSettingsTabs.Plugin && <AgentPlugin />}
|
92
|
+
</AgentSettingsProvider>
|
93
|
+
</>
|
94
|
+
);
|
95
|
+
});
|
96
|
+
|
97
|
+
export default EditPage;
|
@@ -13,6 +13,7 @@ import {
|
|
13
13
|
HigressProviderCard,
|
14
14
|
HunyuanProviderCard,
|
15
15
|
InternLMProviderCard,
|
16
|
+
JinaProviderCard,
|
16
17
|
MinimaxProviderCard,
|
17
18
|
MistralProviderCard,
|
18
19
|
MoonshotProviderCard,
|
@@ -77,6 +78,7 @@ export const useProviderList = (): ProviderItem[] => {
|
|
77
78
|
Ai21ProviderCard,
|
78
79
|
UpstageProviderCard,
|
79
80
|
XAIProviderCard,
|
81
|
+
JinaProviderCard,
|
80
82
|
QwenProviderCard,
|
81
83
|
WenxinProviderCard,
|
82
84
|
HunyuanProviderCard,
|
@@ -18,6 +18,7 @@ import { default as higress } from './higress';
|
|
18
18
|
import { default as huggingface } from './huggingface';
|
19
19
|
import { default as hunyuan } from './hunyuan';
|
20
20
|
import { default as internlm } from './internlm';
|
21
|
+
import { default as jina } from './jina';
|
21
22
|
import { default as lmstudio } from './lmstudio';
|
22
23
|
import { default as minimax } from './minimax';
|
23
24
|
import { default as mistral } from './mistral';
|
@@ -81,6 +82,7 @@ export const LOBE_DEFAULT_MODEL_LIST = buildDefaultModelList({
|
|
81
82
|
huggingface,
|
82
83
|
hunyuan,
|
83
84
|
internlm,
|
85
|
+
jina,
|
84
86
|
lmstudio,
|
85
87
|
minimax,
|
86
88
|
mistral,
|
@@ -125,6 +127,7 @@ export { default as higress } from './higress';
|
|
125
127
|
export { default as huggingface } from './huggingface';
|
126
128
|
export { default as hunyuan } from './hunyuan';
|
127
129
|
export { default as internlm } from './internlm';
|
130
|
+
export { default as jina } from './jina';
|
128
131
|
export { default as lmstudio } from './lmstudio';
|
129
132
|
export { default as minimax } from './minimax';
|
130
133
|
export { default as mistral } from './mistral';
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { AIChatModelCard } from '@/types/aiModel';
|
2
|
+
|
3
|
+
const jinaChatModels: AIChatModelCard[] = [
|
4
|
+
{
|
5
|
+
abilities: {
|
6
|
+
reasoning: true,
|
7
|
+
},
|
8
|
+
contextWindowTokens: 64_000,
|
9
|
+
description: '深度搜索结合了网络搜索、阅读和推理,可进行全面调查。您可以将其视为一个代理,接受您的研究任务 - 它会进行广泛搜索并经过多次迭代,然后才能给出答案。这个过程涉及持续的研究、推理和从各个角度解决问题。这与直接从预训练数据生成答案的标准大模型以及依赖一次性表面搜索的传统 RAG 系统有着根本的不同。',
|
10
|
+
displayName: 'Jina DeepSearch v1',
|
11
|
+
enabled: true,
|
12
|
+
id: 'jina-deepsearch-v1',
|
13
|
+
pricing: {
|
14
|
+
input: 0.02,
|
15
|
+
output: 0.02
|
16
|
+
},
|
17
|
+
type: 'chat'
|
18
|
+
}
|
19
|
+
]
|
20
|
+
|
21
|
+
export const allModels = [...jinaChatModels];
|
22
|
+
|
23
|
+
export default allModels;
|
package/src/config/llm.ts
CHANGED
@@ -134,6 +134,9 @@ export const getLLMConfig = () => {
|
|
134
134
|
|
135
135
|
ENABLED_TENCENT_CLOUD: z.boolean(),
|
136
136
|
TENCENT_CLOUD_API_KEY: z.string().optional(),
|
137
|
+
|
138
|
+
ENABLED_JINA: z.boolean(),
|
139
|
+
JINA_API_KEY: z.string().optional(),
|
137
140
|
},
|
138
141
|
runtimeEnv: {
|
139
142
|
API_KEY_SELECT_MODE: process.env.API_KEY_SELECT_MODE,
|
@@ -266,6 +269,9 @@ export const getLLMConfig = () => {
|
|
266
269
|
|
267
270
|
ENABLED_TENCENT_CLOUD: !!process.env.TENCENT_CLOUD_API_KEY,
|
268
271
|
TENCENT_CLOUD_API_KEY: process.env.TENCENT_CLOUD_API_KEY,
|
272
|
+
|
273
|
+
ENABLED_JINA: !!process.env.JINA_API_KEY,
|
274
|
+
JINA_API_KEY: process.env.JINA_API_KEY,
|
269
275
|
},
|
270
276
|
});
|
271
277
|
};
|
@@ -18,6 +18,7 @@ import HigressProvider from './higress';
|
|
18
18
|
import HuggingFaceProvider from './huggingface';
|
19
19
|
import HunyuanProvider from './hunyuan';
|
20
20
|
import InternLMProvider from './internlm';
|
21
|
+
import JinaProvider from './jina';
|
21
22
|
import LMStudioProvider from './lmstudio';
|
22
23
|
import MinimaxProvider from './minimax';
|
23
24
|
import MistralProvider from './mistral';
|
@@ -67,6 +68,7 @@ export const LOBE_DEFAULT_MODEL_LIST: ChatModelCard[] = [
|
|
67
68
|
AnthropicProvider.chatModels,
|
68
69
|
HuggingFaceProvider.chatModels,
|
69
70
|
XAIProvider.chatModels,
|
71
|
+
JinaProvider.chatModels,
|
70
72
|
ZeroOneProvider.chatModels,
|
71
73
|
StepfunProvider.chatModels,
|
72
74
|
NovitaProvider.chatModels,
|
@@ -110,6 +112,7 @@ export const DEFAULT_MODEL_PROVIDER_LIST = [
|
|
110
112
|
Ai21Provider,
|
111
113
|
UpstageProvider,
|
112
114
|
XAIProvider,
|
115
|
+
JinaProvider,
|
113
116
|
QwenProvider,
|
114
117
|
WenxinProvider,
|
115
118
|
TencentcloudProvider,
|
@@ -159,6 +162,7 @@ export { default as HigressProviderCard } from './higress';
|
|
159
162
|
export { default as HuggingFaceProviderCard } from './huggingface';
|
160
163
|
export { default as HunyuanProviderCard } from './hunyuan';
|
161
164
|
export { default as InternLMProviderCard } from './internlm';
|
165
|
+
export { default as JinaProviderCard } from './jina';
|
162
166
|
export { default as LMStudioProviderCard } from './lmstudio';
|
163
167
|
export { default as MinimaxProviderCard } from './minimax';
|
164
168
|
export { default as MistralProviderCard } from './mistral';
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { ModelProviderCard } from '@/types/llm';
|
2
|
+
|
3
|
+
const Jina: ModelProviderCard = {
|
4
|
+
chatModels: [],
|
5
|
+
checkModel: 'jina-deepsearch-v1',
|
6
|
+
description: 'Jina AI 成立于 2020 年,是一家领先的搜索 AI 公司。我们的搜索底座平台包含了向量模型、重排器和小语言模型,可帮助企业构建可靠且高质量的生成式AI和多模态的搜索应用。',
|
7
|
+
id: 'jina',
|
8
|
+
modelList: { showModelFetcher: true },
|
9
|
+
modelsUrl: 'https://jina.ai/models',
|
10
|
+
name: 'Jina',
|
11
|
+
settings: {
|
12
|
+
proxyUrl: {
|
13
|
+
placeholder: 'https://deepsearch.jina.ai/v1',
|
14
|
+
},
|
15
|
+
sdkType: 'openai',
|
16
|
+
showModelFetcher: true,
|
17
|
+
},
|
18
|
+
url: 'https://jina.ai',
|
19
|
+
};
|
20
|
+
|
21
|
+
export default Jina;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
3
|
import { Form, type FormItemProps, Icon, type ItemGroup, Tooltip } from '@lobehub/ui';
|
4
|
-
import { Button } from 'antd';
|
4
|
+
import { Button, Skeleton } from 'antd';
|
5
5
|
import isEqual from 'fast-deep-equal';
|
6
6
|
import { isString } from 'lodash-es';
|
7
7
|
import { Wand2 } from 'lucide-react';
|
@@ -27,7 +27,11 @@ const AgentMeta = memo(() => {
|
|
27
27
|
s.autocompleteMeta,
|
28
28
|
s.autocompleteAllMeta,
|
29
29
|
]);
|
30
|
-
const [isInbox,
|
30
|
+
const [isInbox, isIniting, autocompleteLoading] = useStore((s) => [
|
31
|
+
s.id === INBOX_SESSION_ID,
|
32
|
+
s.loading,
|
33
|
+
s.autocompleteLoading,
|
34
|
+
]);
|
31
35
|
const meta = useStore((s) => s.meta, isEqual);
|
32
36
|
|
33
37
|
if (isInbox) return;
|
@@ -59,10 +63,12 @@ const AgentMeta = memo(() => {
|
|
59
63
|
const autocompleteItems: FormItemProps[] = basic.map((item) => {
|
60
64
|
const AutoGenerate = item.Render;
|
61
65
|
return {
|
62
|
-
children: (
|
66
|
+
children: isIniting ? (
|
67
|
+
<Skeleton.Button active block size={'small'} />
|
68
|
+
) : (
|
63
69
|
<AutoGenerate
|
64
70
|
canAutoGenerate={hasSystemRole}
|
65
|
-
loading={
|
71
|
+
loading={autocompleteLoading[item.key as keyof SessionLoadingState]}
|
66
72
|
onChange={item.onChange}
|
67
73
|
onGenerate={() => {
|
68
74
|
autocompleteMeta(item.key as keyof typeof meta);
|
@@ -78,11 +84,13 @@ const AgentMeta = memo(() => {
|
|
78
84
|
const metaData: ItemGroup = {
|
79
85
|
children: [
|
80
86
|
{
|
81
|
-
children: (
|
87
|
+
children: isIniting ? (
|
88
|
+
<Skeleton.Button active block size={'small'} />
|
89
|
+
) : (
|
82
90
|
<AutoGenerateAvatar
|
83
91
|
background={meta.backgroundColor}
|
84
92
|
canAutoGenerate={hasSystemRole}
|
85
|
-
loading={
|
93
|
+
loading={autocompleteLoading['avatar']}
|
86
94
|
onChange={(avatar) => updateMeta({ avatar })}
|
87
95
|
onGenerate={() => autocompleteMeta('avatar')}
|
88
96
|
value={meta.avatar}
|
@@ -92,7 +100,9 @@ const AgentMeta = memo(() => {
|
|
92
100
|
minWidth: undefined,
|
93
101
|
},
|
94
102
|
{
|
95
|
-
children: (
|
103
|
+
children: isIniting ? (
|
104
|
+
<Skeleton.Button active block size={'small'} />
|
105
|
+
) : (
|
96
106
|
<BackgroundSwatches
|
97
107
|
backgroundColor={meta.backgroundColor}
|
98
108
|
onChange={(backgroundColor) => updateMeta({ backgroundColor })}
|
@@ -103,7 +113,7 @@ const AgentMeta = memo(() => {
|
|
103
113
|
},
|
104
114
|
...autocompleteItems,
|
105
115
|
],
|
106
|
-
extra: (
|
116
|
+
extra: !isIniting && (
|
107
117
|
<Tooltip
|
108
118
|
title={
|
109
119
|
!hasSystemRole
|
@@ -114,7 +124,7 @@ const AgentMeta = memo(() => {
|
|
114
124
|
<Button
|
115
125
|
disabled={!hasSystemRole}
|
116
126
|
icon={<Icon icon={Wand2} />}
|
117
|
-
loading={Object.values(
|
127
|
+
loading={Object.values(autocompleteLoading).some((i) => !!i)}
|
118
128
|
onClick={(e: any) => {
|
119
129
|
e.stopPropagation();
|
120
130
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
3
|
import { EditableMessage, Form } from '@lobehub/ui';
|
4
|
-
import { Button } from 'antd';
|
4
|
+
import { Button, Skeleton } from 'antd';
|
5
5
|
import { createStyles } from 'antd-style';
|
6
6
|
import { memo, useState } from 'react';
|
7
7
|
import { useTranslation } from 'react-i18next';
|
@@ -40,7 +40,37 @@ const AgentPrompt = memo<{ modal?: boolean }>(({ modal }) => {
|
|
40
40
|
const { t } = useTranslation('setting');
|
41
41
|
const { styles } = useStyles();
|
42
42
|
const [editing, setEditing] = useState(false);
|
43
|
-
const [systemRole, updateConfig] = useStore((s) => [
|
43
|
+
const [loading, systemRole, updateConfig] = useStore((s) => [
|
44
|
+
s.loading,
|
45
|
+
s.config.systemRole,
|
46
|
+
s.setAgentConfig,
|
47
|
+
]);
|
48
|
+
|
49
|
+
if (loading) {
|
50
|
+
return (
|
51
|
+
<div className={styles.wrapper}>
|
52
|
+
<Flexbox className={styles.container} padding={4}>
|
53
|
+
<Flexbox horizontal justify={'space-between'} paddingBlock={8} paddingInline={12}>
|
54
|
+
<h1 style={{ fontSize: 18, fontWeight: 'bold', marginBottom: 4 }}>
|
55
|
+
{t('settingAgent.prompt.title')}
|
56
|
+
</h1>
|
57
|
+
</Flexbox>
|
58
|
+
<Flexbox
|
59
|
+
align={'center'}
|
60
|
+
className={styles.content}
|
61
|
+
flex={1}
|
62
|
+
gap={16}
|
63
|
+
horizontal
|
64
|
+
justify={'space-between'}
|
65
|
+
padding={12}
|
66
|
+
wrap={'wrap'}
|
67
|
+
>
|
68
|
+
<Skeleton active style={{ paddingTop: 12 }} title={false} />
|
69
|
+
</Flexbox>
|
70
|
+
</Flexbox>
|
71
|
+
</div>
|
72
|
+
);
|
73
|
+
}
|
44
74
|
|
45
75
|
const content = (
|
46
76
|
<EditableMessage
|
@@ -5,23 +5,22 @@ import AgentMeta from './AgentMeta';
|
|
5
5
|
import AgentModal from './AgentModal';
|
6
6
|
import AgentPlugin from './AgentPlugin';
|
7
7
|
import AgentPrompt from './AgentPrompt';
|
8
|
+
import { AgentSettingsProvider } from './AgentSettingsProvider';
|
8
9
|
import AgentTTS from './AgentTTS';
|
9
|
-
import
|
10
|
-
import { Provider, createStore } from './store';
|
10
|
+
import { StoreUpdaterProps } from './StoreUpdater';
|
11
11
|
|
12
12
|
type AgentSettingsProps = StoreUpdaterProps;
|
13
13
|
|
14
14
|
export const AgentSettings = (props: AgentSettingsProps) => {
|
15
15
|
const { enablePlugins } = useServerConfigStore(featureFlagsSelectors);
|
16
16
|
return (
|
17
|
-
<
|
18
|
-
<StoreUpdater {...props} />
|
17
|
+
<AgentSettingsProvider {...props}>
|
19
18
|
<AgentPrompt />
|
20
19
|
<AgentMeta />
|
21
20
|
<AgentChat />
|
22
21
|
<AgentModal />
|
23
22
|
<AgentTTS />
|
24
23
|
{enablePlugins && <AgentPlugin />}
|
25
|
-
</
|
24
|
+
</AgentSettingsProvider>
|
26
25
|
);
|
27
26
|
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { ReactNode, memo } from 'react';
|
2
|
+
|
3
|
+
import StoreUpdater, { StoreUpdaterProps } from './StoreUpdater';
|
4
|
+
import { Provider, createStore } from './store';
|
5
|
+
|
6
|
+
interface AgentSettingsProps extends StoreUpdaterProps {
|
7
|
+
children: ReactNode;
|
8
|
+
}
|
9
|
+
|
10
|
+
export const AgentSettingsProvider = memo<AgentSettingsProps>(({ children, ...props }) => {
|
11
|
+
return (
|
12
|
+
<Provider createStore={createStore}>
|
13
|
+
<StoreUpdater {...props} />
|
14
|
+
{children}
|
15
|
+
</Provider>
|
16
|
+
);
|
17
|
+
});
|
@@ -7,12 +7,14 @@ import { AgentSettingsInstance, useAgentSettings } from './hooks/useAgentSetting
|
|
7
7
|
import { State, useStoreApi } from './store';
|
8
8
|
|
9
9
|
export interface StoreUpdaterProps
|
10
|
-
extends Partial<
|
10
|
+
extends Partial<
|
11
|
+
Pick<State, 'onMetaChange' | 'onConfigChange' | 'meta' | 'config' | 'id' | 'loading'>
|
12
|
+
> {
|
11
13
|
instanceRef?: ForwardedRef<AgentSettingsInstance> | null;
|
12
14
|
}
|
13
15
|
|
14
16
|
const StoreUpdater = memo<StoreUpdaterProps>(
|
15
|
-
({ onConfigChange, instanceRef, id, onMetaChange, meta, config }) => {
|
17
|
+
({ onConfigChange, instanceRef, id, onMetaChange, meta, config, loading }) => {
|
16
18
|
const storeApi = useStoreApi();
|
17
19
|
const useStoreUpdater = createStoreUpdater(storeApi);
|
18
20
|
|
@@ -20,6 +22,7 @@ const StoreUpdater = memo<StoreUpdaterProps>(
|
|
20
22
|
useStoreUpdater('config', config);
|
21
23
|
useStoreUpdater('onConfigChange', onConfigChange);
|
22
24
|
useStoreUpdater('onMetaChange', onMetaChange);
|
25
|
+
useStoreUpdater('loading', loading);
|
23
26
|
useStoreUpdater('id', id);
|
24
27
|
|
25
28
|
const instance = useAgentSettings();
|
@@ -7,8 +7,9 @@ export interface State {
|
|
7
7
|
autocompleteLoading: SessionLoadingState;
|
8
8
|
config: LobeAgentConfig;
|
9
9
|
id?: string;
|
10
|
-
|
10
|
+
loading?: boolean;
|
11
11
|
|
12
|
+
meta: MetaData;
|
12
13
|
onConfigChange?: (config: LobeAgentConfig) => void;
|
13
14
|
onMetaChange?: (meta: MetaData) => void;
|
14
15
|
}
|
@@ -43,7 +43,7 @@ describe('useOpenChatSettings', () => {
|
|
43
43
|
vi.mocked(useSessionStore).mockReturnValue('123');
|
44
44
|
vi.mocked(useIsMobile).mockReturnValue(true);
|
45
45
|
const { result } = renderHook(() => useOpenChatSettings(ChatSettingsTabs.Meta));
|
46
|
-
expect(result.current()).toBe('/chat/settings');
|
46
|
+
expect(result.current()).toBe('/chat/settings?session=123');
|
47
47
|
});
|
48
48
|
|
49
49
|
it('should handle desktop route for chat settings with session and tab', () => {
|
@@ -20,7 +20,7 @@ export const useOpenChatSettings = (tab: ChatSettingsTabs = ChatSettingsTabs.Met
|
|
20
20
|
return () => router.push(urlJoin('/settings', SettingsTabs.Agent));
|
21
21
|
}
|
22
22
|
|
23
|
-
if (isMobile) return () => router.push('/chat/settings');
|
23
|
+
if (isMobile) return () => router.push('/chat/settings', { query: { session: activeId } });
|
24
24
|
|
25
25
|
return () => {
|
26
26
|
useAgentStore.setState({ showAgentSetting: true });
|
@@ -32,7 +32,7 @@ const StoreInitialization = memo(() => {
|
|
32
32
|
|
33
33
|
const useInitSystemStatus = useGlobalStore((s) => s.useInitSystemStatus);
|
34
34
|
|
35
|
-
const useInitAgentStore = useAgentStore((s) => s.
|
35
|
+
const useInitAgentStore = useAgentStore((s) => s.useInitInboxAgentStore);
|
36
36
|
const useInitAiProviderKeyVaults = useAiInfraStore((s) => s.useFetchAiProviderRuntimeState);
|
37
37
|
|
38
38
|
// init the system preference
|
@@ -21,6 +21,7 @@ import { LobeHigressAI } from './higress';
|
|
21
21
|
import { LobeHuggingFaceAI } from './huggingface';
|
22
22
|
import { LobeHunyuanAI } from './hunyuan';
|
23
23
|
import { LobeInternLMAI } from './internlm';
|
24
|
+
import { LobeJinaAI } from './jina';
|
24
25
|
import { LobeLMStudioAI } from './lmstudio';
|
25
26
|
import { LobeMinimaxAI } from './minimax';
|
26
27
|
import { LobeMistralAI } from './mistral';
|
@@ -154,6 +155,7 @@ class AgentRuntime {
|
|
154
155
|
huggingface: { apiKey?: string; baseURL?: string };
|
155
156
|
hunyuan: Partial<ClientOptions>;
|
156
157
|
internlm: Partial<ClientOptions>;
|
158
|
+
jina: Partial<ClientOptions>;
|
157
159
|
lmstudio: Partial<ClientOptions>;
|
158
160
|
minimax: Partial<ClientOptions>;
|
159
161
|
mistral: Partial<ClientOptions>;
|
@@ -369,6 +371,11 @@ class AgentRuntime {
|
|
369
371
|
break;
|
370
372
|
}
|
371
373
|
|
374
|
+
case ModelProvider.Jina: {
|
375
|
+
runtimeModel = new LobeJinaAI(params.jina ?? {});
|
376
|
+
break;
|
377
|
+
}
|
378
|
+
|
372
379
|
case ModelProvider.Cloudflare: {
|
373
380
|
runtimeModel = new LobeCloudflareAI(params.cloudflare ?? {});
|
374
381
|
break;
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { ModelProvider } from '../types';
|
2
|
+
import { LobeOpenAICompatibleFactory } from '../utils/openaiCompatibleFactory';
|
3
|
+
|
4
|
+
import type { ChatModelCard } from '@/types/llm';
|
5
|
+
|
6
|
+
export interface JinaModelCard {
|
7
|
+
id: string;
|
8
|
+
}
|
9
|
+
|
10
|
+
export const LobeJinaAI = LobeOpenAICompatibleFactory({
|
11
|
+
baseURL: 'https://deepsearch.jina.ai/v1',
|
12
|
+
debug: {
|
13
|
+
chatCompletion: () => process.env.DEBUG_JINA_CHAT_COMPLETION === '1',
|
14
|
+
},
|
15
|
+
models: async ({ client }) => {
|
16
|
+
const { LOBE_DEFAULT_MODEL_LIST } = await import('@/config/aiModels');
|
17
|
+
|
18
|
+
const reasoningKeywords = [
|
19
|
+
'deepsearch',
|
20
|
+
];
|
21
|
+
|
22
|
+
const modelsPage = await client.models.list() as any;
|
23
|
+
const modelList: JinaModelCard[] = modelsPage.data;
|
24
|
+
|
25
|
+
return modelList
|
26
|
+
.map((model) => {
|
27
|
+
const knownModel = LOBE_DEFAULT_MODEL_LIST.find((m) => model.id.toLowerCase() === m.id.toLowerCase());
|
28
|
+
|
29
|
+
return {
|
30
|
+
contextWindowTokens: knownModel?.contextWindowTokens ?? undefined,
|
31
|
+
displayName: knownModel?.displayName ?? undefined,
|
32
|
+
enabled: knownModel?.enabled || false,
|
33
|
+
functionCall:
|
34
|
+
knownModel?.abilities?.functionCall
|
35
|
+
|| false,
|
36
|
+
id: model.id,
|
37
|
+
reasoning:
|
38
|
+
reasoningKeywords.some(keyword => model.id.toLowerCase().includes(keyword))
|
39
|
+
|| knownModel?.abilities?.reasoning
|
40
|
+
|| false,
|
41
|
+
vision:
|
42
|
+
knownModel?.abilities?.vision
|
43
|
+
|| false,
|
44
|
+
};
|
45
|
+
})
|
46
|
+
.filter(Boolean) as ChatModelCard[];
|
47
|
+
},
|
48
|
+
provider: ModelProvider.Jina,
|
49
|
+
});
|
@@ -216,7 +216,7 @@ describe('AgentSlice', () => {
|
|
216
216
|
model: 'gemini-pro',
|
217
217
|
} as any);
|
218
218
|
|
219
|
-
renderHook(() => result.current.
|
219
|
+
renderHook(() => result.current.useInitInboxAgentStore(true));
|
220
220
|
|
221
221
|
await waitFor(async () => {
|
222
222
|
expect(result.current.agentMap[INBOX_SESSION_ID]).toEqual({ model: 'gemini-pro' });
|
@@ -230,7 +230,7 @@ describe('AgentSlice', () => {
|
|
230
230
|
model: 'gemini-pro',
|
231
231
|
} as any);
|
232
232
|
|
233
|
-
renderHook(() => result.current.
|
233
|
+
renderHook(() => result.current.useInitInboxAgentStore(false));
|
234
234
|
|
235
235
|
await waitFor(async () => {
|
236
236
|
expect(result.current.agentMap[INBOX_SESSION_ID]).toBeUndefined();
|
@@ -243,7 +243,7 @@ describe('AgentSlice', () => {
|
|
243
243
|
|
244
244
|
vi.spyOn(globalService, 'getDefaultAgentConfig').mockRejectedValueOnce(new Error());
|
245
245
|
|
246
|
-
renderHook(() => result.current.
|
246
|
+
renderHook(() => result.current.useInitInboxAgentStore(true));
|
247
247
|
|
248
248
|
await waitFor(async () => {
|
249
249
|
expect(result.current.agentMap[INBOX_SESSION_ID]).toBeUndefined();
|
@@ -6,7 +6,6 @@ import { StateCreator } from 'zustand/vanilla';
|
|
6
6
|
|
7
7
|
import { MESSAGE_CANCEL_FLAT } from '@/const/message';
|
8
8
|
import { INBOX_SESSION_ID } from '@/const/session';
|
9
|
-
import { DEFAULT_AGENT_CONFIG } from '@/const/settings';
|
10
9
|
import { useClientDataSWR, useOnlyFetchOnceSWR } from '@/libs/swr';
|
11
10
|
import { agentService } from '@/services/agent';
|
12
11
|
import { sessionService } from '@/services/session';
|
@@ -51,7 +50,7 @@ export interface AgentChatAction {
|
|
51
50
|
updateAgentConfig: (config: DeepPartial<LobeAgentConfig>) => Promise<void>;
|
52
51
|
useFetchAgentConfig: (id: string) => SWRResponse<LobeAgentConfig>;
|
53
52
|
useFetchFilesAndKnowledgeBases: () => SWRResponse<KnowledgeItem[]>;
|
54
|
-
|
53
|
+
useInitInboxAgentStore: (
|
55
54
|
isLogin: boolean | undefined,
|
56
55
|
defaultAgentConfig?: DeepPartial<LobeAgentConfig>,
|
57
56
|
) => SWRResponse<DeepPartial<LobeAgentConfig>>;
|
@@ -164,12 +163,10 @@ export const createChatSlice: StateCreator<
|
|
164
163
|
[FETCH_AGENT_CONFIG_KEY, sessionId],
|
165
164
|
([, id]: string[]) => sessionService.getSessionConfig(id),
|
166
165
|
{
|
167
|
-
fallbackData: DEFAULT_AGENT_CONFIG,
|
168
166
|
onSuccess: (data) => {
|
169
167
|
get().internal_dispatchAgentMap(sessionId, data, 'fetch');
|
170
168
|
set({ activeAgentId: data.id }, false, 'updateActiveAgentId');
|
171
169
|
},
|
172
|
-
suspense: true,
|
173
170
|
},
|
174
171
|
),
|
175
172
|
useFetchFilesAndKnowledgeBases: () => {
|
@@ -183,7 +180,7 @@ export const createChatSlice: StateCreator<
|
|
183
180
|
);
|
184
181
|
},
|
185
182
|
|
186
|
-
|
183
|
+
useInitInboxAgentStore: (isLogin, defaultAgentConfig) =>
|
187
184
|
useOnlyFetchOnceSWR<DeepPartial<LobeAgentConfig>>(
|
188
185
|
!!isLogin ? 'fetchInboxAgentConfig' : null,
|
189
186
|
() => sessionService.getSessionConfig(INBOX_SESSION_ID),
|
@@ -44,6 +44,7 @@ export interface UserKeyVaults {
|
|
44
44
|
huggingface?: OpenAICompatibleKeyVault;
|
45
45
|
hunyuan?: OpenAICompatibleKeyVault;
|
46
46
|
internlm?: OpenAICompatibleKeyVault;
|
47
|
+
jina?: OpenAICompatibleKeyVault;
|
47
48
|
lmstudio?: OpenAICompatibleKeyVault;
|
48
49
|
lobehub?: any;
|
49
50
|
minimax?: OpenAICompatibleKeyVault;
|
@@ -1,45 +0,0 @@
|
|
1
|
-
'use client';
|
2
|
-
|
3
|
-
import isEqual from 'fast-deep-equal';
|
4
|
-
import { memo } from 'react';
|
5
|
-
import { useTranslation } from 'react-i18next';
|
6
|
-
|
7
|
-
import PageTitle from '@/components/PageTitle';
|
8
|
-
import { AgentSettings } from '@/features/AgentSetting';
|
9
|
-
import { useAgentStore } from '@/store/agent';
|
10
|
-
import { agentSelectors } from '@/store/agent/selectors';
|
11
|
-
import { useSessionStore } from '@/store/session';
|
12
|
-
import { sessionMetaSelectors } from '@/store/session/selectors';
|
13
|
-
|
14
|
-
const EditPage = memo(() => {
|
15
|
-
const { t } = useTranslation('setting');
|
16
|
-
const id = useSessionStore((s) => s.activeId);
|
17
|
-
const config = useAgentStore(agentSelectors.currentAgentConfig, isEqual);
|
18
|
-
const meta = useSessionStore(sessionMetaSelectors.currentAgentMeta, isEqual);
|
19
|
-
const [useFetchAgentConfig, updateAgentConfig] = useAgentStore((s) => [
|
20
|
-
s.useFetchAgentConfig,
|
21
|
-
s.updateAgentConfig,
|
22
|
-
]);
|
23
|
-
|
24
|
-
const [updateAgentMeta, title] = useSessionStore((s) => [
|
25
|
-
s.updateSessionMeta,
|
26
|
-
sessionMetaSelectors.currentAgentTitle(s),
|
27
|
-
]);
|
28
|
-
|
29
|
-
useFetchAgentConfig(id);
|
30
|
-
|
31
|
-
return (
|
32
|
-
<>
|
33
|
-
<PageTitle title={t('header.sessionWithName', { name: title })} />
|
34
|
-
<AgentSettings
|
35
|
-
config={config}
|
36
|
-
id={id}
|
37
|
-
meta={meta}
|
38
|
-
onConfigChange={updateAgentConfig}
|
39
|
-
onMetaChange={updateAgentMeta}
|
40
|
-
/>
|
41
|
-
</>
|
42
|
-
);
|
43
|
-
});
|
44
|
-
|
45
|
-
export default EditPage;
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import { memo } from 'react';
|
2
|
-
|
3
|
-
import StoreUpdater, { StoreUpdaterProps } from './StoreUpdater';
|
4
|
-
import { Provider, createStore } from './store';
|
5
|
-
|
6
|
-
type AgentSettingsProps = StoreUpdaterProps;
|
7
|
-
|
8
|
-
export const AgentSettingsStore = memo<AgentSettingsProps>((props) => {
|
9
|
-
return (
|
10
|
-
<Provider createStore={createStore}>
|
11
|
-
<StoreUpdater {...props} />
|
12
|
-
</Provider>
|
13
|
-
);
|
14
|
-
});
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|