@lobehub/lobehub 2.0.0-next.112 → 2.0.0-next.113
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
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 2.0.0-next.113](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.112...v2.0.0-next.113)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2025-11-25**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Fixed when desktop userId was change manytimes the aimodel not right.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: Fixed when desktop userId was change manytimes the aimodel not right, closes [#10389](https://github.com/lobehub/lobe-chat/issues/10389) ([3ed8153](https://github.com/lobehub/lobe-chat/commit/3ed8153))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
## [Version 2.0.0-next.112](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.111...v2.0.0-next.112)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2025-11-24**</sup>
|
package/changelog/v1.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/lobehub",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.113",
|
|
4
4
|
"description": "LobeHub - an open-source,comprehensive AI Agent 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",
|
|
@@ -15,6 +15,8 @@ import { serverConfigSelectors } from '@/store/serverConfig/selectors';
|
|
|
15
15
|
import { useUrlHydrationStore } from '@/store/urlHydration';
|
|
16
16
|
import { useUserStore } from '@/store/user';
|
|
17
17
|
import { authSelectors } from '@/store/user/selectors';
|
|
18
|
+
import { electronSyncSelectors } from '@/store/electron/selectors';
|
|
19
|
+
import { useElectronStore } from '@/store/electron';
|
|
18
20
|
|
|
19
21
|
const StoreInitialization = memo(() => {
|
|
20
22
|
// prefetch error ns to avoid don't show error content correctly
|
|
@@ -63,8 +65,10 @@ const StoreInitialization = memo(() => {
|
|
|
63
65
|
// init inbox agent and default agent config
|
|
64
66
|
useInitAgentStore(isLoginOnInit, serverConfig.defaultAgent?.config);
|
|
65
67
|
|
|
68
|
+
const isSyncActive = useElectronStore((s) => electronSyncSelectors.isSyncActive(s));
|
|
69
|
+
|
|
66
70
|
// init user provider key vaults
|
|
67
|
-
useInitAiProviderKeyVaults(isLoginOnInit);
|
|
71
|
+
useInitAiProviderKeyVaults(isLoginOnInit,isSyncActive);
|
|
68
72
|
|
|
69
73
|
// init user state
|
|
70
74
|
useInitUserState(isLoginOnInit, serverConfig, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isDesktop } from '@lobechat/const';
|
|
1
|
+
import { DESKTOP_USER_ID, isDesktop } from '@lobechat/const';
|
|
2
2
|
import { getModelPropertyWithFallback, resolveImageSinglePrice } from '@lobechat/model-runtime';
|
|
3
3
|
import { uniqBy } from 'lodash-es';
|
|
4
4
|
import {
|
|
@@ -16,7 +16,7 @@ import { useClientDataSWR } from '@/libs/swr';
|
|
|
16
16
|
import { aiProviderService } from '@/services/aiProvider';
|
|
17
17
|
import { AiInfraStore } from '@/store/aiInfra/store';
|
|
18
18
|
import { useUserStore } from '@/store/user';
|
|
19
|
-
import { authSelectors } from '@/store/user/selectors';
|
|
19
|
+
import { authSelectors, userProfileSelectors } from '@/store/user/selectors';
|
|
20
20
|
import {
|
|
21
21
|
AiProviderDetailItem,
|
|
22
22
|
AiProviderListItem,
|
|
@@ -77,10 +77,10 @@ export const normalizeImageModel = async (
|
|
|
77
77
|
const fallbackParametersPromise = model.parameters
|
|
78
78
|
? Promise.resolve<ModelParamsSchema | undefined>(model.parameters)
|
|
79
79
|
: getModelPropertyWithFallback<ModelParamsSchema | undefined>(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
model.id,
|
|
81
|
+
'parameters',
|
|
82
|
+
model.providerId,
|
|
83
|
+
);
|
|
84
84
|
|
|
85
85
|
const modelWithPricing = model as AIImageModelCard;
|
|
86
86
|
const fallbackPricingPromise = modelWithPricing.pricing
|
|
@@ -194,6 +194,7 @@ export interface AiProviderAction {
|
|
|
194
194
|
*/
|
|
195
195
|
useFetchAiProviderRuntimeState: (
|
|
196
196
|
isLoginOnInit: boolean | undefined,
|
|
197
|
+
isSyncActive?: boolean,
|
|
197
198
|
) => SWRResponse<AiProviderRuntimeStateWithBuiltinModels | undefined>;
|
|
198
199
|
}
|
|
199
200
|
|
|
@@ -318,11 +319,27 @@ export const createAiProviderSlice: StateCreator<
|
|
|
318
319
|
},
|
|
319
320
|
),
|
|
320
321
|
|
|
321
|
-
useFetchAiProviderRuntimeState: (isLogin) => {
|
|
322
|
-
const isAuthLoaded = authSelectors.isLoaded
|
|
322
|
+
useFetchAiProviderRuntimeState: (isLogin, isSyncActive?) => {
|
|
323
|
+
const isAuthLoaded = useUserStore(authSelectors.isLoaded);
|
|
324
|
+
const userId = useUserStore(userProfileSelectors.userId);
|
|
323
325
|
// Only fetch when auth is loaded and login status is explicitly defined (true or false)
|
|
324
326
|
// Prevents unnecessary requests when login state is null/undefined
|
|
325
|
-
|
|
327
|
+
let shouldFetch = isAuthLoaded && isLogin !== null && isLogin !== undefined;
|
|
328
|
+
|
|
329
|
+
if (isDesktop) {
|
|
330
|
+
if (isSyncActive) {
|
|
331
|
+
if (userId === undefined || userId === DESKTOP_USER_ID) {
|
|
332
|
+
shouldFetch = false;
|
|
333
|
+
} else {
|
|
334
|
+
shouldFetch = true;
|
|
335
|
+
}
|
|
336
|
+
} else if (userId === undefined) {
|
|
337
|
+
shouldFetch = false;
|
|
338
|
+
} else {
|
|
339
|
+
shouldFetch = true;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
326
343
|
return useClientDataSWR<AiProviderRuntimeStateWithBuiltinModels | undefined>(
|
|
327
344
|
shouldFetch ? [AiProviderSwrKey.fetchAiProviderRuntimeState, isLogin] : null,
|
|
328
345
|
async ([, isLogin]) => {
|
|
@@ -331,7 +348,6 @@ export const createAiProviderSlice: StateCreator<
|
|
|
331
348
|
|
|
332
349
|
if (isLogin) {
|
|
333
350
|
const data = await aiProviderService.getAiProviderRuntimeState();
|
|
334
|
-
|
|
335
351
|
// Build model lists with proper async handling
|
|
336
352
|
const [enabledChatModelList, enabledImageModelList] = await Promise.all([
|
|
337
353
|
buildChatProviderModelLists(data.enabledChatAiProviders, data.enabledAiModels),
|