@lobehub/lobehub 2.0.0-next.204 → 2.0.0-next.206
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 +14 -0
- package/locales/ar/components.json +4 -0
- package/locales/ar/models.json +25 -126
- package/locales/bg-BG/components.json +4 -0
- package/locales/bg-BG/models.json +2 -2
- package/locales/de-DE/components.json +4 -0
- package/locales/de-DE/models.json +21 -120
- package/locales/en-US/components.json +4 -0
- package/locales/es-ES/components.json +4 -0
- package/locales/es-ES/models.json +24 -180
- package/locales/fa-IR/components.json +4 -0
- package/locales/fa-IR/models.json +2 -2
- package/locales/fr-FR/components.json +4 -0
- package/locales/fr-FR/models.json +2 -108
- package/locales/it-IT/components.json +4 -0
- package/locales/it-IT/models.json +22 -51
- package/locales/ja-JP/components.json +4 -0
- package/locales/ja-JP/models.json +16 -133
- package/locales/ko-KR/components.json +4 -0
- package/locales/ko-KR/models.json +26 -148
- package/locales/nl-NL/components.json +4 -0
- package/locales/nl-NL/models.json +2 -2
- package/locales/pl-PL/components.json +4 -0
- package/locales/pl-PL/models.json +2 -2
- package/locales/pt-BR/components.json +4 -0
- package/locales/pt-BR/models.json +49 -125
- package/locales/ru-RU/components.json +4 -0
- package/locales/ru-RU/models.json +17 -96
- package/locales/tr-TR/components.json +4 -0
- package/locales/tr-TR/models.json +28 -57
- package/locales/vi-VN/components.json +4 -0
- package/locales/vi-VN/models.json +1 -92
- package/locales/zh-CN/components.json +4 -0
- package/locales/zh-CN/models.json +31 -165
- package/locales/zh-TW/components.json +4 -0
- package/locales/zh-TW/models.json +2 -2
- package/package.json +1 -1
- package/packages/builtin-tool-gtd/src/executor/index.ts +7 -4
- package/packages/utils/src/object.test.ts +10 -2
- package/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/index.tsx +1 -1
- package/src/features/ModelSwitchPanel/index.tsx +392 -41
- package/src/locales/default/components.ts +4 -0
- package/src/store/aiInfra/slices/aiModel/selectors.test.ts +1 -0
- package/src/store/aiInfra/slices/aiProvider/__tests__/selectors.test.ts +34 -11
- package/src/store/aiInfra/slices/aiProvider/action.ts +9 -1
- package/src/store/aiInfra/slices/aiProvider/initialState.ts +6 -1
- package/src/store/aiInfra/slices/aiProvider/selectors.ts +17 -3
|
@@ -12,7 +12,11 @@ export interface AIProviderState {
|
|
|
12
12
|
activeAiProvider?: string;
|
|
13
13
|
activeProviderModelList: any[];
|
|
14
14
|
aiProviderConfigUpdatingIds: string[];
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Map of provider id to provider detail, used for caching provider details
|
|
17
|
+
* to avoid data inconsistency when switching providers
|
|
18
|
+
*/
|
|
19
|
+
aiProviderDetailMap: Record<string, AiProviderDetailItem>;
|
|
16
20
|
aiProviderList: AiProviderListItem[];
|
|
17
21
|
aiProviderLoadingIds: string[];
|
|
18
22
|
aiProviderRuntimeConfig: Record<string, AiProviderRuntimeConfig>;
|
|
@@ -29,6 +33,7 @@ export interface AIProviderState {
|
|
|
29
33
|
export const initialAIProviderState: AIProviderState = {
|
|
30
34
|
activeProviderModelList: [],
|
|
31
35
|
aiProviderConfigUpdatingIds: [],
|
|
36
|
+
aiProviderDetailMap: {},
|
|
32
37
|
aiProviderList: [],
|
|
33
38
|
aiProviderLoadingIds: [],
|
|
34
39
|
aiProviderRuntimeConfig: {},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isProviderDisableBrowserRequest } from 'model-bank/modelProviders';
|
|
2
|
+
|
|
2
3
|
import { type AIProviderStoreState } from '@/store/aiInfra/initialState';
|
|
3
4
|
import { type AiProviderRuntimeConfig, AiProviderSourceEnum } from '@/types/aiProvider';
|
|
4
5
|
import { type GlobalLLMProviderKey } from '@/types/user/settings';
|
|
@@ -21,12 +22,24 @@ const isProviderEnabled = (id: string) => (s: AIProviderStoreState) =>
|
|
|
21
22
|
const isProviderLoading = (id: string) => (s: AIProviderStoreState) =>
|
|
22
23
|
s.aiProviderLoadingIds.includes(id);
|
|
23
24
|
|
|
24
|
-
const activeProviderConfig = (s: AIProviderStoreState) => s.aiProviderDetail;
|
|
25
|
-
|
|
26
25
|
// Detail
|
|
27
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Get provider detail by id from the cache map
|
|
29
|
+
*/
|
|
30
|
+
const providerDetailById = (id: string) => (s: AIProviderStoreState) => s.aiProviderDetailMap[id];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Get active provider config from the cache map
|
|
34
|
+
*/
|
|
35
|
+
const activeProviderConfig = (s: AIProviderStoreState) =>
|
|
36
|
+
s.activeAiProvider ? s.aiProviderDetailMap[s.activeAiProvider] : undefined;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Check if provider config is loading (data not yet in cache)
|
|
40
|
+
*/
|
|
28
41
|
const isAiProviderConfigLoading = (id: string) => (s: AIProviderStoreState) =>
|
|
29
|
-
s.
|
|
42
|
+
!s.aiProviderDetailMap[id];
|
|
30
43
|
|
|
31
44
|
const providerWhitelist = new Set(['ollama', 'lmstudio']);
|
|
32
45
|
|
|
@@ -134,5 +147,6 @@ export const aiProviderSelectors = {
|
|
|
134
147
|
isProviderHasBuiltinSearchConfig,
|
|
135
148
|
isProviderLoading,
|
|
136
149
|
providerConfigById,
|
|
150
|
+
providerDetailById,
|
|
137
151
|
providerKeyVaults,
|
|
138
152
|
};
|