@lobehub/chat 0.161.21 → 0.161.23
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 +58 -0
- package/package.json +1 -1
- package/src/app/(main)/chat/settings/features/SubmitAgentButton/SubmitAgentModal.tsx +3 -3
- package/src/app/(main)/settings/common/features/Common.tsx +1 -1
- package/src/app/(main)/settings/common/features/Theme/ThemeSwatches/ThemeSwatchesNeutral.tsx +5 -5
- package/src/app/(main)/settings/common/features/Theme/ThemeSwatches/ThemeSwatchesPrimary.tsx +5 -5
- package/src/app/(main)/settings/common/features/Theme/index.tsx +5 -4
- package/src/app/(main)/settings/llm/Azure/index.tsx +4 -4
- package/src/app/(main)/settings/llm/Bedrock/index.tsx +5 -5
- package/src/app/(main)/settings/llm/Ollama/Checker.tsx +1 -1
- package/src/app/(main)/settings/llm/components/Checker.tsx +10 -6
- package/src/app/(main)/settings/llm/components/ProviderConfig/index.tsx +6 -5
- package/src/app/(main)/settings/llm/components/ProviderModelList/CustomModelOption.tsx +1 -1
- package/src/app/(main)/settings/llm/components/ProviderModelList/ModelFetcher.tsx +1 -1
- package/src/app/(main)/settings/llm/components/ProviderModelList/Option.tsx +1 -1
- package/src/app/(main)/settings/llm/components/ProviderModelList/index.tsx +1 -1
- package/src/app/(main)/settings/llm/const.ts +2 -1
- package/src/const/settings/agent.ts +2 -2
- package/src/const/settings/common.ts +2 -2
- package/src/const/settings/index.ts +4 -3
- package/src/const/settings/llm.ts +2 -21
- package/src/const/settings/sync.ts +2 -2
- package/src/const/settings/systemAgent.ts +2 -2
- package/src/const/settings/tts.ts +2 -2
- package/src/database/client/core/db.ts +19 -0
- package/src/database/client/core/migrations/migrateSettingsToUser/type.ts +1 -1
- package/src/database/client/core/schemas.ts +3 -2
- package/src/database/client/models/__tests__/user.test.ts +5 -5
- package/src/database/client/models/user.ts +2 -3
- package/src/database/client/schemas/user.ts +10 -4
- package/src/features/AgentSetting/AgentMeta/index.tsx +3 -3
- package/src/features/AgentSetting/AgentTTS/index.tsx +2 -2
- package/src/features/ChatInput/STT/browser.tsx +2 -2
- package/src/features/ChatInput/STT/openai.tsx +2 -2
- package/src/features/Conversation/Error/APIKeyForm/Bedrock.tsx +5 -5
- package/src/features/Conversation/Error/APIKeyForm/ProviderApiKeyForm.tsx +5 -5
- package/src/features/Conversation/Error/APIKeyForm/index.tsx +1 -1
- package/src/features/Conversation/Error/AccessCodeForm.tsx +4 -4
- package/src/features/Conversation/Extras/TTS/index.tsx +2 -2
- package/src/features/Conversation/Plugins/Render/MarkdownType/index.tsx +2 -2
- package/src/features/Conversation/components/BubblesLoading.tsx +49 -41
- package/src/features/Conversation/components/ChatItem/index.tsx +2 -2
- package/src/features/PluginDevModal/LocalForm.tsx +2 -2
- package/src/features/PluginStore/index.tsx +6 -2
- package/src/features/User/UserPanel/LangButton.tsx +2 -2
- package/src/features/User/UserPanel/ThemeButton.tsx +2 -2
- package/src/hooks/_header.ts +6 -3
- package/src/hooks/useTTS.ts +2 -2
- package/src/layout/GlobalProvider/AppTheme.tsx +4 -4
- package/src/libs/agent-runtime/types/type.ts +3 -2
- package/src/migrations/FromV6ToV7/fixtures/output-v7-from-v1.json +203 -0
- package/src/migrations/FromV6ToV7/fixtures/provider-input-v6.json +103 -0
- package/src/migrations/FromV6ToV7/fixtures/provider-output-v7.json +118 -0
- package/src/migrations/FromV6ToV7/index.ts +101 -0
- package/src/migrations/FromV6ToV7/migrations.test.ts +64 -0
- package/src/migrations/FromV6ToV7/types/v6.ts +61 -0
- package/src/migrations/FromV6ToV7/types/v7.ts +71 -0
- package/src/migrations/index.ts +9 -3
- package/src/services/__tests__/chat.test.ts +19 -19
- package/src/services/__tests__/share.test.ts +4 -4
- package/src/services/_auth.test.ts +10 -5
- package/src/services/_auth.ts +11 -7
- package/src/services/_header.ts +6 -3
- package/src/services/config.ts +2 -2
- package/src/services/ollama.ts +3 -3
- package/src/services/share.ts +3 -3
- package/src/services/user/client.test.ts +3 -3
- package/src/services/user/client.ts +3 -3
- package/src/services/user/type.ts +2 -2
- package/src/store/agent/store.ts +4 -9
- package/src/store/chat/store.ts +4 -8
- package/src/store/file/store.ts +3 -9
- package/src/store/global/store.ts +5 -8
- package/src/store/market/store.ts +5 -8
- package/src/store/middleware/createDevtools.ts +23 -0
- package/src/store/serverConfig/store.ts +5 -11
- package/src/store/session/store.ts +3 -1
- package/src/store/tool/store.ts +4 -9
- package/src/store/user/helpers.ts +3 -2
- package/src/store/user/selectors.ts +10 -2
- package/src/store/user/slices/common/action.test.ts +3 -3
- package/src/store/user/slices/common/action.ts +4 -4
- package/src/store/user/slices/modelList/action.test.ts +2 -2
- package/src/store/user/slices/modelList/action.ts +16 -4
- package/src/store/user/slices/modelList/selectors/index.ts +1 -0
- package/src/store/user/slices/modelList/selectors/keyVaults.ts +25 -0
- package/src/store/user/slices/modelList/selectors/modelConfig.test.ts +1 -1
- package/src/store/user/slices/modelList/selectors/modelConfig.ts +1 -6
- package/src/store/user/slices/modelList/selectors/modelProvider.ts +1 -1
- package/src/store/user/slices/settings/action.test.ts +16 -14
- package/src/store/user/slices/settings/action.ts +14 -8
- package/src/store/user/slices/settings/initialState.ts +3 -3
- package/src/store/user/slices/settings/selectors/general.test.ts +45 -0
- package/src/store/user/slices/settings/selectors/general.ts +40 -0
- package/src/store/user/slices/settings/selectors/index.ts +1 -0
- package/src/store/user/slices/settings/selectors/settings.test.ts +0 -39
- package/src/store/user/slices/settings/selectors/settings.ts +11 -34
- package/src/store/user/store.ts +5 -8
- package/src/types/exportConfig.ts +2 -2
- package/src/types/serverConfig.ts +2 -2
- package/src/types/user/index.ts +2 -2
- package/src/types/{settings/base.ts → user/settings/general.ts} +4 -1
- package/src/types/user/settings/index.ts +32 -0
- package/src/types/user/settings/keyVaults.ts +36 -0
- package/src/types/user/settings/modelProvider.ts +34 -0
- package/src/types/{settings → user/settings}/sync.ts +1 -1
- package/src/types/{settings → user/settings}/systemAgent.ts +1 -1
- package/src/types/user/settings/tool.ts +5 -0
- package/src/types/{settings → user/settings}/tts.ts +1 -1
- package/src/types/settings/index.ts +0 -33
- package/src/types/settings/modelProvider.ts +0 -62
|
@@ -117,45 +117,6 @@ describe('settingsSelectors', () => {
|
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
-
describe('currentLanguage', () => {
|
|
121
|
-
it('should return the correct language setting', () => {
|
|
122
|
-
const s = {
|
|
123
|
-
settings: {
|
|
124
|
-
language: 'fr',
|
|
125
|
-
},
|
|
126
|
-
} as unknown as UserStore;
|
|
127
|
-
|
|
128
|
-
const result = settingsSelectors.currentLanguage(s);
|
|
129
|
-
|
|
130
|
-
expect(result).toBe('fr');
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
describe('currentThemeMode', () => {
|
|
135
|
-
it('should return the correct theme', () => {
|
|
136
|
-
const s = {
|
|
137
|
-
settings: {
|
|
138
|
-
themeMode: 'light',
|
|
139
|
-
},
|
|
140
|
-
} as unknown as UserStore;
|
|
141
|
-
|
|
142
|
-
const result = settingsSelectors.currentThemeMode(s);
|
|
143
|
-
|
|
144
|
-
expect(result).toBe('light');
|
|
145
|
-
});
|
|
146
|
-
it('should return the auto if not set the themeMode', () => {
|
|
147
|
-
const s = {
|
|
148
|
-
settings: {
|
|
149
|
-
themeMode: undefined,
|
|
150
|
-
},
|
|
151
|
-
} as unknown as UserStore;
|
|
152
|
-
|
|
153
|
-
const result = settingsSelectors.currentThemeMode(s);
|
|
154
|
-
|
|
155
|
-
expect(result).toBe('auto');
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
|
|
159
120
|
describe('dalleConfig', () => {
|
|
160
121
|
it('should return the dalle configuration', () => {
|
|
161
122
|
const s = {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DEFAULT_LANG } from '@/const/locale';
|
|
2
1
|
import { DEFAULT_AGENT_META } from '@/const/meta';
|
|
3
2
|
import {
|
|
4
3
|
DEFAULT_AGENT,
|
|
@@ -6,22 +5,25 @@ import {
|
|
|
6
5
|
DEFAULT_SYSTEM_AGENT_CONFIG,
|
|
7
6
|
DEFAULT_TTS_CONFIG,
|
|
8
7
|
} from '@/const/settings';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import {
|
|
9
|
+
GlobalLLMProviderKey,
|
|
10
|
+
ProviderConfig,
|
|
11
|
+
UserSettings,
|
|
12
|
+
} from '@/types/user/settings';
|
|
12
13
|
import { merge } from '@/utils/merge';
|
|
13
14
|
|
|
14
15
|
import { UserStore } from '../../../store';
|
|
15
16
|
|
|
16
|
-
export const currentSettings = (s: UserStore):
|
|
17
|
-
merge(s.defaultSettings, s.settings);
|
|
17
|
+
export const currentSettings = (s: UserStore): UserSettings => merge(s.defaultSettings, s.settings);
|
|
18
18
|
|
|
19
19
|
export const currentLLMSettings = (s: UserStore) => currentSettings(s).languageModel;
|
|
20
20
|
|
|
21
21
|
export const getProviderConfigById = (provider: string) => (s: UserStore) =>
|
|
22
|
-
currentLLMSettings(s)[provider as GlobalLLMProviderKey] as
|
|
22
|
+
currentLLMSettings(s)[provider as GlobalLLMProviderKey] as
|
|
23
|
+
| ProviderConfig
|
|
24
|
+
| undefined;
|
|
23
25
|
|
|
24
|
-
const password = (s: UserStore) => currentSettings(s).password;
|
|
26
|
+
const password = (s: UserStore) => currentSettings(s).keyVaults.password || '';
|
|
25
27
|
|
|
26
28
|
const currentTTS = (s: UserStore) => merge(DEFAULT_TTS_CONFIG, currentSettings(s).tts);
|
|
27
29
|
|
|
@@ -30,30 +32,7 @@ const defaultAgentConfig = (s: UserStore) => merge(DEFAULT_AGENT_CONFIG, default
|
|
|
30
32
|
|
|
31
33
|
const defaultAgentMeta = (s: UserStore) => merge(DEFAULT_AGENT_META, defaultAgent(s).meta);
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
const exportSettings = (s: UserStore) => {
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
36
|
-
const { password: _, ...settings } = currentSettings(s);
|
|
37
|
-
|
|
38
|
-
return settings as GlobalSettings;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const currentLanguage = (s: UserStore) => {
|
|
42
|
-
const locale = currentSettings(s).language;
|
|
43
|
-
|
|
44
|
-
if (locale === 'auto') {
|
|
45
|
-
if (isOnServerSide) return DEFAULT_LANG;
|
|
46
|
-
|
|
47
|
-
return navigator.language as Locales;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return locale;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const currentThemeMode = (s: UserStore) => {
|
|
54
|
-
const themeMode = currentSettings(s).themeMode;
|
|
55
|
-
return themeMode || 'auto';
|
|
56
|
-
};
|
|
35
|
+
const exportSettings = currentSettings;
|
|
57
36
|
|
|
58
37
|
const dalleConfig = (s: UserStore) => currentSettings(s).tool?.dalle || {};
|
|
59
38
|
const isDalleAutoGenerating = (s: UserStore) => currentSettings(s).tool?.dalle?.autoGenerate;
|
|
@@ -62,11 +41,9 @@ const currentSystemAgent = (s: UserStore) =>
|
|
|
62
41
|
merge(DEFAULT_SYSTEM_AGENT_CONFIG, currentSettings(s).systemAgent);
|
|
63
42
|
|
|
64
43
|
export const settingsSelectors = {
|
|
65
|
-
currentLanguage,
|
|
66
44
|
currentSettings,
|
|
67
45
|
currentSystemAgent,
|
|
68
46
|
currentTTS,
|
|
69
|
-
currentThemeMode,
|
|
70
47
|
dalleConfig,
|
|
71
48
|
defaultAgent,
|
|
72
49
|
defaultAgentConfig,
|
package/src/store/user/store.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { subscribeWithSelector } from 'zustand/middleware';
|
|
2
2
|
import { shallow } from 'zustand/shallow';
|
|
3
3
|
import { createWithEqualityFn } from 'zustand/traditional';
|
|
4
4
|
import { StateCreator } from 'zustand/vanilla';
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import { createDevtools } from '../middleware/createDevtools';
|
|
8
7
|
import { type UserState, initialState } from './initialState';
|
|
9
8
|
import { type UserAuthAction, createAuthSlice } from './slices/auth/action';
|
|
10
9
|
import { type CommonAction, createCommonSlice } from './slices/common/action';
|
|
@@ -35,11 +34,9 @@ const createStore: StateCreator<UserStore, [['zustand/devtools', never]]> = (...
|
|
|
35
34
|
|
|
36
35
|
// =============== 实装 useStore ============ //
|
|
37
36
|
|
|
37
|
+
const devtools = createDevtools('user');
|
|
38
|
+
|
|
38
39
|
export const useUserStore = createWithEqualityFn<UserStore>()(
|
|
39
|
-
subscribeWithSelector(
|
|
40
|
-
devtools(createStore, {
|
|
41
|
-
name: 'LobeChat_User' + (isDev ? '_DEV' : ''),
|
|
42
|
-
}),
|
|
43
|
-
),
|
|
40
|
+
subscribeWithSelector(devtools(createStore)),
|
|
44
41
|
shallow,
|
|
45
42
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChatMessage } from '@/types/message';
|
|
2
2
|
import { LobeSessions, SessionGroupItem } from '@/types/session';
|
|
3
|
-
import { GlobalSettings } from '@/types/settings';
|
|
4
3
|
import { ChatTopic } from '@/types/topic';
|
|
4
|
+
import { UserSettings } from '@/types/user/settings';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* 导出方式
|
|
@@ -69,7 +69,7 @@ export interface ConfigStateAgents {
|
|
|
69
69
|
* 配置状态:设置
|
|
70
70
|
*/
|
|
71
71
|
export interface ConfigStateSettings {
|
|
72
|
-
settings:
|
|
72
|
+
settings: UserSettings;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DeepPartial } from 'utility-types';
|
|
2
2
|
|
|
3
3
|
import { ChatModelCard } from '@/types/llm';
|
|
4
|
-
import {
|
|
4
|
+
import { UserDefaultAgent, GlobalLLMProviderKey } from '@/types/user/settings';
|
|
5
5
|
|
|
6
6
|
export interface ServerModelProviderConfig {
|
|
7
7
|
enabled?: boolean;
|
|
@@ -16,7 +16,7 @@ export interface ServerModelProviderConfig {
|
|
|
16
16
|
export type ServerLanguageModel = Partial<Record<GlobalLLMProviderKey, ServerModelProviderConfig>>;
|
|
17
17
|
|
|
18
18
|
export interface GlobalServerConfig {
|
|
19
|
-
defaultAgent?: DeepPartial<
|
|
19
|
+
defaultAgent?: DeepPartial<UserDefaultAgent>;
|
|
20
20
|
enableUploadFileToServer?: boolean;
|
|
21
21
|
enabledAccessCode?: boolean;
|
|
22
22
|
enabledOAuthSSO?: boolean;
|
package/src/types/user/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DeepPartial } from 'utility-types';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { UserSettings } from '@/types/user/settings';
|
|
4
4
|
|
|
5
5
|
export interface LobeUser {
|
|
6
6
|
avatar?: string;
|
|
@@ -39,6 +39,6 @@ export interface UserInitializationState {
|
|
|
39
39
|
hasConversation?: boolean;
|
|
40
40
|
isOnboard?: boolean;
|
|
41
41
|
preference: UserPreference;
|
|
42
|
-
settings: DeepPartial<
|
|
42
|
+
settings: DeepPartial<UserSettings>;
|
|
43
43
|
userId?: string;
|
|
44
44
|
}
|
|
@@ -3,10 +3,13 @@ import type { ThemeMode } from 'antd-style';
|
|
|
3
3
|
|
|
4
4
|
import { LocaleMode } from '@/types/locale';
|
|
5
5
|
|
|
6
|
-
export interface
|
|
6
|
+
export interface UserGeneralConfig {
|
|
7
7
|
fontSize: number;
|
|
8
8
|
language: LocaleMode;
|
|
9
9
|
neutralColor?: NeutralColors;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated
|
|
12
|
+
*/
|
|
10
13
|
password: string;
|
|
11
14
|
primaryColor?: PrimaryColors;
|
|
12
15
|
themeMode: ThemeMode;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { LobeAgentSettings } from '@/types/session';
|
|
2
|
+
|
|
3
|
+
import { UserGeneralConfig } from './general';
|
|
4
|
+
import { UserKeyVaults } from './keyVaults';
|
|
5
|
+
import { UserModelProviderConfig } from './modelProvider';
|
|
6
|
+
import { UserSyncSettings } from './sync';
|
|
7
|
+
import { UserSystemAgentConfig } from './systemAgent';
|
|
8
|
+
import { UserToolConfig } from './tool';
|
|
9
|
+
import { UserTTSConfig } from './tts';
|
|
10
|
+
|
|
11
|
+
export type UserDefaultAgent = LobeAgentSettings;
|
|
12
|
+
|
|
13
|
+
export * from './general';
|
|
14
|
+
export * from './keyVaults';
|
|
15
|
+
export * from './modelProvider';
|
|
16
|
+
export * from './sync';
|
|
17
|
+
export * from './systemAgent';
|
|
18
|
+
export * from './tts';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 配置设置
|
|
22
|
+
*/
|
|
23
|
+
export interface UserSettings {
|
|
24
|
+
defaultAgent: UserDefaultAgent;
|
|
25
|
+
general: UserGeneralConfig;
|
|
26
|
+
keyVaults: UserKeyVaults;
|
|
27
|
+
languageModel: UserModelProviderConfig;
|
|
28
|
+
sync: UserSyncSettings;
|
|
29
|
+
systemAgent: UserSystemAgentConfig;
|
|
30
|
+
tool: UserToolConfig;
|
|
31
|
+
tts: UserTTSConfig;
|
|
32
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface OpenAICompatibleKeyVault {
|
|
2
|
+
apiKey?: string;
|
|
3
|
+
baseURL?: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
interface AzureOpenAIKeyVault {
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
apiVersion?: string;
|
|
9
|
+
endpoint?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface AWSBedrockKeyVault {
|
|
13
|
+
accessKeyId?: string;
|
|
14
|
+
region?: string;
|
|
15
|
+
secretAccessKey?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface UserKeyVaults {
|
|
19
|
+
anthropic?: OpenAICompatibleKeyVault;
|
|
20
|
+
azure?: AzureOpenAIKeyVault;
|
|
21
|
+
bedrock?: AWSBedrockKeyVault;
|
|
22
|
+
deepseek?: OpenAICompatibleKeyVault;
|
|
23
|
+
google?: OpenAICompatibleKeyVault;
|
|
24
|
+
groq?: OpenAICompatibleKeyVault;
|
|
25
|
+
minimax?: OpenAICompatibleKeyVault;
|
|
26
|
+
mistral?: OpenAICompatibleKeyVault;
|
|
27
|
+
moonshot?: OpenAICompatibleKeyVault;
|
|
28
|
+
ollama?: OpenAICompatibleKeyVault;
|
|
29
|
+
openai?: OpenAICompatibleKeyVault;
|
|
30
|
+
openrouter?: OpenAICompatibleKeyVault;
|
|
31
|
+
password?: string;
|
|
32
|
+
perplexity?: OpenAICompatibleKeyVault;
|
|
33
|
+
togetherai?: OpenAICompatibleKeyVault;
|
|
34
|
+
zeroone?: OpenAICompatibleKeyVault;
|
|
35
|
+
zhipu?: OpenAICompatibleKeyVault;
|
|
36
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ModelProviderKey } from '@/libs/agent-runtime';
|
|
2
|
+
import { ChatModelCard } from '@/types/llm';
|
|
3
|
+
|
|
4
|
+
export interface ProviderConfig {
|
|
5
|
+
/**
|
|
6
|
+
* whether to auto fetch model lists
|
|
7
|
+
*/
|
|
8
|
+
autoFetchModelLists?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* user defined model cards
|
|
11
|
+
*/
|
|
12
|
+
customModelCards?: ChatModelCard[];
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* enabled models id
|
|
16
|
+
*/
|
|
17
|
+
enabledModels?: string[] | null;
|
|
18
|
+
/**
|
|
19
|
+
* whether fetch on client
|
|
20
|
+
*/
|
|
21
|
+
fetchOnClient?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* the latest fetch model list time
|
|
24
|
+
*/
|
|
25
|
+
latestFetchTime?: number;
|
|
26
|
+
/**
|
|
27
|
+
* fetched models from provider side
|
|
28
|
+
*/
|
|
29
|
+
remoteModelCards?: ChatModelCard[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type GlobalLLMProviderKey = ModelProviderKey;
|
|
33
|
+
|
|
34
|
+
export type UserModelProviderConfig = Record<ModelProviderKey, ProviderConfig>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { LobeAgentSession } from '@/types/session';
|
|
2
|
-
|
|
3
|
-
import { GlobalBaseSettings } from './base';
|
|
4
|
-
import { GlobalLLMConfig } from './modelProvider';
|
|
5
|
-
import { GlobalSyncSettings } from './sync';
|
|
6
|
-
import { GlobalSystemAgentConfig } from './systemAgent';
|
|
7
|
-
import { GlobalTTSConfig } from './tts';
|
|
8
|
-
|
|
9
|
-
export type GlobalDefaultAgent = Pick<LobeAgentSession, 'config' | 'meta'>;
|
|
10
|
-
|
|
11
|
-
export * from './base';
|
|
12
|
-
export * from './modelProvider';
|
|
13
|
-
export * from './sync';
|
|
14
|
-
export * from './systemAgent';
|
|
15
|
-
export * from './tts';
|
|
16
|
-
|
|
17
|
-
export interface GlobalTool {
|
|
18
|
-
dalle: {
|
|
19
|
-
autoGenerate: boolean;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* 配置设置
|
|
25
|
-
*/
|
|
26
|
-
export interface GlobalSettings extends GlobalBaseSettings {
|
|
27
|
-
defaultAgent: GlobalDefaultAgent;
|
|
28
|
-
languageModel: GlobalLLMConfig;
|
|
29
|
-
sync: GlobalSyncSettings;
|
|
30
|
-
systemAgent: GlobalSystemAgentConfig;
|
|
31
|
-
tool: GlobalTool;
|
|
32
|
-
tts: GlobalTTSConfig;
|
|
33
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { ChatModelCard } from '@/types/llm';
|
|
2
|
-
|
|
3
|
-
export interface GeneralModelProviderConfig {
|
|
4
|
-
apiKey?: string;
|
|
5
|
-
/**
|
|
6
|
-
* whether to auto fetch model lists
|
|
7
|
-
*/
|
|
8
|
-
autoFetchModelLists?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* user defined model cards
|
|
11
|
-
*/
|
|
12
|
-
customModelCards?: ChatModelCard[];
|
|
13
|
-
enabled: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* enabled models id
|
|
16
|
-
*/
|
|
17
|
-
enabledModels?: string[] | null;
|
|
18
|
-
endpoint?: string;
|
|
19
|
-
/**
|
|
20
|
-
* whether fetch on client
|
|
21
|
-
*/
|
|
22
|
-
fetchOnClient?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* the latest fetch model list time
|
|
25
|
-
*/
|
|
26
|
-
latestFetchTime?: number;
|
|
27
|
-
/**
|
|
28
|
-
* fetched models from provider side
|
|
29
|
-
*/
|
|
30
|
-
remoteModelCards?: ChatModelCard[];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface AzureOpenAIConfig extends GeneralModelProviderConfig {
|
|
34
|
-
apiVersion?: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface AWSBedrockConfig extends Omit<GeneralModelProviderConfig, 'apiKey' | 'endpoint'> {
|
|
38
|
-
accessKeyId?: string;
|
|
39
|
-
region?: string;
|
|
40
|
-
secretAccessKey?: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface GlobalLLMConfig {
|
|
44
|
-
anthropic: GeneralModelProviderConfig;
|
|
45
|
-
azure: AzureOpenAIConfig;
|
|
46
|
-
bedrock: AWSBedrockConfig;
|
|
47
|
-
deepseek: GeneralModelProviderConfig;
|
|
48
|
-
google: GeneralModelProviderConfig;
|
|
49
|
-
groq: GeneralModelProviderConfig;
|
|
50
|
-
minimax: GeneralModelProviderConfig;
|
|
51
|
-
mistral: GeneralModelProviderConfig;
|
|
52
|
-
moonshot: GeneralModelProviderConfig;
|
|
53
|
-
ollama: GeneralModelProviderConfig;
|
|
54
|
-
openai: GeneralModelProviderConfig;
|
|
55
|
-
openrouter: GeneralModelProviderConfig;
|
|
56
|
-
perplexity: GeneralModelProviderConfig;
|
|
57
|
-
togetherai: GeneralModelProviderConfig;
|
|
58
|
-
zeroone: GeneralModelProviderConfig;
|
|
59
|
-
zhipu: GeneralModelProviderConfig;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export type GlobalLLMProviderKey = keyof GlobalLLMConfig;
|