@lobehub/lobehub 2.0.0-next.67 → 2.0.0-next.69
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 +50 -0
- package/changelog/v1.json +18 -0
- package/package.json +2 -8
- package/packages/const/src/version.ts +0 -5
- package/packages/database/src/models/__tests__/chunk.test.ts +38 -0
- package/packages/model-runtime/src/core/streams/ollama.test.ts +67 -0
- package/packages/model-runtime/src/core/streams/ollama.ts +5 -5
- package/src/app/(backend)/api/webhooks/clerk/route.ts +1 -2
- package/src/app/[variants]/(main)/(mobile)/me/(home)/__tests__/useCategory.test.tsx +0 -20
- package/src/app/[variants]/(main)/(mobile)/me/(home)/features/useCategory.tsx +4 -33
- package/src/app/[variants]/(main)/(mobile)/me/profile/features/Category.tsx +18 -23
- package/src/app/[variants]/(main)/(mobile)/me/settings/features/useCategory.tsx +5 -15
- package/src/app/[variants]/(main)/discover/(detail)/provider/[...slugs]/features/Sidebar/ActionButton/ProviderConfig.tsx +4 -11
- package/src/app/[variants]/(main)/image/@menu/features/ConfigPanel/components/ModelSelect/index.tsx +12 -27
- package/src/app/[variants]/(main)/image/layout.tsx +0 -4
- package/src/app/[variants]/(main)/profile/hooks/useCategory.tsx +10 -13
- package/src/app/[variants]/(main)/profile/stats/features/ShareButton/Preview.tsx +2 -14
- package/src/app/[variants]/(main)/settings/_layout/Desktop/index.tsx +2 -3
- package/src/app/[variants]/(main)/settings/_layout/SettingsContent.tsx +1 -12
- package/src/app/[variants]/(main)/settings/_layout/type.ts +0 -1
- package/src/app/[variants]/(main)/settings/hooks/useCategory.tsx +8 -16
- package/src/app/[variants]/(main)/settings/page.tsx +3 -7
- package/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/index.tsx +2 -4
- package/src/app/[variants]/(main)/settings/storage/index.tsx +1 -9
- package/src/app/[variants]/(main)/settings/system-agent/index.tsx +1 -2
- package/src/components/InvalidAPIKey/APIKeyForm/useApiKey.ts +0 -12
- package/src/config/featureFlags/schema.test.ts +1 -3
- package/src/config/featureFlags/schema.ts +0 -3
- package/src/features/ChatInput/ActionBar/Knowledge/index.tsx +2 -3
- package/src/features/ChatInput/ActionBar/Search/index.tsx +5 -7
- package/src/features/ChatInput/ActionBar/Upload/index.tsx +1 -3
- package/src/features/Conversation/Messages/Assistant/index.tsx +1 -1
- package/src/features/Conversation/components/ShareMessageModal/index.tsx +3 -8
- package/src/features/DevPanel/PostgresViewer/usePgTable.ts +3 -11
- package/src/features/ModelSwitchPanel/index.tsx +9 -24
- package/src/features/ShareModal/index.tsx +7 -13
- package/src/features/User/UserPanel/PanelContent.tsx +6 -8
- package/src/hooks/useCheckPluginsIsInstalled.ts +1 -4
- package/src/hooks/useFetchGroups.ts +1 -4
- package/src/hooks/useFetchInstalledPlugins.ts +1 -4
- package/src/hooks/useFetchMessages.ts +1 -4
- package/src/hooks/useFetchSessions.ts +1 -4
- package/src/hooks/useFetchThreads.ts +1 -5
- package/src/hooks/useFetchTopics.ts +1 -4
- package/src/hooks/useInterceptingRoutes.test.ts +0 -19
- package/src/hooks/useInterceptingRoutes.ts +1 -7
- package/src/layout/GlobalProvider/StoreInitialization.tsx +2 -4
- package/src/services/_auth.ts +2 -11
- package/src/services/_header.ts +2 -10
- package/src/services/chat/chat.test.ts +53 -10
- package/src/services/chat/clientModelRuntime.test.ts +108 -172
- package/src/services/chat/contextEngineering.ts +2 -2
- package/src/services/config.ts +2 -2
- package/src/store/aiInfra/slices/aiProvider/action.ts +3 -4
- package/src/store/chat/slices/thread/action.ts +2 -2
- package/src/store/global/selectors/systemStatus.test.ts +0 -98
- package/src/store/global/selectors/systemStatus.ts +0 -30
- package/src/store/serverConfig/selectors.test.ts +2 -2
- package/src/store/serverConfig/store.test.ts +0 -1
- package/src/app/[variants]/(main)/settings/storage/IndexedDBStorage.tsx +0 -55
- package/src/features/ChatInput/ActionBar/Upload/ClientMode.tsx +0 -62
|
@@ -4,8 +4,6 @@ import Link from 'next/link';
|
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
|
|
6
6
|
import type { MenuProps } from '@/components/Menu';
|
|
7
|
-
import { enableAuth } from '@/const/auth';
|
|
8
|
-
import { isDeprecatedEdition } from '@/const/version';
|
|
9
7
|
import { ProfileTabs } from '@/store/global/initialState';
|
|
10
8
|
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
11
9
|
import { useUserStore } from '@/store/user';
|
|
@@ -26,17 +24,16 @@ export const useCategory = () => {
|
|
|
26
24
|
</Link>
|
|
27
25
|
),
|
|
28
26
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
!isDeprecatedEdition && {
|
|
27
|
+
isLoginWithClerk && {
|
|
28
|
+
icon: <Icon icon={ShieldCheck} />,
|
|
29
|
+
key: ProfileTabs.Security,
|
|
30
|
+
label: (
|
|
31
|
+
<Link href={'/profile/security'} onClick={(e) => e.preventDefault()}>
|
|
32
|
+
{t('tab.security')}
|
|
33
|
+
</Link>
|
|
34
|
+
),
|
|
35
|
+
},
|
|
36
|
+
{
|
|
40
37
|
icon: <Icon icon={ChartColumnBigIcon} />,
|
|
41
38
|
key: ProfileTabs.Stats,
|
|
42
39
|
label: (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OFFICIAL_URL, imageUrl } from '@lobechat/const';
|
|
2
2
|
import { Grid } from '@lobehub/ui';
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
import { memo } from 'react';
|
|
@@ -6,8 +6,6 @@ import { useTranslation } from 'react-i18next';
|
|
|
6
6
|
import { Center, Flexbox } from 'react-layout-kit';
|
|
7
7
|
|
|
8
8
|
import { ProductLogo } from '@/components/Branding';
|
|
9
|
-
import { OFFICIAL_URL, imageUrl } from '@/const/url';
|
|
10
|
-
import { isServerMode } from '@/const/version';
|
|
11
9
|
import UserAvatar from '@/features/User/UserAvatar';
|
|
12
10
|
|
|
13
11
|
import AiHeatmaps from '../AiHeatmaps';
|
|
@@ -94,7 +92,6 @@ const useStyles = createStyles(({ css, token, stylish, cx, responsive }) => ({
|
|
|
94
92
|
const Preview = memo(() => {
|
|
95
93
|
const { styles } = useStyles();
|
|
96
94
|
const { t } = useTranslation('auth');
|
|
97
|
-
const isOfficial = !isServerMode && OFFICIAL_URL.includes(location.host);
|
|
98
95
|
|
|
99
96
|
return (
|
|
100
97
|
<div className={styles.preview}>
|
|
@@ -140,16 +137,7 @@ const Preview = memo(() => {
|
|
|
140
137
|
<TotalWords inShare />
|
|
141
138
|
</Grid>
|
|
142
139
|
</Flexbox>
|
|
143
|
-
<div className={styles.footer}>
|
|
144
|
-
{isOfficial ? (
|
|
145
|
-
OFFICIAL_URL
|
|
146
|
-
) : (
|
|
147
|
-
<Flexbox align={'center'} gap={8} horizontal>
|
|
148
|
-
<Github size={16} />
|
|
149
|
-
<span>lobehub/lobe-chat</span>
|
|
150
|
-
</Flexbox>
|
|
151
|
-
)}
|
|
152
|
-
</div>
|
|
140
|
+
<div className={styles.footer}>{OFFICIAL_URL}</div>
|
|
153
141
|
</Center>
|
|
154
142
|
</div>
|
|
155
143
|
</div>
|
|
@@ -14,8 +14,7 @@ import { LayoutProps } from '../type';
|
|
|
14
14
|
import Header from './Header';
|
|
15
15
|
import SideBar from './SideBar';
|
|
16
16
|
|
|
17
|
-
const Layout = memo<LayoutProps>((
|
|
18
|
-
const { showLLM = true } = props;
|
|
17
|
+
const Layout = memo<LayoutProps>(() => {
|
|
19
18
|
const ref = useRef<HTMLDivElement | null>(null);
|
|
20
19
|
const { md = true } = useResponsive();
|
|
21
20
|
const theme = useTheme();
|
|
@@ -40,7 +39,7 @@ const Layout = memo<LayoutProps>((props) => {
|
|
|
40
39
|
<Header getContainer={() => ref.current!}>{category}</Header>
|
|
41
40
|
)}
|
|
42
41
|
<SettingContainer maxWidth={'none'}>
|
|
43
|
-
<SettingsContent activeTab={activeTab} mobile={false}
|
|
42
|
+
<SettingsContent activeTab={activeTab} mobile={false} />
|
|
44
43
|
</SettingContainer>
|
|
45
44
|
</Flexbox>
|
|
46
45
|
);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import dynamic from 'next/dynamic';
|
|
4
|
-
import { notFound } from 'next/navigation';
|
|
5
4
|
import React, { CSSProperties } from 'react';
|
|
6
5
|
import { Flexbox } from 'react-layout-kit';
|
|
7
6
|
|
|
@@ -44,18 +43,9 @@ const componentMap = {
|
|
|
44
43
|
interface SettingsContentProps {
|
|
45
44
|
activeTab?: string;
|
|
46
45
|
mobile?: boolean;
|
|
47
|
-
showLLM?: boolean;
|
|
48
46
|
}
|
|
49
47
|
|
|
50
|
-
const SettingsContent = ({ mobile, activeTab
|
|
51
|
-
const shouldRenderLLMTabs = (tab: string) => {
|
|
52
|
-
const isLLMTab =
|
|
53
|
-
tab === SettingsTabs.LLM || tab === SettingsTabs.Provider || tab === SettingsTabs.Agent;
|
|
54
|
-
return showLLM || !isLLMTab;
|
|
55
|
-
};
|
|
56
|
-
if (activeTab && !shouldRenderLLMTabs(activeTab)) {
|
|
57
|
-
notFound();
|
|
58
|
-
}
|
|
48
|
+
const SettingsContent = ({ mobile, activeTab }: SettingsContentProps) => {
|
|
59
49
|
const renderComponent = (tab: string) => {
|
|
60
50
|
const Component = componentMap[tab as keyof typeof componentMap] || componentMap.common;
|
|
61
51
|
if (!Component) return null;
|
|
@@ -88,7 +78,6 @@ const SettingsContent = ({ mobile, activeTab, showLLM = true }: SettingsContentP
|
|
|
88
78
|
return (
|
|
89
79
|
<Flexbox height={'100%'} width={'100%'}>
|
|
90
80
|
{Object.keys(componentMap).map((tabKey) => {
|
|
91
|
-
if (!shouldRenderLLMTabs(tabKey)) return null;
|
|
92
81
|
return (
|
|
93
82
|
<div key={tabKey} style={getDisplayStyle(tabKey)}>
|
|
94
83
|
{activeTab === tabKey && renderComponent(tabKey)}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isDesktop } from '@lobechat/const';
|
|
1
2
|
import { Icon } from '@lobehub/ui';
|
|
2
3
|
import {
|
|
3
4
|
Bot,
|
|
@@ -15,14 +16,13 @@ import { useMemo } from 'react';
|
|
|
15
16
|
import { useTranslation } from 'react-i18next';
|
|
16
17
|
|
|
17
18
|
import type { MenuProps } from '@/components/Menu';
|
|
18
|
-
import { isDeprecatedEdition, isDesktop } from '@/const/version';
|
|
19
19
|
import { SettingsTabs } from '@/store/global/initialState';
|
|
20
20
|
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
21
21
|
|
|
22
22
|
export const useCategory = () => {
|
|
23
23
|
const { t } = useTranslation('setting');
|
|
24
24
|
const mobile = useServerConfigStore((s) => s.isMobile);
|
|
25
|
-
const {
|
|
25
|
+
const { enableSTT, hideDocs } = useServerConfigStore(featureFlagsSelectors);
|
|
26
26
|
|
|
27
27
|
const cateItems: MenuProps['items'] = useMemo(
|
|
28
28
|
() =>
|
|
@@ -45,19 +45,11 @@ export const useCategory = () => {
|
|
|
45
45
|
{
|
|
46
46
|
type: 'divider',
|
|
47
47
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
key: SettingsTabs.LLM,
|
|
54
|
-
label: t('tab.llm'),
|
|
55
|
-
}
|
|
56
|
-
: {
|
|
57
|
-
icon: <Icon icon={Brain} />,
|
|
58
|
-
key: SettingsTabs.Provider,
|
|
59
|
-
label: t('tab.provider'),
|
|
60
|
-
}),
|
|
48
|
+
{
|
|
49
|
+
icon: <Icon icon={Brain} />,
|
|
50
|
+
key: SettingsTabs.Provider,
|
|
51
|
+
label: t('tab.provider'),
|
|
52
|
+
},
|
|
61
53
|
{
|
|
62
54
|
icon: <Icon icon={ImageIcon} />,
|
|
63
55
|
key: SettingsTabs.Image,
|
|
@@ -92,7 +84,7 @@ export const useCategory = () => {
|
|
|
92
84
|
label: t('tab.about'),
|
|
93
85
|
},
|
|
94
86
|
].filter(Boolean) as MenuProps['items'],
|
|
95
|
-
[t,
|
|
87
|
+
[t, enableSTT, hideDocs, mobile],
|
|
96
88
|
);
|
|
97
89
|
|
|
98
90
|
return cateItems;
|
|
@@ -20,14 +20,9 @@ export const generateMetadata = async (props: DynamicLayoutProps) => {
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const SettingsLayout = ServerLayout<
|
|
24
|
-
LayoutProps & {
|
|
25
|
-
showLLM?: boolean;
|
|
26
|
-
}
|
|
27
|
-
>({ Desktop, Mobile });
|
|
23
|
+
const SettingsLayout = ServerLayout<LayoutProps>({ Desktop, Mobile });
|
|
28
24
|
|
|
29
25
|
const SettingsPage = async (props: DynamicLayoutProps) => {
|
|
30
|
-
const showLLM = serverFeatureFlags().showProvider;
|
|
31
26
|
const { showOpenAIProxyUrl, showOpenAIApiKey } = serverFeatureFlags();
|
|
32
27
|
|
|
33
28
|
return (
|
|
@@ -37,7 +32,8 @@ const SettingsPage = async (props: DynamicLayoutProps) => {
|
|
|
37
32
|
showOpenAIProxyUrl: showOpenAIProxyUrl,
|
|
38
33
|
}}
|
|
39
34
|
>
|
|
40
|
-
|
|
35
|
+
{/* @ts-ignore */}
|
|
36
|
+
<SettingsLayout {...props} />
|
|
41
37
|
</SettingsContextProvider>
|
|
42
38
|
);
|
|
43
39
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { AES_GCM_URL, BASE_PROVIDER_DOC_URL, FORM_STYLE, isDesktop } from '@lobechat/const';
|
|
3
4
|
import { ProviderCombine } from '@lobehub/icons';
|
|
4
5
|
import {
|
|
5
6
|
Avatar,
|
|
@@ -22,9 +23,6 @@ import { z } from 'zod';
|
|
|
22
23
|
|
|
23
24
|
import { FormInput, FormPassword } from '@/components/FormInput';
|
|
24
25
|
import { SkeletonInput, SkeletonSwitch } from '@/components/Skeleton';
|
|
25
|
-
import { FORM_STYLE } from '@/const/layoutTokens';
|
|
26
|
-
import { AES_GCM_URL, BASE_PROVIDER_DOC_URL } from '@/const/url';
|
|
27
|
-
import { isDesktop, isServerMode } from '@/const/version';
|
|
28
26
|
import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
|
|
29
27
|
import {
|
|
30
28
|
AiProviderDetailItem,
|
|
@@ -351,7 +349,7 @@ const ProviderConfig = memo<ProviderConfigProps>(
|
|
|
351
349
|
minWidth: undefined,
|
|
352
350
|
}
|
|
353
351
|
: undefined,
|
|
354
|
-
showAceGcm &&
|
|
352
|
+
showAceGcm && aceGcmItem,
|
|
355
353
|
].filter(Boolean) as FormItemProps[];
|
|
356
354
|
|
|
357
355
|
const logoUrl = data?.logo ?? logo;
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { isServerMode } from '@/const/version';
|
|
4
|
-
|
|
5
3
|
import Advanced from './Advanced';
|
|
6
|
-
import IndexedDBStorage from './IndexedDBStorage';
|
|
7
4
|
|
|
8
5
|
const StorageEstimate = () => {
|
|
9
|
-
return
|
|
10
|
-
<>
|
|
11
|
-
{!isServerMode && <IndexedDBStorage />}
|
|
12
|
-
<Advanced />
|
|
13
|
-
</>
|
|
14
|
-
);
|
|
6
|
+
return <Advanced />;
|
|
15
7
|
};
|
|
16
8
|
|
|
17
9
|
export default StorageEstimate;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { DEFAULT_REWRITE_QUERY } from '@lobechat/prompts';
|
|
4
4
|
|
|
5
|
-
import { isServerMode } from '@/const/version';
|
|
6
5
|
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
7
6
|
|
|
8
7
|
import SystemAgentForm from './features/SystemAgentForm';
|
|
@@ -16,7 +15,7 @@ const Page = () => {
|
|
|
16
15
|
<SystemAgentForm systemAgentKey="translation" />
|
|
17
16
|
<SystemAgentForm systemAgentKey="historyCompress" />
|
|
18
17
|
<SystemAgentForm systemAgentKey="agentMeta" />
|
|
19
|
-
{
|
|
18
|
+
{enableKnowledgeBase && (
|
|
20
19
|
<SystemAgentForm
|
|
21
20
|
allowCustomPrompt
|
|
22
21
|
allowDisable
|
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
import isEqual from 'fast-deep-equal';
|
|
2
2
|
import { useContext } from 'react';
|
|
3
3
|
|
|
4
|
-
import { isDeprecatedEdition } from '@/const/version';
|
|
5
4
|
import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
|
|
6
|
-
import { useUserStore } from '@/store/user';
|
|
7
|
-
import { keyVaultsConfigSelectors } from '@/store/user/selectors';
|
|
8
5
|
|
|
9
6
|
import { LoadingContext } from './LoadingContext';
|
|
10
7
|
|
|
11
8
|
export const useApiKey = (provider: string) => {
|
|
12
|
-
const [apiKey, baseURL, setConfig] = useUserStore((s) => [
|
|
13
|
-
keyVaultsConfigSelectors.getVaultByProvider(provider as any)(s)?.apiKey,
|
|
14
|
-
keyVaultsConfigSelectors.getVaultByProvider(provider as any)(s)?.baseURL,
|
|
15
|
-
s.updateKeyVaultConfig,
|
|
16
|
-
]);
|
|
17
9
|
const { setLoading } = useContext(LoadingContext);
|
|
18
10
|
const updateAiProviderConfig = useAiInfraStore((s) => s.updateAiProviderConfig);
|
|
19
11
|
const data = useAiInfraStore(aiProviderSelectors.providerConfigById(provider), isEqual);
|
|
20
12
|
|
|
21
|
-
// TODO: remove this in V2
|
|
22
|
-
if (isDeprecatedEdition) return { apiKey, baseURL, setConfig };
|
|
23
|
-
//
|
|
24
|
-
|
|
25
13
|
return {
|
|
26
14
|
apiKey: data?.keyVaults.apiKey,
|
|
27
15
|
baseURL: data?.keyVaults?.baseURL,
|
|
@@ -5,7 +5,7 @@ import { FeatureFlagsSchema, evaluateFeatureFlag, mapFeatureFlagsEnvToState } fr
|
|
|
5
5
|
describe('FeatureFlagsSchema', () => {
|
|
6
6
|
it('should validate correct feature flags with boolean values', () => {
|
|
7
7
|
const result = FeatureFlagsSchema.safeParse({
|
|
8
|
-
|
|
8
|
+
provider_settings: false,
|
|
9
9
|
openai_api_key: true,
|
|
10
10
|
openai_proxy_url: false,
|
|
11
11
|
create_session: true,
|
|
@@ -98,7 +98,6 @@ describe('evaluateFeatureFlag', () => {
|
|
|
98
98
|
describe('mapFeatureFlagsEnvToState', () => {
|
|
99
99
|
it('should correctly map boolean feature flags to state', () => {
|
|
100
100
|
const config = {
|
|
101
|
-
language_model_settings: false,
|
|
102
101
|
provider_settings: true,
|
|
103
102
|
openai_api_key: true,
|
|
104
103
|
openai_proxy_url: false,
|
|
@@ -126,7 +125,6 @@ describe('mapFeatureFlagsEnvToState', () => {
|
|
|
126
125
|
expect(mappedState).toMatchObject({
|
|
127
126
|
isAgentEditable: false,
|
|
128
127
|
showCreateSession: true,
|
|
129
|
-
showLLM: false,
|
|
130
128
|
showProvider: true,
|
|
131
129
|
showOpenAIApiKey: true,
|
|
132
130
|
showOpenAIProxyUrl: false,
|
|
@@ -9,7 +9,6 @@ export const FeatureFlagsSchema = z.object({
|
|
|
9
9
|
pin_list: FeatureFlagValue.optional(),
|
|
10
10
|
|
|
11
11
|
// settings
|
|
12
|
-
language_model_settings: FeatureFlagValue.optional(),
|
|
13
12
|
provider_settings: FeatureFlagValue.optional(),
|
|
14
13
|
|
|
15
14
|
openai_api_key: FeatureFlagValue.optional(),
|
|
@@ -69,7 +68,6 @@ export const evaluateFeatureFlag = (
|
|
|
69
68
|
export const DEFAULT_FEATURE_FLAGS: IFeatureFlags = {
|
|
70
69
|
pin_list: false,
|
|
71
70
|
|
|
72
|
-
language_model_settings: true,
|
|
73
71
|
provider_settings: true,
|
|
74
72
|
|
|
75
73
|
openai_api_key: true,
|
|
@@ -112,7 +110,6 @@ export const mapFeatureFlagsEnvToState = (config: IFeatureFlags, userId?: string
|
|
|
112
110
|
|
|
113
111
|
showCreateSession: evaluateFeatureFlag(config.create_session, userId),
|
|
114
112
|
enableGroupChat: evaluateFeatureFlag(config.group_chat, userId),
|
|
115
|
-
showLLM: evaluateFeatureFlag(config.language_model_settings, userId),
|
|
116
113
|
showProvider: evaluateFeatureFlag(config.provider_settings, userId),
|
|
117
114
|
showPinList: evaluateFeatureFlag(config.pin_list, userId),
|
|
118
115
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { LOBE_CHAT_CLOUD } from '@lobechat/const';
|
|
1
2
|
import { LibraryBig } from 'lucide-react';
|
|
2
3
|
import { Suspense, memo, useState } from 'react';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
5
|
|
|
5
6
|
import TipGuide from '@/components/TipGuide';
|
|
6
|
-
import { LOBE_CHAT_CLOUD } from '@/const/branding';
|
|
7
|
-
import { isServerMode } from '@/const/version';
|
|
8
7
|
import { AttachKnowledgeModal } from '@/features/KnowledgeBaseModal';
|
|
9
8
|
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
10
9
|
import { useUserStore } from '@/store/user';
|
|
@@ -13,7 +12,7 @@ import { preferenceSelectors } from '@/store/user/selectors';
|
|
|
13
12
|
import Action from '../components/Action';
|
|
14
13
|
import { useControls } from './useControls';
|
|
15
14
|
|
|
16
|
-
const enableKnowledge =
|
|
15
|
+
const enableKnowledge = true;
|
|
17
16
|
|
|
18
17
|
const Knowledge = memo(() => {
|
|
19
18
|
const { t } = useTranslation('chat');
|
|
@@ -4,7 +4,6 @@ import { Globe } from 'lucide-react';
|
|
|
4
4
|
import { memo } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
|
|
7
|
-
import { isDeprecatedEdition } from '@/const/version';
|
|
8
7
|
import { useAgentEnableSearch } from '@/hooks/useAgentEnableSearch';
|
|
9
8
|
import { useIsMobile } from '@/hooks/useIsMobile';
|
|
10
9
|
import { useAgentStore } from '@/store/agent';
|
|
@@ -25,7 +24,6 @@ const Search = memo(() => {
|
|
|
25
24
|
const theme = useTheme();
|
|
26
25
|
const isMobile = useIsMobile();
|
|
27
26
|
|
|
28
|
-
if (isDeprecatedEdition) return null;
|
|
29
27
|
if (isLoading) return <Action disabled icon={GlobeOffIcon} />;
|
|
30
28
|
|
|
31
29
|
return (
|
|
@@ -36,11 +34,11 @@ const Search = memo(() => {
|
|
|
36
34
|
isMobile
|
|
37
35
|
? undefined
|
|
38
36
|
: async (e) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
e?.preventDefault?.();
|
|
38
|
+
e?.stopPropagation?.();
|
|
39
|
+
const next = mode === 'off' ? 'auto' : 'off';
|
|
40
|
+
await updateAgentChatConfig({ searchMode: next });
|
|
41
|
+
}
|
|
44
42
|
}
|
|
45
43
|
popover={{
|
|
46
44
|
content: <Controls />,
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { isServerMode } from '@/const/version';
|
|
2
1
|
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
3
2
|
|
|
4
|
-
import ClientMode from './ClientMode';
|
|
5
3
|
import ServerMode from './ServerMode';
|
|
6
4
|
|
|
7
5
|
const Upload = () => {
|
|
8
6
|
const { enableKnowledgeBase } = useServerConfigStore(featureFlagsSelectors);
|
|
9
|
-
return
|
|
7
|
+
return enableKnowledgeBase && <ServerMode />;
|
|
10
8
|
};
|
|
11
9
|
|
|
12
10
|
export default Upload;
|
|
@@ -315,7 +315,7 @@ const AssistantMessage = memo<AssistantMessageProps>(
|
|
|
315
315
|
<Flexbox
|
|
316
316
|
className={styles.container}
|
|
317
317
|
gap={mobile ? 6 : 12}
|
|
318
|
-
style={isLatestItem ? { minHeight: 'calc(-
|
|
318
|
+
style={isLatestItem ? { minHeight: 'calc(-300px + 100dvh)' } : undefined}
|
|
319
319
|
>
|
|
320
320
|
<Flexbox gap={4} horizontal>
|
|
321
321
|
<Avatar
|
|
@@ -4,7 +4,6 @@ import { memo, useId, useMemo, useState } from 'react';
|
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { Flexbox } from 'react-layout-kit';
|
|
6
6
|
|
|
7
|
-
import { isServerMode } from '@/const/version';
|
|
8
7
|
import SharePdf from '@/features/ShareModal/SharePdf';
|
|
9
8
|
import { useIsMobile } from '@/hooks/useIsMobile';
|
|
10
9
|
|
|
@@ -41,16 +40,12 @@ const ShareModal = memo<ShareModalProps>(({ onCancel, open, message }) => {
|
|
|
41
40
|
key: Tab.Text,
|
|
42
41
|
label: t('shareModal.text'),
|
|
43
42
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// Only add PDF tab in server mode
|
|
47
|
-
if (isServerMode) {
|
|
48
|
-
items.push({
|
|
43
|
+
{
|
|
49
44
|
children: <SharePdf message={message} />,
|
|
50
45
|
key: Tab.PDF,
|
|
51
46
|
label: t('shareModal.pdf'),
|
|
52
|
-
}
|
|
53
|
-
|
|
47
|
+
},
|
|
48
|
+
];
|
|
54
49
|
|
|
55
50
|
return items;
|
|
56
51
|
}, [isMobile, message, uniqueId, t]);
|
|
@@ -1,32 +1,24 @@
|
|
|
1
1
|
import useSWR from 'swr';
|
|
2
2
|
|
|
3
3
|
import { tableViewerService } from '@/services/tableViewer';
|
|
4
|
-
import { useGlobalStore } from '@/store/global';
|
|
5
|
-
import { systemStatusSelectors } from '@/store/global/selectors';
|
|
6
4
|
|
|
7
5
|
const FETCH_TABLES = 'fetch-tables';
|
|
8
6
|
const FETCH_TABLE_COLUMN_KEY = (tableName: string) => ['fetch-table-columns', tableName];
|
|
9
7
|
export const FETCH_TABLE_DATA_KEY = (tableName: string) => ['fetch-table-data', tableName];
|
|
10
8
|
|
|
11
9
|
export const useFetchTables = () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return useSWR(isDBInited ? FETCH_TABLES : null, () => tableViewerService.getAllTables());
|
|
10
|
+
return useSWR(FETCH_TABLES, () => tableViewerService.getAllTables());
|
|
15
11
|
};
|
|
16
12
|
|
|
17
13
|
export const useTableColumns = (tableName?: string) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return useSWR(isDBInited && tableName ? FETCH_TABLE_COLUMN_KEY(tableName) : null, ([, table]) =>
|
|
14
|
+
return useSWR(tableName ? FETCH_TABLE_COLUMN_KEY(tableName) : null, ([, table]) =>
|
|
21
15
|
tableViewerService.getTableDetails(table),
|
|
22
16
|
);
|
|
23
17
|
};
|
|
24
18
|
|
|
25
19
|
export const usePgTable = (tableName?: string) => {
|
|
26
|
-
const isDBInited = useGlobalStore(systemStatusSelectors.isDBInited);
|
|
27
|
-
|
|
28
20
|
return useSWR(
|
|
29
|
-
|
|
21
|
+
tableName ? FETCH_TABLE_DATA_KEY(tableName) : null,
|
|
30
22
|
([, table]) => tableViewerService.getTableData(table) as any,
|
|
31
23
|
);
|
|
32
24
|
};
|
|
@@ -9,12 +9,10 @@ import { useTranslation } from 'react-i18next';
|
|
|
9
9
|
import { Flexbox } from 'react-layout-kit';
|
|
10
10
|
|
|
11
11
|
import { ModelItemRender, ProviderItemRender } from '@/components/ModelSelect';
|
|
12
|
-
import { isDeprecatedEdition } from '@/const/version';
|
|
13
12
|
import ActionDropdown from '@/features/ChatInput/ActionBar/components/ActionDropdown';
|
|
14
13
|
import { useEnabledChatModels } from '@/hooks/useEnabledChatModels';
|
|
15
14
|
import { useAgentStore } from '@/store/agent';
|
|
16
15
|
import { agentSelectors } from '@/store/agent/slices/chat';
|
|
17
|
-
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
18
16
|
import { EnabledProviderWithModels } from '@/types/aiProvider';
|
|
19
17
|
|
|
20
18
|
const useStyles = createStyles(({ css, prefixCls }) => ({
|
|
@@ -55,7 +53,6 @@ const ModelSwitchPanel = memo<IProps>(({ children, onOpenChange, open }) => {
|
|
|
55
53
|
agentSelectors.currentAgentModelProvider(s),
|
|
56
54
|
s.updateAgentConfig,
|
|
57
55
|
]);
|
|
58
|
-
const { showLLM } = useServerConfigStore(featureFlagsSelectors);
|
|
59
56
|
const router = useRouter();
|
|
60
57
|
const enabledList = useEnabledChatModels();
|
|
61
58
|
|
|
@@ -81,11 +78,7 @@ const ModelSwitchPanel = memo<IProps>(({ children, onOpenChange, open }) => {
|
|
|
81
78
|
</Flexbox>
|
|
82
79
|
),
|
|
83
80
|
onClick: () => {
|
|
84
|
-
router.push(
|
|
85
|
-
isDeprecatedEdition
|
|
86
|
-
? '/settings?active=llm'
|
|
87
|
-
: `/settings?active=provider&provider=${provider.id}`,
|
|
88
|
-
);
|
|
81
|
+
router.push(`/settings?active=provider&provider=${provider.id}`);
|
|
89
82
|
},
|
|
90
83
|
},
|
|
91
84
|
];
|
|
@@ -104,7 +97,7 @@ const ModelSwitchPanel = memo<IProps>(({ children, onOpenChange, open }) => {
|
|
|
104
97
|
</Flexbox>
|
|
105
98
|
),
|
|
106
99
|
onClick: () => {
|
|
107
|
-
router.push(
|
|
100
|
+
router.push('/settings?active=provider');
|
|
108
101
|
},
|
|
109
102
|
},
|
|
110
103
|
];
|
|
@@ -121,21 +114,13 @@ const ModelSwitchPanel = memo<IProps>(({ children, onOpenChange, open }) => {
|
|
|
121
114
|
provider={provider.id}
|
|
122
115
|
source={provider.source}
|
|
123
116
|
/>
|
|
124
|
-
{
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
>
|
|
132
|
-
<ActionIcon
|
|
133
|
-
icon={LucideBolt}
|
|
134
|
-
size={'small'}
|
|
135
|
-
title={t('ModelSwitchPanel.goToSettings')}
|
|
136
|
-
/>
|
|
137
|
-
</Link>
|
|
138
|
-
)}
|
|
117
|
+
<Link href={`/settings?active=provider&provider=${provider.id}`}>
|
|
118
|
+
<ActionIcon
|
|
119
|
+
icon={LucideBolt}
|
|
120
|
+
size={'small'}
|
|
121
|
+
title={t('ModelSwitchPanel.goToSettings')}
|
|
122
|
+
/>
|
|
123
|
+
</Link>
|
|
139
124
|
</Flexbox>
|
|
140
125
|
),
|
|
141
126
|
type: 'group',
|
|
@@ -3,7 +3,6 @@ import { memo, useMemo, useState } from 'react';
|
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { Flexbox } from 'react-layout-kit';
|
|
5
5
|
|
|
6
|
-
import { isServerMode } from '@/const/version';
|
|
7
6
|
import { useIsMobile } from '@/hooks/useIsMobile';
|
|
8
7
|
|
|
9
8
|
import ShareImage from './ShareImage';
|
|
@@ -24,7 +23,7 @@ const ShareModal = memo<ModalProps>(({ onCancel, open }) => {
|
|
|
24
23
|
const isMobile = useIsMobile();
|
|
25
24
|
|
|
26
25
|
const tabItems = useMemo(() => {
|
|
27
|
-
|
|
26
|
+
return [
|
|
28
27
|
{
|
|
29
28
|
children: <ShareImage mobile={isMobile} />,
|
|
30
29
|
key: Tab.Screenshot,
|
|
@@ -35,24 +34,19 @@ const ShareModal = memo<ModalProps>(({ onCancel, open }) => {
|
|
|
35
34
|
key: Tab.Text,
|
|
36
35
|
label: t('shareModal.text'),
|
|
37
36
|
},
|
|
37
|
+
{
|
|
38
|
+
children: <SharePdf />,
|
|
39
|
+
key: Tab.PDF,
|
|
40
|
+
label: t('shareModal.pdf'),
|
|
41
|
+
},
|
|
38
42
|
{
|
|
39
43
|
children: <ShareJSON />,
|
|
40
44
|
key: Tab.JSON,
|
|
41
45
|
label: 'JSON',
|
|
42
46
|
},
|
|
43
47
|
];
|
|
44
|
-
|
|
45
|
-
// Only add PDF tab in server mode
|
|
46
|
-
if (isServerMode) {
|
|
47
|
-
items.splice(2, 0, {
|
|
48
|
-
children: <SharePdf />,
|
|
49
|
-
key: Tab.PDF,
|
|
50
|
-
label: t('shareModal.pdf'),
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return items;
|
|
55
48
|
}, [isMobile, t]);
|
|
49
|
+
|
|
56
50
|
return (
|
|
57
51
|
<Modal
|
|
58
52
|
allowFullscreen
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { enableNextAuth } from '@lobechat/const';
|
|
1
2
|
import Link from 'next/link';
|
|
2
3
|
import { useRouter } from 'next/navigation';
|
|
3
4
|
import { memo } from 'react';
|
|
@@ -5,8 +6,6 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
5
6
|
|
|
6
7
|
import BrandWatermark from '@/components/BrandWatermark';
|
|
7
8
|
import Menu from '@/components/Menu';
|
|
8
|
-
import { enableAuth, enableNextAuth } from '@/const/auth';
|
|
9
|
-
import { isDeprecatedEdition } from '@/const/version';
|
|
10
9
|
import { useUserStore } from '@/store/user';
|
|
11
10
|
import { authSelectors } from '@/store/user/selectors';
|
|
12
11
|
|
|
@@ -38,14 +37,13 @@ const PanelContent = memo<{ closePopover: () => void }>(({ closePopover }) => {
|
|
|
38
37
|
|
|
39
38
|
return (
|
|
40
39
|
<Flexbox gap={2} style={{ minWidth: 300 }}>
|
|
41
|
-
{
|
|
40
|
+
{isLoginWithAuth ? (
|
|
42
41
|
<>
|
|
43
42
|
<UserInfo avatarProps={{ clickable: false }} />
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
)}
|
|
43
|
+
|
|
44
|
+
<Link href={'/profile/stats'} style={{ color: 'inherit' }}>
|
|
45
|
+
<DataStatistics />
|
|
46
|
+
</Link>
|
|
49
47
|
</>
|
|
50
48
|
) : (
|
|
51
49
|
<UserLoginOrSignup onClick={handleSignIn} />
|