@lobehub/chat 1.86.0 → 1.87.0
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/README.md +3 -3
- package/README.zh-CN.md +3 -3
- package/changelog/v1.json +21 -0
- package/locales/ar/setting.json +43 -31
- package/locales/bg-BG/setting.json +43 -31
- package/locales/de-DE/setting.json +43 -31
- package/locales/en-US/setting.json +43 -31
- package/locales/es-ES/setting.json +43 -31
- package/locales/fa-IR/setting.json +43 -31
- package/locales/fr-FR/setting.json +43 -31
- package/locales/it-IT/setting.json +43 -31
- package/locales/ja-JP/setting.json +43 -31
- package/locales/ko-KR/setting.json +43 -31
- package/locales/nl-NL/setting.json +43 -31
- package/locales/pl-PL/setting.json +43 -31
- package/locales/pt-BR/setting.json +43 -31
- package/locales/ru-RU/setting.json +43 -31
- package/locales/tr-TR/setting.json +43 -31
- package/locales/vi-VN/setting.json +43 -31
- package/locales/zh-CN/setting.json +43 -31
- package/locales/zh-TW/setting.json +43 -31
- package/package.json +3 -3
- package/src/app/(backend)/middleware/auth/index.test.ts +1 -1
- package/src/app/(backend)/middleware/auth/index.ts +1 -1
- package/src/app/(backend)/middleware/auth/utils.ts +1 -1
- package/src/app/(backend)/webapi/chat/[provider]/route.test.ts +1 -1
- package/src/app/(backend)/webapi/chat/[provider]/route.ts +1 -1
- package/src/app/(backend)/webapi/chat/vertexai/route.ts +2 -2
- package/src/app/(backend)/webapi/models/[provider]/pull/route.ts +1 -1
- package/src/app/(backend)/webapi/models/[provider]/route.ts +1 -1
- package/src/app/(backend)/webapi/plugin/gateway/route.ts +1 -1
- package/src/app/(backend)/webapi/text-to-image/[provider]/route.ts +2 -2
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/WelcomeMessage.tsx +1 -1
- package/src/app/[variants]/(main)/settings/agent/index.tsx +8 -2
- package/src/app/[variants]/(main)/settings/common/features/Appearance/Preview.tsx +298 -0
- package/src/app/[variants]/(main)/settings/common/features/{Theme → Appearance}/ThemeSwatches/ThemeSwatchesNeutral.tsx +6 -11
- package/src/app/[variants]/(main)/settings/common/features/{Theme → Appearance}/ThemeSwatches/ThemeSwatchesPrimary.tsx +6 -10
- package/src/app/[variants]/(main)/settings/common/features/Appearance/index.tsx +67 -0
- package/src/app/[variants]/(main)/settings/common/features/ChatAppearance/ChatPreview.tsx +35 -0
- package/src/app/[variants]/(main)/settings/common/features/ChatAppearance/HighlighterPreview.tsx +55 -0
- package/src/app/[variants]/(main)/settings/common/features/ChatAppearance/MermaidPreview.tsx +51 -0
- package/src/app/[variants]/(main)/settings/common/features/ChatAppearance/index.tsx +128 -0
- package/src/app/[variants]/(main)/settings/common/features/Common.tsx +74 -42
- package/src/app/[variants]/(main)/settings/common/index.tsx +4 -2
- package/src/app/[variants]/(main)/settings/hotkey/features/{HotkeySetting.tsx → Conversation.tsx} +19 -18
- package/src/app/[variants]/(main)/settings/hotkey/features/Essential.tsx +88 -0
- package/src/app/[variants]/(main)/settings/hotkey/page.tsx +8 -2
- package/src/app/[variants]/(main)/settings/llm/ProviderList/Azure/index.tsx +1 -1
- package/src/app/[variants]/(main)/settings/llm/components/ProviderModelList/ModelConfigModal/index.tsx +1 -1
- package/src/app/[variants]/(main)/settings/provider/(detail)/azure/page.tsx +1 -1
- package/src/app/[variants]/(main)/settings/provider/(detail)/azureai/page.tsx +1 -1
- package/src/app/[variants]/(main)/settings/storage/Advanced.tsx +26 -0
- package/src/app/[variants]/(main)/settings/system-agent/features/createForm.tsx +37 -22
- package/src/app/[variants]/(main)/settings/tts/features/OpenAI.tsx +20 -10
- package/src/app/[variants]/(main)/settings/tts/features/STT.tsx +20 -11
- package/src/const/settings/common.ts +2 -0
- package/src/const/settings/llm.ts +1 -1
- package/src/database/models/__tests__/aiProvider.test.ts +1 -1
- package/src/database/models/aiProvider.ts +1 -1
- package/src/features/AgentSetting/AgentTTS/index.tsx +1 -1
- package/src/features/ChatItem/index.tsx +35 -0
- package/src/features/Conversation/Error/APIKeyForm/Bedrock.tsx +1 -1
- package/src/features/Conversation/Error/APIKeyForm/index.tsx +1 -1
- package/src/features/Conversation/Error/index.tsx +1 -1
- package/src/features/Conversation/components/ChatItem/index.tsx +2 -6
- package/src/features/User/UserPanel/LangButton.tsx +1 -1
- package/src/features/User/UserPanel/ThemeButton.tsx +3 -3
- package/src/libs/{agent-runtime/AgentRuntime.test.ts → model-runtime/ModelRuntime.test.ts} +3 -3
- package/src/libs/{agent-runtime/AgentRuntime.ts → model-runtime/ModelRuntime.ts} +3 -3
- package/src/libs/{agent-runtime → model-runtime}/ai21/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/ai360/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/anthropic/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/baichuan/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/bedrock/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/cloudflare/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/deepseek/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/fireworksai/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/giteeai/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/github/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/google/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/groq/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/hunyuan/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/index.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/internlm/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/lmstudio/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/mistral/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/moonshot/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/novita/index.test.ts +3 -3
- package/src/libs/{agent-runtime → model-runtime}/ollama/index.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/openai/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/openrouter/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/perplexity/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/ppio/index.test.ts +4 -4
- package/src/libs/{agent-runtime → model-runtime}/providerTestUtils.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/qiniu/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/qwen/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/sensenova/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/siliconcloud/index.ts +1 -6
- package/src/libs/{agent-runtime → model-runtime}/spark/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/stepfun/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/taichu/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/tencentcloud/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/togetherai/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/upstage/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/utils/openaiCompatibleFactory/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/utils/openaiHelpers.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/utils/streams/ollama.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/utils/streams/openai.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/utils/streams/qwen.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/wenxin/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/xai/index.test.ts +2 -2
- package/src/libs/{agent-runtime → model-runtime}/zeroone/index.test.ts +1 -1
- package/src/libs/{agent-runtime → model-runtime}/zhipu/index.test.ts +2 -2
- package/src/libs/oidc-provider/config.ts +1 -1
- package/src/libs/trpc/client/lambda.ts +1 -1
- package/src/locales/default/setting.ts +45 -31
- package/src/server/globalConfig/_deprecated.test.ts +1 -1
- package/src/server/globalConfig/_deprecated.ts +1 -1
- package/src/server/globalConfig/genServerAiProviderConfig.ts +1 -1
- package/src/server/modules/AgentRuntime/index.test.ts +4 -4
- package/src/server/modules/AgentRuntime/index.ts +1 -1
- package/src/server/modules/AgentRuntime/trace.ts +1 -1
- package/src/server/routers/async/ragEval.ts +1 -1
- package/src/services/__tests__/_auth.test.ts +1 -1
- package/src/services/__tests__/chat.test.ts +3 -3
- package/src/services/_auth.ts +1 -1
- package/src/services/chat.ts +1 -1
- package/src/services/textToImage.ts +1 -1
- package/src/services/upload.ts +1 -1
- package/src/store/electron/initialState.ts +1 -1
- package/src/store/electron/selectors/__tests__/desktopState.test.ts +55 -0
- package/src/store/global/selectors/systemStatus.ts +2 -0
- package/src/store/user/slices/modelList/action.ts +1 -1
- package/src/store/user/slices/settings/selectors/general.test.ts +29 -1
- package/src/store/user/slices/settings/selectors/general.ts +4 -0
- package/src/types/fetch.ts +1 -1
- package/src/types/message/chat.ts +1 -1
- package/src/types/user/settings/general.ts +3 -1
- package/src/types/user/settings/modelProvider.ts +1 -1
- package/src/utils/errorResponse.test.ts +1 -1
- package/src/utils/errorResponse.ts +1 -1
- package/src/utils/fetch/fetchSSE.ts +1 -1
- package/src/utils/genUserLLMConfig.test.ts +1 -1
- package/src/utils/genUserLLMConfig.ts +1 -1
- package/src/app/[variants]/(main)/settings/common/features/Theme/index.tsx +0 -146
- /package/src/app/[variants]/(main)/settings/common/features/{Theme → Appearance}/ThemeSwatches/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/BaseAI.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/UniformRuntime/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/ai21/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/ai360/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/anthropic/handleAnthropicError.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/anthropic/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/azureOpenai/index.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/azureOpenai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/azureai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/baichuan/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/bedrock/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/cloudflare/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/cohere/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/deepseek/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/error.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/fireworksai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/giteeai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/github/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/google/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/groq/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/helpers/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/helpers/parseToolCalls.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/helpers/parseToolCalls.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/higress/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/huggingface/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/hunyuan/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/infiniai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/internlm/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/jina/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/lmstudio/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/minimax/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/mistral/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/moonshot/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/novita/__snapshots__/index.test.ts.snap +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/novita/fixtures/models.json +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/novita/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/novita/type.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/nvidia/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/ollama/index.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/ollama/type.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/openai/__snapshots__/index.test.ts.snap +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/openai/fixtures/openai-models.json +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/openai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/openrouter/__snapshots__/index.test.ts.snap +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/openrouter/fixtures/frontendModels.json +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/openrouter/fixtures/models.json +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/openrouter/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/openrouter/type.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/perplexity/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/ppio/__snapshots__/index.test.ts.snap +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/ppio/fixtures/models.json +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/ppio/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/ppio/type.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/providerTestUtils.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/qiniu/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/qwen/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/runtimeMap.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/sambanova/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/search1api/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/sensenova/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/spark/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/stepfun/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/taichu/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/tencentcloud/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/togetherai/fixtures/models.json +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/togetherai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/togetherai/type.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/types/chat.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/types/embeddings.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/types/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/types/model.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/types/textToImage.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/types/tts.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/types/type.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/upstage/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/anthropicHelpers.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/anthropicHelpers.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/cloudflareHelpers.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/cloudflareHelpers.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/createError.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/debugStream.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/debugStream.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/desensitizeUrl.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/desensitizeUrl.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/handleOpenAIError.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/openaiCompatibleFactory/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/openaiHelpers.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/response.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/sensenovaHelpers.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/sensenovaHelpers.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/__snapshots__/protocol.test.ts.snap +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/anthropic.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/anthropic.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/bedrock/claude.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/bedrock/common.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/bedrock/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/bedrock/llama.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/bedrock/llama.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/google-ai.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/google-ai.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/model.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/ollama.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/openai.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/protocol.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/protocol.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/qwen.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/spark.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/spark.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/vertex-ai.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/streams/vertex-ai.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/uriParser.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/uriParser.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/usageConverter.test.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/utils/usageConverter.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/vertexai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/vllm/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/volcengine/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/wenxin/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/xai/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/xinference/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/zeroone/index.ts +0 -0
- /package/src/libs/{agent-runtime → model-runtime}/zhipu/index.ts +0 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
2
|
+
|
3
|
+
import { ElectronState } from '@/store/electron/initialState';
|
4
|
+
|
5
|
+
import { desktopStateSelectors } from '../desktopState';
|
6
|
+
|
7
|
+
describe('desktopStateSelectors', () => {
|
8
|
+
describe('usePath', () => {
|
9
|
+
it('should return userPath from appState', () => {
|
10
|
+
const state: ElectronState = {
|
11
|
+
isAppStateInit: false,
|
12
|
+
appState: {
|
13
|
+
userPath: {
|
14
|
+
desktop: '/test/desktop',
|
15
|
+
documents: '/test/documents',
|
16
|
+
downloads: '/test/downloads',
|
17
|
+
home: '/test/home',
|
18
|
+
music: '/test/music',
|
19
|
+
pictures: '/test/pictures',
|
20
|
+
userData: '/test/userdata',
|
21
|
+
videos: '/test/videos',
|
22
|
+
},
|
23
|
+
},
|
24
|
+
dataSyncConfig: {
|
25
|
+
storageMode: 'local',
|
26
|
+
},
|
27
|
+
isInitRemoteServerConfig: false,
|
28
|
+
};
|
29
|
+
|
30
|
+
expect(desktopStateSelectors.usePath(state)).toEqual({
|
31
|
+
desktop: '/test/desktop',
|
32
|
+
documents: '/test/documents',
|
33
|
+
downloads: '/test/downloads',
|
34
|
+
home: '/test/home',
|
35
|
+
music: '/test/music',
|
36
|
+
pictures: '/test/pictures',
|
37
|
+
userData: '/test/userdata',
|
38
|
+
videos: '/test/videos',
|
39
|
+
});
|
40
|
+
});
|
41
|
+
|
42
|
+
it('should handle undefined userPath', () => {
|
43
|
+
const state: ElectronState = {
|
44
|
+
appState: {},
|
45
|
+
isAppStateInit: false,
|
46
|
+
dataSyncConfig: {
|
47
|
+
storageMode: 'local',
|
48
|
+
},
|
49
|
+
isInitRemoteServerConfig: false,
|
50
|
+
};
|
51
|
+
|
52
|
+
expect(desktopStateSelectors.usePath(state)).toBeUndefined();
|
53
|
+
});
|
54
|
+
});
|
55
|
+
});
|
@@ -17,6 +17,7 @@ const showFilePanel = (s: GlobalState) => s.status.showFilePanel;
|
|
17
17
|
const hidePWAInstaller = (s: GlobalState) => s.status.hidePWAInstaller;
|
18
18
|
const isShowCredit = (s: GlobalState) => s.status.isShowCredit;
|
19
19
|
const themeMode = (s: GlobalState) => s.status.themeMode || 'auto';
|
20
|
+
const language = (s: GlobalState) => s.status.language || 'auto';
|
20
21
|
|
21
22
|
const showChatHeader = (s: GlobalState) => !s.status.zenMode;
|
22
23
|
const inZenMode = (s: GlobalState) => s.status.zenMode;
|
@@ -68,6 +69,7 @@ export const systemStatusSelectors = {
|
|
68
69
|
isPgliteNotEnabled,
|
69
70
|
isPgliteNotInited,
|
70
71
|
isShowCredit,
|
72
|
+
language,
|
71
73
|
mobileShowPortal,
|
72
74
|
mobileShowTopic,
|
73
75
|
portalWidth,
|
@@ -3,7 +3,7 @@ import useSWR, { SWRResponse } from 'swr';
|
|
3
3
|
import type { StateCreator } from 'zustand/vanilla';
|
4
4
|
|
5
5
|
import { DEFAULT_MODEL_PROVIDER_LIST } from '@/config/modelProviders';
|
6
|
-
import { ModelProvider } from '@/libs/
|
6
|
+
import { ModelProvider } from '@/libs/model-runtime';
|
7
7
|
import { UserStore } from '@/store/user';
|
8
8
|
import type { ChatModelCard, ModelProviderCard } from '@/types/llm';
|
9
9
|
import type {
|
@@ -15,7 +15,11 @@ describe('settingsSelectors', () => {
|
|
15
15
|
|
16
16
|
const result = userGeneralSettingsSelectors.config(s as UserStore);
|
17
17
|
|
18
|
-
expect(result).toEqual({
|
18
|
+
expect(result).toEqual({
|
19
|
+
fontSize: 12,
|
20
|
+
highlighterTheme: 'lobe-theme',
|
21
|
+
mermaidTheme: 'lobe-theme',
|
22
|
+
});
|
19
23
|
});
|
20
24
|
});
|
21
25
|
|
@@ -108,4 +112,28 @@ describe('settingsSelectors', () => {
|
|
108
112
|
expect(result).toBe('#ffffff');
|
109
113
|
});
|
110
114
|
});
|
115
|
+
|
116
|
+
it('should return the highlighterTheme', () => {
|
117
|
+
const s: UserState = merge(initialState, {
|
118
|
+
settings: {
|
119
|
+
general: { highlighterTheme: 'lobe-theme' },
|
120
|
+
},
|
121
|
+
});
|
122
|
+
|
123
|
+
const result = userGeneralSettingsSelectors.highlighterTheme(s as UserStore);
|
124
|
+
|
125
|
+
expect(result).toBe('lobe-theme');
|
126
|
+
});
|
127
|
+
|
128
|
+
it('should return the mermaidTheme', () => {
|
129
|
+
const s: UserState = merge(initialState, {
|
130
|
+
settings: {
|
131
|
+
general: { mermaidTheme: 'lobe-theme' },
|
132
|
+
},
|
133
|
+
});
|
134
|
+
|
135
|
+
const result = userGeneralSettingsSelectors.mermaidTheme(s as UserStore);
|
136
|
+
|
137
|
+
expect(result).toBe('lobe-theme');
|
138
|
+
});
|
111
139
|
});
|
@@ -6,10 +6,14 @@ const generalConfig = (s: UserStore) => currentSettings(s).general || {};
|
|
6
6
|
const neutralColor = (s: UserStore) => generalConfig(s).neutralColor;
|
7
7
|
const primaryColor = (s: UserStore) => generalConfig(s).primaryColor;
|
8
8
|
const fontSize = (s: UserStore) => generalConfig(s).fontSize;
|
9
|
+
const highlighterTheme = (s: UserStore) => generalConfig(s).highlighterTheme;
|
10
|
+
const mermaidTheme = (s: UserStore) => generalConfig(s).mermaidTheme;
|
9
11
|
|
10
12
|
export const userGeneralSettingsSelectors = {
|
11
13
|
config: generalConfig,
|
12
14
|
fontSize,
|
15
|
+
highlighterTheme,
|
16
|
+
mermaidTheme,
|
13
17
|
neutralColor,
|
14
18
|
primaryColor,
|
15
19
|
};
|
package/src/types/fetch.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { IPluginErrorType } from '@lobehub/chat-plugin-sdk';
|
2
2
|
|
3
|
-
import { ILobeAgentRuntimeErrorType } from '@/libs/
|
3
|
+
import { ILobeAgentRuntimeErrorType } from '@/libs/model-runtime';
|
4
4
|
import { ErrorType } from '@/types/fetch';
|
5
5
|
import { MetaData } from '@/types/meta';
|
6
6
|
import { MessageSemanticSearchChunk } from '@/types/rag';
|
@@ -1,7 +1,9 @@
|
|
1
|
-
import type { NeutralColors, PrimaryColors } from '@lobehub/ui';
|
1
|
+
import type { HighlighterProps, MermaidProps, NeutralColors, PrimaryColors } from '@lobehub/ui';
|
2
2
|
|
3
3
|
export interface UserGeneralConfig {
|
4
4
|
fontSize: number;
|
5
|
+
highlighterTheme?: HighlighterProps['theme'];
|
6
|
+
mermaidTheme?: MermaidProps['theme'];
|
5
7
|
neutralColor?: NeutralColors;
|
6
8
|
primaryColor?: PrimaryColors;
|
7
9
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { describe, expect, it, vi } from 'vitest';
|
2
2
|
|
3
|
-
import { AgentRuntimeErrorType } from '@/libs/
|
3
|
+
import { AgentRuntimeErrorType } from '@/libs/model-runtime';
|
4
4
|
import { ChatErrorType } from '@/types/fetch';
|
5
5
|
|
6
6
|
import { createErrorResponse } from './errorResponse';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AgentRuntimeErrorType, ILobeAgentRuntimeErrorType } from '@/libs/
|
1
|
+
import { AgentRuntimeErrorType, ILobeAgentRuntimeErrorType } from '@/libs/model-runtime';
|
2
2
|
import { ChatErrorType, ErrorResponse, ErrorType } from '@/types/fetch';
|
3
3
|
|
4
4
|
const getStatus = (errorType: ILobeAgentRuntimeErrorType | ErrorType) => {
|
@@ -2,7 +2,7 @@ import { isObject } from 'lodash-es';
|
|
2
2
|
|
3
3
|
import { MESSAGE_CANCEL_FLAT } from '@/const/message';
|
4
4
|
import { LOBE_CHAT_OBSERVATION_ID, LOBE_CHAT_TRACE_ID } from '@/const/trace';
|
5
|
-
import { parseToolCalls } from '@/libs/
|
5
|
+
import { parseToolCalls } from '@/libs/model-runtime';
|
6
6
|
import { ChatErrorType } from '@/types/fetch';
|
7
7
|
import { SmoothingParams } from '@/types/llm';
|
8
8
|
import {
|
@@ -5,7 +5,7 @@ import { ModelProviderCard } from '@/types/llm';
|
|
5
5
|
import { genUserLLMConfig } from './genUserLLMConfig';
|
6
6
|
|
7
7
|
// Mock ModelProvider enum
|
8
|
-
vi.mock('@/libs/
|
8
|
+
vi.mock('@/libs/model-runtime', () => ({
|
9
9
|
ModelProvider: {
|
10
10
|
Ollama: 'ollama',
|
11
11
|
OpenAI: 'openai',
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as ProviderCards from '@/config/modelProviders';
|
2
|
-
import { ModelProvider } from '@/libs/
|
2
|
+
import { ModelProvider } from '@/libs/model-runtime';
|
3
3
|
import { ModelProviderCard } from '@/types/llm';
|
4
4
|
import { UserModelProviderConfig } from '@/types/user/settings';
|
5
5
|
|
@@ -1,146 +0,0 @@
|
|
1
|
-
'use client';
|
2
|
-
|
3
|
-
import { Form, type FormGroupItemType, ImageSelect, SliderWithInput } from '@lobehub/ui';
|
4
|
-
import { Select } from '@lobehub/ui';
|
5
|
-
import isEqual from 'fast-deep-equal';
|
6
|
-
import { Monitor, Moon, Sun } from 'lucide-react';
|
7
|
-
import { memo } from 'react';
|
8
|
-
import { useTranslation } from 'react-i18next';
|
9
|
-
|
10
|
-
import { useSyncSettings } from '@/app/[variants]/(main)/settings/hooks/useSyncSettings';
|
11
|
-
import { FORM_STYLE } from '@/const/layoutTokens';
|
12
|
-
import { imageUrl } from '@/const/url';
|
13
|
-
import { Locales, localeOptions } from '@/locales/resources';
|
14
|
-
import { useGlobalStore } from '@/store/global';
|
15
|
-
import { systemStatusSelectors } from '@/store/global/selectors';
|
16
|
-
import { useUserStore } from '@/store/user';
|
17
|
-
import { settingsSelectors } from '@/store/user/selectors';
|
18
|
-
|
19
|
-
import { ThemeSwatchesNeutral, ThemeSwatchesPrimary } from './ThemeSwatches';
|
20
|
-
|
21
|
-
const Theme = memo(() => {
|
22
|
-
const { t } = useTranslation('setting');
|
23
|
-
|
24
|
-
const [form] = Form.useForm();
|
25
|
-
const settings = useUserStore(settingsSelectors.currentSettings, isEqual);
|
26
|
-
const themeMode = useGlobalStore(systemStatusSelectors.themeMode);
|
27
|
-
const [setSettings] = useUserStore((s) => [s.setSettings]);
|
28
|
-
const [setThemeMode] = useGlobalStore((s) => [s.switchThemeMode]);
|
29
|
-
|
30
|
-
useSyncSettings(form);
|
31
|
-
const [switchLocale] = useGlobalStore((s) => [s.switchLocale]);
|
32
|
-
|
33
|
-
const handleLangChange = (value: Locales) => {
|
34
|
-
switchLocale(value);
|
35
|
-
};
|
36
|
-
|
37
|
-
const theme: FormGroupItemType = {
|
38
|
-
children: [
|
39
|
-
{
|
40
|
-
children: (
|
41
|
-
<ImageSelect
|
42
|
-
height={60}
|
43
|
-
onChange={setThemeMode}
|
44
|
-
options={[
|
45
|
-
{
|
46
|
-
icon: Sun,
|
47
|
-
img: imageUrl('theme_light.webp'),
|
48
|
-
label: t('settingTheme.themeMode.light'),
|
49
|
-
value: 'light',
|
50
|
-
},
|
51
|
-
{
|
52
|
-
icon: Moon,
|
53
|
-
img: imageUrl('theme_dark.webp'),
|
54
|
-
label: t('settingTheme.themeMode.dark'),
|
55
|
-
value: 'dark',
|
56
|
-
},
|
57
|
-
{
|
58
|
-
icon: Monitor,
|
59
|
-
img: imageUrl('theme_auto.webp'),
|
60
|
-
label: t('settingTheme.themeMode.auto'),
|
61
|
-
value: 'auto',
|
62
|
-
},
|
63
|
-
]}
|
64
|
-
unoptimized={false}
|
65
|
-
value={themeMode}
|
66
|
-
width={100}
|
67
|
-
/>
|
68
|
-
),
|
69
|
-
label: t('settingTheme.themeMode.title'),
|
70
|
-
minWidth: undefined,
|
71
|
-
},
|
72
|
-
{
|
73
|
-
children: (
|
74
|
-
<Select
|
75
|
-
onChange={handleLangChange}
|
76
|
-
options={[{ label: t('settingTheme.lang.autoMode'), value: 'auto' }, ...localeOptions]}
|
77
|
-
/>
|
78
|
-
),
|
79
|
-
label: t('settingTheme.lang.title'),
|
80
|
-
name: ['general', 'language'],
|
81
|
-
},
|
82
|
-
{
|
83
|
-
children: (
|
84
|
-
<SliderWithInput
|
85
|
-
marks={{
|
86
|
-
12: {
|
87
|
-
label: 'A',
|
88
|
-
style: {
|
89
|
-
fontSize: 12,
|
90
|
-
marginTop: 4,
|
91
|
-
},
|
92
|
-
},
|
93
|
-
14: {
|
94
|
-
label: t('settingTheme.fontSize.marks.normal'),
|
95
|
-
style: {
|
96
|
-
fontSize: 14,
|
97
|
-
marginTop: 4,
|
98
|
-
},
|
99
|
-
},
|
100
|
-
18: {
|
101
|
-
label: 'A',
|
102
|
-
style: {
|
103
|
-
fontSize: 18,
|
104
|
-
marginTop: 4,
|
105
|
-
},
|
106
|
-
},
|
107
|
-
}}
|
108
|
-
max={18}
|
109
|
-
min={12}
|
110
|
-
step={1}
|
111
|
-
/>
|
112
|
-
),
|
113
|
-
desc: t('settingTheme.fontSize.desc'),
|
114
|
-
label: t('settingTheme.fontSize.title'),
|
115
|
-
name: ['general', 'fontSize'],
|
116
|
-
},
|
117
|
-
{
|
118
|
-
children: <ThemeSwatchesPrimary />,
|
119
|
-
desc: t('settingTheme.primaryColor.desc'),
|
120
|
-
label: t('settingTheme.primaryColor.title'),
|
121
|
-
minWidth: undefined,
|
122
|
-
},
|
123
|
-
{
|
124
|
-
children: <ThemeSwatchesNeutral />,
|
125
|
-
desc: t('settingTheme.neutralColor.desc'),
|
126
|
-
label: t('settingTheme.neutralColor.title'),
|
127
|
-
minWidth: undefined,
|
128
|
-
},
|
129
|
-
],
|
130
|
-
title: t('settingTheme.title'),
|
131
|
-
};
|
132
|
-
|
133
|
-
return (
|
134
|
-
<Form
|
135
|
-
form={form}
|
136
|
-
initialValues={settings}
|
137
|
-
items={[theme]}
|
138
|
-
itemsType={'group'}
|
139
|
-
onValuesChange={setSettings}
|
140
|
-
variant={'borderless'}
|
141
|
-
{...FORM_STYLE}
|
142
|
-
/>
|
143
|
-
);
|
144
|
-
});
|
145
|
-
|
146
|
-
export default Theme;
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/package/src/libs/{agent-runtime → model-runtime}/openrouter/__snapshots__/index.test.ts.snap
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/package/src/libs/{agent-runtime → model-runtime}/utils/streams/__snapshots__/protocol.test.ts.snap
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|