@lobehub/chat 1.84.9 → 1.84.10
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 +29 -0
- package/apps/desktop/electron.vite.config.ts +3 -0
- package/changelog/v1.json +9 -0
- package/locales/ar/components.json +2 -1
- package/locales/ar/models.json +63 -0
- package/locales/bg-BG/components.json +2 -1
- package/locales/bg-BG/models.json +63 -0
- package/locales/de-DE/components.json +2 -1
- package/locales/de-DE/models.json +63 -0
- package/locales/en-US/components.json +2 -1
- package/locales/en-US/models.json +63 -0
- package/locales/es-ES/components.json +2 -1
- package/locales/es-ES/models.json +63 -0
- package/locales/fa-IR/components.json +2 -1
- package/locales/fa-IR/models.json +63 -0
- package/locales/fr-FR/components.json +2 -1
- package/locales/fr-FR/models.json +63 -0
- package/locales/it-IT/components.json +2 -1
- package/locales/it-IT/models.json +63 -0
- package/locales/ja-JP/components.json +2 -1
- package/locales/ja-JP/models.json +63 -0
- package/locales/ko-KR/components.json +2 -1
- package/locales/ko-KR/models.json +63 -0
- package/locales/nl-NL/components.json +2 -1
- package/locales/nl-NL/models.json +63 -0
- package/locales/pl-PL/components.json +2 -1
- package/locales/pl-PL/models.json +63 -0
- package/locales/pt-BR/components.json +2 -1
- package/locales/pt-BR/models.json +63 -0
- package/locales/ru-RU/components.json +2 -1
- package/locales/ru-RU/models.json +63 -0
- package/locales/tr-TR/components.json +2 -1
- package/locales/tr-TR/models.json +63 -0
- package/locales/vi-VN/components.json +2 -1
- package/locales/vi-VN/models.json +63 -0
- package/locales/zh-CN/components.json +2 -1
- package/locales/zh-CN/models.json +63 -0
- package/locales/zh-TW/components.json +2 -1
- package/locales/zh-TW/models.json +63 -0
- package/package.json +2 -2
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatInput/Mobile/index.tsx +1 -1
- package/src/app/[variants]/(main)/chat/(workspace)/@topic/features/Header.tsx +5 -1
- package/src/app/[variants]/(main)/chat/settings/page.tsx +1 -0
- package/src/app/[variants]/(main)/settings/_layout/Desktop/index.tsx +4 -1
- package/src/app/[variants]/(main)/settings/provider/(detail)/ollama/CheckError.tsx +4 -2
- package/src/app/[variants]/(main)/settings/provider/(detail)/ollama/Container.tsx +2 -2
- package/src/app/[variants]/(main)/settings/provider/ProviderMenu/index.tsx +1 -0
- package/src/components/FileParsingStatus/index.tsx +1 -7
- package/src/components/ModelSelect/index.tsx +2 -2
- package/src/config/aiModels/siliconcloud.ts +89 -7
- package/src/config/modelProviders/google.ts +16 -0
- package/src/features/ChatInput/ActionBar/{Clear.tsx → Clear/index.tsx} +3 -2
- package/src/features/ChatInput/ActionBar/History/Controls.tsx +72 -0
- package/src/features/ChatInput/ActionBar/History/index.tsx +46 -0
- package/src/features/ChatInput/ActionBar/Knowledge/index.tsx +31 -25
- package/src/features/ChatInput/ActionBar/Knowledge/{Dropdown.tsx → useControls.tsx} +20 -40
- package/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx +8 -1
- package/src/features/ChatInput/ActionBar/Model/index.tsx +27 -19
- package/src/features/ChatInput/ActionBar/Params/{ParamsControls.tsx → Controls.tsx} +9 -9
- package/src/features/ChatInput/ActionBar/Params/index.tsx +17 -20
- package/src/features/ChatInput/{STT → ActionBar/STT}/common.tsx +1 -0
- package/src/features/ChatInput/ActionBar/Search/{SwitchPanel.tsx → Controls.tsx} +12 -11
- package/src/features/ChatInput/ActionBar/Search/index.tsx +20 -25
- package/src/features/ChatInput/ActionBar/Token/TokenTag.tsx +1 -1
- package/src/features/ChatInput/ActionBar/Tools/ToolItem.tsx +15 -6
- package/src/features/ChatInput/ActionBar/Tools/index.tsx +26 -18
- package/src/features/ChatInput/ActionBar/Tools/{Dropdown.tsx → useControls.tsx} +38 -63
- package/src/features/ChatInput/ActionBar/Upload/ServerMode.tsx +10 -11
- package/src/features/ChatInput/ActionBar/components/Action.tsx +90 -0
- package/src/features/ChatInput/{components → ActionBar/components}/ActionDropdown.tsx +4 -4
- package/src/features/ChatInput/{components → ActionBar/components}/ActionPopover.tsx +5 -4
- package/src/features/ChatInput/ActionBar/{Knowledge/ListItem.tsx → components/CheckbokWithLoading.tsx} +14 -12
- package/src/features/ChatInput/ActionBar/config.ts +1 -1
- package/src/features/Conversation/Error/OllamaBizError/index.tsx +2 -2
- package/src/features/Conversation/Error/index.tsx +3 -10
- package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/Loading.tsx +1 -1
- package/src/features/ModelSwitchPanel/index.tsx +18 -5
- package/src/features/{Conversation/Error/OllamaDesktopSetupGuide/index.tsx → OllamaSetupGuide/Desktop.tsx} +25 -20
- package/src/features/OllamaSetupGuide/index.tsx +17 -0
- package/src/features/ShareModal/ShareImage/ChatList/index.tsx +1 -1
- package/src/features/ShareModal/ShareImage/Preview.tsx +2 -2
- package/src/features/ShareModal/ShareImage/index.tsx +8 -6
- package/src/hooks/useImgToClipboard.ts +4 -1
- package/src/layout/GlobalProvider/Locale.tsx +0 -8
- package/src/libs/agent-runtime/siliconcloud/index.ts +14 -1
- package/src/locales/default/components.ts +1 -0
- package/src/utils/server/auth.ts +6 -0
- package/src/features/ChatInput/ActionBar/History.tsx +0 -78
- package/src/features/Conversation/Error/OllamaBizError/SetupGuide.tsx +0 -14
- /package/src/features/ChatInput/{STT → ActionBar/STT}/browser.tsx +0 -0
- /package/src/features/ChatInput/{STT → ActionBar/STT}/index.tsx +0 -0
- /package/src/features/ChatInput/{STT → ActionBar/STT}/openai.tsx +0 -0
@@ -1,22 +1,22 @@
|
|
1
1
|
import { Icon } from '@lobehub/ui';
|
2
2
|
import { Checkbox } from 'antd';
|
3
3
|
import { Loader2 } from 'lucide-react';
|
4
|
-
import { memo, useState } from 'react';
|
4
|
+
import { ReactNode, memo, useState } from 'react';
|
5
5
|
import { Center, Flexbox } from 'react-layout-kit';
|
6
6
|
|
7
|
-
interface
|
8
|
-
|
7
|
+
export interface CheckboxItemProps {
|
8
|
+
checked?: boolean;
|
9
9
|
id: string;
|
10
|
-
label
|
10
|
+
label?: ReactNode;
|
11
11
|
onUpdate: (id: string, enabled: boolean) => Promise<void>;
|
12
12
|
}
|
13
13
|
|
14
|
-
const
|
14
|
+
const CheckboxItem = memo<CheckboxItemProps>(({ id, onUpdate, label, checked }) => {
|
15
15
|
const [loading, setLoading] = useState(false);
|
16
16
|
|
17
17
|
const updateState = async () => {
|
18
18
|
setLoading(true);
|
19
|
-
await onUpdate(id, !
|
19
|
+
await onUpdate(id, !checked);
|
20
20
|
setLoading(false);
|
21
21
|
};
|
22
22
|
|
@@ -29,19 +29,21 @@ const ListItem = memo<FileItemProps>(({ id, onUpdate, label, enabled }) => {
|
|
29
29
|
e.stopPropagation();
|
30
30
|
updateState();
|
31
31
|
}}
|
32
|
-
|
32
|
+
style={{
|
33
|
+
paddingLeft: 8,
|
34
|
+
}}
|
33
35
|
>
|
34
|
-
{label}
|
36
|
+
{label || id}
|
35
37
|
{loading ? (
|
36
38
|
<Center width={18}>
|
37
39
|
<Icon icon={Loader2} spin />
|
38
40
|
</Center>
|
39
41
|
) : (
|
40
42
|
<Checkbox
|
41
|
-
checked={
|
42
|
-
onClick={(e) => {
|
43
|
+
checked={checked}
|
44
|
+
onClick={async (e) => {
|
43
45
|
e.stopPropagation();
|
44
|
-
updateState();
|
46
|
+
await updateState();
|
45
47
|
}}
|
46
48
|
/>
|
47
49
|
)}
|
@@ -49,4 +51,4 @@ const ListItem = memo<FileItemProps>(({ id, onUpdate, label, enabled }) => {
|
|
49
51
|
);
|
50
52
|
});
|
51
53
|
|
52
|
-
export default
|
54
|
+
export default CheckboxItem;
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import STT from '../STT';
|
2
1
|
import Clear from './Clear';
|
3
2
|
import History from './History';
|
4
3
|
import Knowledge from './Knowledge';
|
5
4
|
import Model from './Model';
|
6
5
|
import Params from './Params';
|
6
|
+
import STT from './STT';
|
7
7
|
import Search from './Search';
|
8
8
|
import { MainToken, PortalToken } from './Token';
|
9
9
|
import Tools from './Tools';
|
@@ -8,7 +8,7 @@ import ErrorJsonViewer from '../ErrorJsonViewer';
|
|
8
8
|
|
9
9
|
const loading = () => <Skeleton active style={{ width: 300 }} />;
|
10
10
|
|
11
|
-
const SetupGuide = dynamic(() => import('
|
11
|
+
const SetupGuide = dynamic(() => import('@/features/OllamaSetupGuide'), { loading, ssr: false });
|
12
12
|
|
13
13
|
const InvalidModel = dynamic(() => import('./InvalidOllamaModel'), { loading, ssr: false });
|
14
14
|
|
@@ -38,7 +38,7 @@ const OllamaBizError = memo<ChatMessage>(({ error, id }) => {
|
|
38
38
|
|
39
39
|
// error of not enable model or not set the CORS rules
|
40
40
|
if (errorMessage?.includes('Failed to fetch')) {
|
41
|
-
return <SetupGuide />;
|
41
|
+
return <SetupGuide id={id} />;
|
42
42
|
}
|
43
43
|
|
44
44
|
return <ErrorJsonViewer error={error} id={id} />;
|
@@ -5,7 +5,6 @@ import dynamic from 'next/dynamic';
|
|
5
5
|
import { Suspense, memo, useMemo } from 'react';
|
6
6
|
import { useTranslation } from 'react-i18next';
|
7
7
|
|
8
|
-
import { isDesktop } from '@/const/version';
|
9
8
|
import { useProviderName } from '@/hooks/useProviderName';
|
10
9
|
import { AgentRuntimeErrorType, ILobeAgentRuntimeErrorType } from '@/libs/agent-runtime';
|
11
10
|
import { ChatErrorType, ErrorType } from '@/types/fetch';
|
@@ -20,11 +19,8 @@ import { ErrorActionContainer } from './style';
|
|
20
19
|
const loading = () => <Skeleton active />;
|
21
20
|
|
22
21
|
const OllamaBizError = dynamic(() => import('./OllamaBizError'), { loading, ssr: false });
|
23
|
-
|
24
|
-
|
25
|
-
ssr: false,
|
26
|
-
});
|
27
|
-
const OllamaDesktopSetupGuide = dynamic(() => import('./OllamaDesktopSetupGuide'), {
|
22
|
+
|
23
|
+
const OllamaSetupGuide = dynamic(() => import('@/features/OllamaSetupGuide'), {
|
28
24
|
loading,
|
29
25
|
ssr: false,
|
30
26
|
});
|
@@ -95,11 +91,8 @@ const ErrorMessageExtra = memo<{ data: ChatMessage }>(({ data }) => {
|
|
95
91
|
if (!error?.type) return;
|
96
92
|
|
97
93
|
switch (error.type) {
|
98
|
-
// TODO: 优化 Ollama setup 的流程,isDesktop 模式下可以直接做到端到端检测
|
99
94
|
case AgentRuntimeErrorType.OllamaServiceUnavailable: {
|
100
|
-
|
101
|
-
|
102
|
-
return <OllamaSetupGuide />;
|
95
|
+
return <OllamaSetupGuide id={data.id} />;
|
103
96
|
}
|
104
97
|
|
105
98
|
case AgentRuntimeErrorType.OllamaBizError: {
|
@@ -10,7 +10,7 @@ import { Flexbox } from 'react-layout-kit';
|
|
10
10
|
|
11
11
|
import { ModelItemRender, ProviderItemRender } from '@/components/ModelSelect';
|
12
12
|
import { isDeprecatedEdition } from '@/const/version';
|
13
|
-
import ActionDropdown from '@/features/ChatInput/components/ActionDropdown';
|
13
|
+
import ActionDropdown from '@/features/ChatInput/ActionBar/components/ActionDropdown';
|
14
14
|
import { useEnabledChatModels } from '@/hooks/useEnabledChatModels';
|
15
15
|
import { useAgentStore } from '@/store/agent';
|
16
16
|
import { agentSelectors } from '@/store/agent/slices/chat';
|
@@ -40,7 +40,14 @@ const useStyles = createStyles(({ css, prefixCls }) => ({
|
|
40
40
|
|
41
41
|
const menuKey = (provider: string, model: string) => `${provider}-${model}`;
|
42
42
|
|
43
|
-
const ModelSwitchPanel = memo<
|
43
|
+
const ModelSwitchPanel = memo<
|
44
|
+
PropsWithChildren<{
|
45
|
+
onOpenChange?: (open: boolean) => void;
|
46
|
+
open?: boolean;
|
47
|
+
setUpdating?: (updating: boolean) => void;
|
48
|
+
updating?: boolean;
|
49
|
+
}>
|
50
|
+
>(({ children, setUpdating, onOpenChange, open }) => {
|
44
51
|
const { t } = useTranslation('components');
|
45
52
|
const { styles, theme } = useStyles();
|
46
53
|
const [model, provider, updateAgentConfig] = useAgentStore((s) => [
|
@@ -57,8 +64,10 @@ const ModelSwitchPanel = memo<PropsWithChildren>(({ children }) => {
|
|
57
64
|
const items = provider.children.map((model) => ({
|
58
65
|
key: menuKey(provider.id, model.id),
|
59
66
|
label: <ModelItemRender {...model} {...model.abilities} />,
|
60
|
-
onClick: () => {
|
61
|
-
|
67
|
+
onClick: async () => {
|
68
|
+
setUpdating?.(true);
|
69
|
+
await updateAgentConfig({ model: model.id, provider: provider.id });
|
70
|
+
setUpdating?.(false);
|
62
71
|
},
|
63
72
|
}));
|
64
73
|
|
@@ -129,6 +138,8 @@ const ModelSwitchPanel = memo<PropsWithChildren>(({ children }) => {
|
|
129
138
|
}));
|
130
139
|
}, [enabledList]);
|
131
140
|
|
141
|
+
const icon = <div className={styles.tag}>{children}</div>;
|
142
|
+
|
132
143
|
return (
|
133
144
|
<ActionDropdown
|
134
145
|
menu={{
|
@@ -142,9 +153,11 @@ const ModelSwitchPanel = memo<PropsWithChildren>(({ children }) => {
|
|
142
153
|
overflowY: 'scroll',
|
143
154
|
},
|
144
155
|
}}
|
156
|
+
onOpenChange={onOpenChange}
|
157
|
+
open={open}
|
145
158
|
placement={'topLeft'}
|
146
159
|
>
|
147
|
-
|
160
|
+
{icon}
|
148
161
|
</ActionDropdown>
|
149
162
|
);
|
150
163
|
});
|
@@ -9,9 +9,10 @@ import { Center } from 'react-layout-kit';
|
|
9
9
|
import FormAction from '@/components/FormAction';
|
10
10
|
import { useChatStore } from '@/store/chat';
|
11
11
|
|
12
|
-
import { ErrorActionContainer } from '../style';
|
12
|
+
import { ErrorActionContainer } from '../Conversation/Error/style';
|
13
13
|
|
14
|
-
|
14
|
+
// TODO: 优化 Ollama setup 的流程,isDesktop 模式下可以直接做到端到端检测
|
15
|
+
const OllamaDesktopSetupGuide = memo<{ id?: string }>(({ id }) => {
|
15
16
|
const theme = useTheme();
|
16
17
|
const { t } = useTranslation('components');
|
17
18
|
|
@@ -35,24 +36,28 @@ const OllamaDesktopSetupGuide = memo<{ id: string }>(({ id }) => {
|
|
35
36
|
}
|
36
37
|
title={t('OllamaSetupGuide.install.title')}
|
37
38
|
/>
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
39
|
+
{id && (
|
40
|
+
<>
|
41
|
+
<Button
|
42
|
+
block
|
43
|
+
onClick={() => {
|
44
|
+
delAndRegenerateMessage(id);
|
45
|
+
}}
|
46
|
+
style={{ marginTop: 8 }}
|
47
|
+
type={'primary'}
|
48
|
+
>
|
49
|
+
{t('OllamaSetupGuide.action.start')}
|
50
|
+
</Button>
|
51
|
+
<Button
|
52
|
+
block
|
53
|
+
onClick={() => {
|
54
|
+
deleteMessage(id);
|
55
|
+
}}
|
56
|
+
>
|
57
|
+
{t('OllamaSetupGuide.action.close')}
|
58
|
+
</Button>
|
59
|
+
</>
|
60
|
+
)}
|
56
61
|
</Center>
|
57
62
|
</ErrorActionContainer>
|
58
63
|
);
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { memo } from 'react';
|
2
|
+
|
3
|
+
import OllamaSetupGuide from '@/components/OllamaSetupGuide';
|
4
|
+
import { isDesktop } from '@/const/version';
|
5
|
+
import { ErrorActionContainer } from '@/features/Conversation/Error/style';
|
6
|
+
|
7
|
+
import OllamaDesktopSetupGuide from './Desktop';
|
8
|
+
|
9
|
+
const SetupGuide = memo<{ container?: boolean; id?: string }>(({ id, container = true }) => {
|
10
|
+
const content = isDesktop ? <OllamaDesktopSetupGuide id={id} /> : <OllamaSetupGuide />;
|
11
|
+
|
12
|
+
if (!container) return content;
|
13
|
+
|
14
|
+
return <ErrorActionContainer style={{ paddingBlock: 0 }}>{content}</ErrorActionContainer>;
|
15
|
+
});
|
16
|
+
|
17
|
+
export default SetupGuide;
|
@@ -9,7 +9,7 @@ const ChatList = memo(() => {
|
|
9
9
|
const ids = useChatStore(chatSelectors.mainDisplayChatIDs);
|
10
10
|
|
11
11
|
return (
|
12
|
-
<Flexbox height={'100%'} style={{ paddingTop: 24, position: 'relative' }}>
|
12
|
+
<Flexbox height={'100%'} style={{ paddingTop: 24, position: 'relative' }} width={'100%'}>
|
13
13
|
{ids.map((id, index) => (
|
14
14
|
<ChatItem id={id} index={index} key={id} />
|
15
15
|
))}
|
@@ -49,10 +49,10 @@ const Preview = memo<FieldType & { title?: string }>(
|
|
49
49
|
<ChatHeaderTitle
|
50
50
|
desc={displayDesc}
|
51
51
|
tag={
|
52
|
-
|
52
|
+
<Flexbox gap={4} horizontal>
|
53
53
|
<ModelTag model={model} />
|
54
54
|
{plugins?.length > 0 && <PluginTag plugins={plugins} />}
|
55
|
-
|
55
|
+
</Flexbox>
|
56
56
|
}
|
57
57
|
title={displayTitle}
|
58
58
|
/>
|
@@ -24,7 +24,7 @@ const DEFAULT_FIELD_VALUE: FieldType = {
|
|
24
24
|
withSystemRole: false,
|
25
25
|
};
|
26
26
|
|
27
|
-
const ShareImage = memo<{ mobile?: boolean }>((
|
27
|
+
const ShareImage = memo<{ mobile?: boolean }>(() => {
|
28
28
|
const currentAgentTitle = useSessionStore(sessionMetaSelectors.currentAgentTitle);
|
29
29
|
const [fieldValue, setFieldValue] = useState<FieldType>(DEFAULT_FIELD_VALUE);
|
30
30
|
const { t } = useTranslation(['chat', 'common']);
|
@@ -32,11 +32,8 @@ const ShareImage = memo<{ mobile?: boolean }>(({ mobile }) => {
|
|
32
32
|
const { loading, onDownload, title } = useScreenshot({
|
33
33
|
imageType: fieldValue.imageType,
|
34
34
|
title: currentAgentTitle,
|
35
|
-
width: mobile ? 720 : undefined,
|
36
|
-
});
|
37
|
-
const { loading: copyLoading, onCopy } = useImgToClipboard({
|
38
|
-
width: mobile ? 720 : undefined,
|
39
35
|
});
|
36
|
+
const { loading: copyLoading, onCopy } = useImgToClipboard();
|
40
37
|
const settings: FormItemProps[] = [
|
41
38
|
{
|
42
39
|
children: <Switch />,
|
@@ -65,6 +62,7 @@ const ShareImage = memo<{ mobile?: boolean }>(({ mobile }) => {
|
|
65
62
|
{
|
66
63
|
children: <Segmented options={imageTypeOptions} />,
|
67
64
|
label: t('shareModal.imageType'),
|
65
|
+
layout: 'horizontal',
|
68
66
|
minWidth: undefined,
|
69
67
|
name: 'imageType',
|
70
68
|
},
|
@@ -105,7 +103,11 @@ const ShareImage = memo<{ mobile?: boolean }>(({ mobile }) => {
|
|
105
103
|
{!isMobile && button}
|
106
104
|
</Flexbox>
|
107
105
|
</Flexbox>
|
108
|
-
{isMobile &&
|
106
|
+
{isMobile && (
|
107
|
+
<Flexbox className={styles.footer} gap={8} horizontal>
|
108
|
+
{button}
|
109
|
+
</Flexbox>
|
110
|
+
)}
|
109
111
|
</>
|
110
112
|
);
|
111
113
|
});
|
@@ -4,7 +4,10 @@ import { useState } from 'react';
|
|
4
4
|
|
5
5
|
import { ImageType, getImageUrl } from './useScreenshot';
|
6
6
|
|
7
|
-
export const useImgToClipboard = ({
|
7
|
+
export const useImgToClipboard = ({
|
8
|
+
id = '#preview',
|
9
|
+
width,
|
10
|
+
}: { id?: string; width?: number } = {}) => {
|
8
11
|
const [loading, setLoading] = useState(false);
|
9
12
|
const { message } = App.useApp();
|
10
13
|
|
@@ -88,11 +88,7 @@ const Locale = memo<LocaleLayoutProps>(({ children, defaultLang, antdLocale }) =
|
|
88
88
|
theme={{
|
89
89
|
components: {
|
90
90
|
Button: {
|
91
|
-
borderRadiusSM: 6,
|
92
91
|
contentFontSizeSM: 12,
|
93
|
-
defaultActiveBorderColor: theme.colorBorder,
|
94
|
-
defaultActiveColor: theme.colorText,
|
95
|
-
groupBorderColor: theme.colorBorder,
|
96
92
|
},
|
97
93
|
DatePicker: {
|
98
94
|
activeBorderColor: theme.colorBorder,
|
@@ -114,10 +110,6 @@ const Locale = memo<LocaleLayoutProps>(({ children, defaultLang, antdLocale }) =
|
|
114
110
|
activeBorderColor: theme.colorBorder,
|
115
111
|
hoverBorderColor: theme.colorBorder,
|
116
112
|
},
|
117
|
-
Typography: {
|
118
|
-
titleMarginBottom: 0,
|
119
|
-
titleMarginTop: 0,
|
120
|
-
},
|
121
113
|
},
|
122
114
|
}}
|
123
115
|
>
|
@@ -40,8 +40,21 @@ export const LobeSiliconCloudAI = LobeOpenAICompatibleFactory({
|
|
40
40
|
};
|
41
41
|
},
|
42
42
|
handlePayload: (payload) => {
|
43
|
+
const { max_tokens, model, thinking, ...rest } = payload;
|
44
|
+
const thinkingBudget = thinking?.budget_tokens === 0 ? 1 : (thinking?.budget_tokens || undefined)
|
45
|
+
|
43
46
|
return {
|
44
|
-
...
|
47
|
+
...rest,
|
48
|
+
...( ['qwen3'].some(keyword => model.toLowerCase().includes(keyword))
|
49
|
+
? {
|
50
|
+
enable_thinking: thinking !== undefined ? thinking.type === 'enabled' : false,
|
51
|
+
thinking_budget: thinkingBudget === undefined ? undefined : Math.min(Math.max(thinkingBudget, 1), 32_768),
|
52
|
+
}
|
53
|
+
: {}),
|
54
|
+
max_tokens: max_tokens === undefined
|
55
|
+
? undefined
|
56
|
+
: Math.min(Math.max(max_tokens, 1), 16_384),
|
57
|
+
model,
|
45
58
|
stream: !payload.tools,
|
46
59
|
} as any;
|
47
60
|
},
|
package/src/utils/server/auth.ts
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
import { enableClerk, enableNextAuth } from '@/const/auth';
|
2
|
+
import { DESKTOP_USER_ID } from '@/const/desktop';
|
3
|
+
import { isDesktop } from '@/const/version';
|
2
4
|
|
3
5
|
export const getUserAuth = async () => {
|
4
6
|
if (enableClerk) {
|
@@ -19,6 +21,10 @@ export const getUserAuth = async () => {
|
|
19
21
|
return { nextAuth: session, userId };
|
20
22
|
}
|
21
23
|
|
24
|
+
if (isDesktop) {
|
25
|
+
return { userId: DESKTOP_USER_ID };
|
26
|
+
}
|
27
|
+
|
22
28
|
throw new Error('Auth method is not enabled');
|
23
29
|
};
|
24
30
|
|
@@ -1,78 +0,0 @@
|
|
1
|
-
import { ActionIcon, SliderWithInput } from '@lobehub/ui';
|
2
|
-
import { Switch } from 'antd';
|
3
|
-
import { Timer, TimerOff } from 'lucide-react';
|
4
|
-
import { memo, useState } from 'react';
|
5
|
-
import { useTranslation } from 'react-i18next';
|
6
|
-
|
7
|
-
import { useAgentStore } from '@/store/agent';
|
8
|
-
import { agentChatConfigSelectors } from '@/store/agent/selectors';
|
9
|
-
|
10
|
-
import ActionPopover from '../components/ActionPopover';
|
11
|
-
|
12
|
-
const History = memo(() => {
|
13
|
-
const { t } = useTranslation('setting');
|
14
|
-
const [loading, setLoading] = useState(false);
|
15
|
-
const [popoverOpen, setPopoverOpen] = useState(false);
|
16
|
-
|
17
|
-
const [historyCount, enableHistoryCount, updateAgentConfig] = useAgentStore((s) => {
|
18
|
-
return [
|
19
|
-
agentChatConfigSelectors.historyCount(s),
|
20
|
-
agentChatConfigSelectors.enableHistoryCount(s),
|
21
|
-
s.updateAgentChatConfig,
|
22
|
-
];
|
23
|
-
});
|
24
|
-
|
25
|
-
const title = t(
|
26
|
-
enableHistoryCount
|
27
|
-
? 'settingChat.enableHistoryCount.limited'
|
28
|
-
: 'settingChat.enableHistoryCount.unlimited',
|
29
|
-
{ number: historyCount || 0 },
|
30
|
-
);
|
31
|
-
|
32
|
-
return (
|
33
|
-
<ActionPopover
|
34
|
-
arrow={false}
|
35
|
-
content={
|
36
|
-
<SliderWithInput
|
37
|
-
disabled={!enableHistoryCount}
|
38
|
-
max={20}
|
39
|
-
min={0}
|
40
|
-
onChange={async (v) => {
|
41
|
-
setLoading(true);
|
42
|
-
await updateAgentConfig({ historyCount: v });
|
43
|
-
setLoading(false);
|
44
|
-
}}
|
45
|
-
size={'small'}
|
46
|
-
step={1}
|
47
|
-
value={historyCount}
|
48
|
-
/>
|
49
|
-
}
|
50
|
-
extra={
|
51
|
-
<Switch
|
52
|
-
checked={enableHistoryCount}
|
53
|
-
loading={loading}
|
54
|
-
onChange={async (enableHistoryCount) => {
|
55
|
-
setLoading(true);
|
56
|
-
await updateAgentConfig({ enableHistoryCount });
|
57
|
-
setLoading(false);
|
58
|
-
}}
|
59
|
-
size={'small'}
|
60
|
-
/>
|
61
|
-
}
|
62
|
-
minWidth={240}
|
63
|
-
onOpenChange={setPopoverOpen}
|
64
|
-
open={popoverOpen}
|
65
|
-
title={t('settingChat.enableHistoryCount.title')}
|
66
|
-
>
|
67
|
-
<ActionIcon
|
68
|
-
icon={enableHistoryCount ? Timer : TimerOff}
|
69
|
-
title={title}
|
70
|
-
tooltipProps={{
|
71
|
-
placement: 'bottom',
|
72
|
-
}}
|
73
|
-
/>
|
74
|
-
</ActionPopover>
|
75
|
-
);
|
76
|
-
});
|
77
|
-
|
78
|
-
export default History;
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import { memo } from 'react';
|
2
|
-
|
3
|
-
import OllamaSetupGuide from '@/components/OllamaSetupGuide';
|
4
|
-
import { ErrorActionContainer } from '@/features/Conversation/Error/style';
|
5
|
-
|
6
|
-
const SetupGuide = memo(() => {
|
7
|
-
return (
|
8
|
-
<ErrorActionContainer style={{ paddingBlock: 0 }}>
|
9
|
-
<OllamaSetupGuide />
|
10
|
-
</ErrorActionContainer>
|
11
|
-
);
|
12
|
-
});
|
13
|
-
|
14
|
-
export default SetupGuide;
|
File without changes
|
File without changes
|
File without changes
|