@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.
Files changed (270) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +3 -3
  3. package/README.zh-CN.md +3 -3
  4. package/changelog/v1.json +21 -0
  5. package/locales/ar/setting.json +43 -31
  6. package/locales/bg-BG/setting.json +43 -31
  7. package/locales/de-DE/setting.json +43 -31
  8. package/locales/en-US/setting.json +43 -31
  9. package/locales/es-ES/setting.json +43 -31
  10. package/locales/fa-IR/setting.json +43 -31
  11. package/locales/fr-FR/setting.json +43 -31
  12. package/locales/it-IT/setting.json +43 -31
  13. package/locales/ja-JP/setting.json +43 -31
  14. package/locales/ko-KR/setting.json +43 -31
  15. package/locales/nl-NL/setting.json +43 -31
  16. package/locales/pl-PL/setting.json +43 -31
  17. package/locales/pt-BR/setting.json +43 -31
  18. package/locales/ru-RU/setting.json +43 -31
  19. package/locales/tr-TR/setting.json +43 -31
  20. package/locales/vi-VN/setting.json +43 -31
  21. package/locales/zh-CN/setting.json +43 -31
  22. package/locales/zh-TW/setting.json +43 -31
  23. package/package.json +3 -3
  24. package/src/app/(backend)/middleware/auth/index.test.ts +1 -1
  25. package/src/app/(backend)/middleware/auth/index.ts +1 -1
  26. package/src/app/(backend)/middleware/auth/utils.ts +1 -1
  27. package/src/app/(backend)/webapi/chat/[provider]/route.test.ts +1 -1
  28. package/src/app/(backend)/webapi/chat/[provider]/route.ts +1 -1
  29. package/src/app/(backend)/webapi/chat/vertexai/route.ts +2 -2
  30. package/src/app/(backend)/webapi/models/[provider]/pull/route.ts +1 -1
  31. package/src/app/(backend)/webapi/models/[provider]/route.ts +1 -1
  32. package/src/app/(backend)/webapi/plugin/gateway/route.ts +1 -1
  33. package/src/app/(backend)/webapi/text-to-image/[provider]/route.ts +2 -2
  34. package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/WelcomeMessage.tsx +1 -1
  35. package/src/app/[variants]/(main)/settings/agent/index.tsx +8 -2
  36. package/src/app/[variants]/(main)/settings/common/features/Appearance/Preview.tsx +298 -0
  37. package/src/app/[variants]/(main)/settings/common/features/{Theme → Appearance}/ThemeSwatches/ThemeSwatchesNeutral.tsx +6 -11
  38. package/src/app/[variants]/(main)/settings/common/features/{Theme → Appearance}/ThemeSwatches/ThemeSwatchesPrimary.tsx +6 -10
  39. package/src/app/[variants]/(main)/settings/common/features/Appearance/index.tsx +67 -0
  40. package/src/app/[variants]/(main)/settings/common/features/ChatAppearance/ChatPreview.tsx +35 -0
  41. package/src/app/[variants]/(main)/settings/common/features/ChatAppearance/HighlighterPreview.tsx +55 -0
  42. package/src/app/[variants]/(main)/settings/common/features/ChatAppearance/MermaidPreview.tsx +51 -0
  43. package/src/app/[variants]/(main)/settings/common/features/ChatAppearance/index.tsx +128 -0
  44. package/src/app/[variants]/(main)/settings/common/features/Common.tsx +74 -42
  45. package/src/app/[variants]/(main)/settings/common/index.tsx +4 -2
  46. package/src/app/[variants]/(main)/settings/hotkey/features/{HotkeySetting.tsx → Conversation.tsx} +19 -18
  47. package/src/app/[variants]/(main)/settings/hotkey/features/Essential.tsx +88 -0
  48. package/src/app/[variants]/(main)/settings/hotkey/page.tsx +8 -2
  49. package/src/app/[variants]/(main)/settings/llm/ProviderList/Azure/index.tsx +1 -1
  50. package/src/app/[variants]/(main)/settings/llm/components/ProviderModelList/ModelConfigModal/index.tsx +1 -1
  51. package/src/app/[variants]/(main)/settings/provider/(detail)/azure/page.tsx +1 -1
  52. package/src/app/[variants]/(main)/settings/provider/(detail)/azureai/page.tsx +1 -1
  53. package/src/app/[variants]/(main)/settings/storage/Advanced.tsx +26 -0
  54. package/src/app/[variants]/(main)/settings/system-agent/features/createForm.tsx +37 -22
  55. package/src/app/[variants]/(main)/settings/tts/features/OpenAI.tsx +20 -10
  56. package/src/app/[variants]/(main)/settings/tts/features/STT.tsx +20 -11
  57. package/src/const/settings/common.ts +2 -0
  58. package/src/const/settings/llm.ts +1 -1
  59. package/src/database/models/__tests__/aiProvider.test.ts +1 -1
  60. package/src/database/models/aiProvider.ts +1 -1
  61. package/src/features/AgentSetting/AgentTTS/index.tsx +1 -1
  62. package/src/features/ChatItem/index.tsx +35 -0
  63. package/src/features/Conversation/Error/APIKeyForm/Bedrock.tsx +1 -1
  64. package/src/features/Conversation/Error/APIKeyForm/index.tsx +1 -1
  65. package/src/features/Conversation/Error/index.tsx +1 -1
  66. package/src/features/Conversation/components/ChatItem/index.tsx +2 -6
  67. package/src/features/User/UserPanel/LangButton.tsx +1 -1
  68. package/src/features/User/UserPanel/ThemeButton.tsx +3 -3
  69. package/src/libs/{agent-runtime/AgentRuntime.test.ts → model-runtime/ModelRuntime.test.ts} +3 -3
  70. package/src/libs/{agent-runtime/AgentRuntime.ts → model-runtime/ModelRuntime.ts} +3 -3
  71. package/src/libs/{agent-runtime → model-runtime}/ai21/index.test.ts +2 -2
  72. package/src/libs/{agent-runtime → model-runtime}/ai360/index.test.ts +2 -2
  73. package/src/libs/{agent-runtime → model-runtime}/anthropic/index.test.ts +1 -1
  74. package/src/libs/{agent-runtime → model-runtime}/baichuan/index.test.ts +1 -1
  75. package/src/libs/{agent-runtime → model-runtime}/bedrock/index.test.ts +1 -1
  76. package/src/libs/{agent-runtime → model-runtime}/cloudflare/index.test.ts +1 -1
  77. package/src/libs/{agent-runtime → model-runtime}/deepseek/index.test.ts +2 -2
  78. package/src/libs/{agent-runtime → model-runtime}/fireworksai/index.test.ts +2 -2
  79. package/src/libs/{agent-runtime → model-runtime}/giteeai/index.test.ts +2 -2
  80. package/src/libs/{agent-runtime → model-runtime}/github/index.test.ts +2 -2
  81. package/src/libs/{agent-runtime → model-runtime}/google/index.test.ts +1 -1
  82. package/src/libs/{agent-runtime → model-runtime}/groq/index.test.ts +2 -2
  83. package/src/libs/{agent-runtime → model-runtime}/hunyuan/index.test.ts +2 -2
  84. package/src/libs/{agent-runtime → model-runtime}/index.ts +1 -1
  85. package/src/libs/{agent-runtime → model-runtime}/internlm/index.test.ts +2 -2
  86. package/src/libs/{agent-runtime → model-runtime}/lmstudio/index.test.ts +2 -2
  87. package/src/libs/{agent-runtime → model-runtime}/mistral/index.test.ts +2 -2
  88. package/src/libs/{agent-runtime → model-runtime}/moonshot/index.test.ts +1 -1
  89. package/src/libs/{agent-runtime → model-runtime}/novita/index.test.ts +3 -3
  90. package/src/libs/{agent-runtime → model-runtime}/ollama/index.ts +1 -1
  91. package/src/libs/{agent-runtime → model-runtime}/openai/index.test.ts +1 -1
  92. package/src/libs/{agent-runtime → model-runtime}/openrouter/index.test.ts +2 -2
  93. package/src/libs/{agent-runtime → model-runtime}/perplexity/index.test.ts +2 -2
  94. package/src/libs/{agent-runtime → model-runtime}/ppio/index.test.ts +4 -4
  95. package/src/libs/{agent-runtime → model-runtime}/providerTestUtils.ts +1 -1
  96. package/src/libs/{agent-runtime → model-runtime}/qiniu/index.test.ts +2 -2
  97. package/src/libs/{agent-runtime → model-runtime}/qwen/index.test.ts +2 -2
  98. package/src/libs/{agent-runtime → model-runtime}/sensenova/index.test.ts +2 -2
  99. package/src/libs/{agent-runtime → model-runtime}/siliconcloud/index.ts +1 -6
  100. package/src/libs/{agent-runtime → model-runtime}/spark/index.test.ts +2 -2
  101. package/src/libs/{agent-runtime → model-runtime}/stepfun/index.test.ts +2 -2
  102. package/src/libs/{agent-runtime → model-runtime}/taichu/index.test.ts +2 -2
  103. package/src/libs/{agent-runtime → model-runtime}/tencentcloud/index.test.ts +1 -1
  104. package/src/libs/{agent-runtime → model-runtime}/togetherai/index.test.ts +1 -1
  105. package/src/libs/{agent-runtime → model-runtime}/upstage/index.test.ts +1 -1
  106. package/src/libs/{agent-runtime → model-runtime}/utils/openaiCompatibleFactory/index.test.ts +2 -2
  107. package/src/libs/{agent-runtime → model-runtime}/utils/openaiHelpers.ts +1 -1
  108. package/src/libs/{agent-runtime → model-runtime}/utils/streams/ollama.ts +1 -1
  109. package/src/libs/{agent-runtime → model-runtime}/utils/streams/openai.test.ts +1 -1
  110. package/src/libs/{agent-runtime → model-runtime}/utils/streams/qwen.test.ts +1 -1
  111. package/src/libs/{agent-runtime → model-runtime}/wenxin/index.test.ts +2 -2
  112. package/src/libs/{agent-runtime → model-runtime}/xai/index.test.ts +2 -2
  113. package/src/libs/{agent-runtime → model-runtime}/zeroone/index.test.ts +1 -1
  114. package/src/libs/{agent-runtime → model-runtime}/zhipu/index.test.ts +2 -2
  115. package/src/libs/oidc-provider/config.ts +1 -1
  116. package/src/libs/trpc/client/lambda.ts +1 -1
  117. package/src/locales/default/setting.ts +45 -31
  118. package/src/server/globalConfig/_deprecated.test.ts +1 -1
  119. package/src/server/globalConfig/_deprecated.ts +1 -1
  120. package/src/server/globalConfig/genServerAiProviderConfig.ts +1 -1
  121. package/src/server/modules/AgentRuntime/index.test.ts +4 -4
  122. package/src/server/modules/AgentRuntime/index.ts +1 -1
  123. package/src/server/modules/AgentRuntime/trace.ts +1 -1
  124. package/src/server/routers/async/ragEval.ts +1 -1
  125. package/src/services/__tests__/_auth.test.ts +1 -1
  126. package/src/services/__tests__/chat.test.ts +3 -3
  127. package/src/services/_auth.ts +1 -1
  128. package/src/services/chat.ts +1 -1
  129. package/src/services/textToImage.ts +1 -1
  130. package/src/services/upload.ts +1 -1
  131. package/src/store/electron/initialState.ts +1 -1
  132. package/src/store/electron/selectors/__tests__/desktopState.test.ts +55 -0
  133. package/src/store/global/selectors/systemStatus.ts +2 -0
  134. package/src/store/user/slices/modelList/action.ts +1 -1
  135. package/src/store/user/slices/settings/selectors/general.test.ts +29 -1
  136. package/src/store/user/slices/settings/selectors/general.ts +4 -0
  137. package/src/types/fetch.ts +1 -1
  138. package/src/types/message/chat.ts +1 -1
  139. package/src/types/user/settings/general.ts +3 -1
  140. package/src/types/user/settings/modelProvider.ts +1 -1
  141. package/src/utils/errorResponse.test.ts +1 -1
  142. package/src/utils/errorResponse.ts +1 -1
  143. package/src/utils/fetch/fetchSSE.ts +1 -1
  144. package/src/utils/genUserLLMConfig.test.ts +1 -1
  145. package/src/utils/genUserLLMConfig.ts +1 -1
  146. package/src/app/[variants]/(main)/settings/common/features/Theme/index.tsx +0 -146
  147. /package/src/app/[variants]/(main)/settings/common/features/{Theme → Appearance}/ThemeSwatches/index.ts +0 -0
  148. /package/src/libs/{agent-runtime → model-runtime}/BaseAI.ts +0 -0
  149. /package/src/libs/{agent-runtime → model-runtime}/UniformRuntime/index.ts +0 -0
  150. /package/src/libs/{agent-runtime → model-runtime}/ai21/index.ts +0 -0
  151. /package/src/libs/{agent-runtime → model-runtime}/ai360/index.ts +0 -0
  152. /package/src/libs/{agent-runtime → model-runtime}/anthropic/handleAnthropicError.ts +0 -0
  153. /package/src/libs/{agent-runtime → model-runtime}/anthropic/index.ts +0 -0
  154. /package/src/libs/{agent-runtime → model-runtime}/azureOpenai/index.test.ts +0 -0
  155. /package/src/libs/{agent-runtime → model-runtime}/azureOpenai/index.ts +0 -0
  156. /package/src/libs/{agent-runtime → model-runtime}/azureai/index.ts +0 -0
  157. /package/src/libs/{agent-runtime → model-runtime}/baichuan/index.ts +0 -0
  158. /package/src/libs/{agent-runtime → model-runtime}/bedrock/index.ts +0 -0
  159. /package/src/libs/{agent-runtime → model-runtime}/cloudflare/index.ts +0 -0
  160. /package/src/libs/{agent-runtime → model-runtime}/cohere/index.ts +0 -0
  161. /package/src/libs/{agent-runtime → model-runtime}/deepseek/index.ts +0 -0
  162. /package/src/libs/{agent-runtime → model-runtime}/error.ts +0 -0
  163. /package/src/libs/{agent-runtime → model-runtime}/fireworksai/index.ts +0 -0
  164. /package/src/libs/{agent-runtime → model-runtime}/giteeai/index.ts +0 -0
  165. /package/src/libs/{agent-runtime → model-runtime}/github/index.ts +0 -0
  166. /package/src/libs/{agent-runtime → model-runtime}/google/index.ts +0 -0
  167. /package/src/libs/{agent-runtime → model-runtime}/groq/index.ts +0 -0
  168. /package/src/libs/{agent-runtime → model-runtime}/helpers/index.ts +0 -0
  169. /package/src/libs/{agent-runtime → model-runtime}/helpers/parseToolCalls.test.ts +0 -0
  170. /package/src/libs/{agent-runtime → model-runtime}/helpers/parseToolCalls.ts +0 -0
  171. /package/src/libs/{agent-runtime → model-runtime}/higress/index.ts +0 -0
  172. /package/src/libs/{agent-runtime → model-runtime}/huggingface/index.ts +0 -0
  173. /package/src/libs/{agent-runtime → model-runtime}/hunyuan/index.ts +0 -0
  174. /package/src/libs/{agent-runtime → model-runtime}/infiniai/index.ts +0 -0
  175. /package/src/libs/{agent-runtime → model-runtime}/internlm/index.ts +0 -0
  176. /package/src/libs/{agent-runtime → model-runtime}/jina/index.ts +0 -0
  177. /package/src/libs/{agent-runtime → model-runtime}/lmstudio/index.ts +0 -0
  178. /package/src/libs/{agent-runtime → model-runtime}/minimax/index.ts +0 -0
  179. /package/src/libs/{agent-runtime → model-runtime}/mistral/index.ts +0 -0
  180. /package/src/libs/{agent-runtime → model-runtime}/moonshot/index.ts +0 -0
  181. /package/src/libs/{agent-runtime → model-runtime}/novita/__snapshots__/index.test.ts.snap +0 -0
  182. /package/src/libs/{agent-runtime → model-runtime}/novita/fixtures/models.json +0 -0
  183. /package/src/libs/{agent-runtime → model-runtime}/novita/index.ts +0 -0
  184. /package/src/libs/{agent-runtime → model-runtime}/novita/type.ts +0 -0
  185. /package/src/libs/{agent-runtime → model-runtime}/nvidia/index.ts +0 -0
  186. /package/src/libs/{agent-runtime → model-runtime}/ollama/index.test.ts +0 -0
  187. /package/src/libs/{agent-runtime → model-runtime}/ollama/type.ts +0 -0
  188. /package/src/libs/{agent-runtime → model-runtime}/openai/__snapshots__/index.test.ts.snap +0 -0
  189. /package/src/libs/{agent-runtime → model-runtime}/openai/fixtures/openai-models.json +0 -0
  190. /package/src/libs/{agent-runtime → model-runtime}/openai/index.ts +0 -0
  191. /package/src/libs/{agent-runtime → model-runtime}/openrouter/__snapshots__/index.test.ts.snap +0 -0
  192. /package/src/libs/{agent-runtime → model-runtime}/openrouter/fixtures/frontendModels.json +0 -0
  193. /package/src/libs/{agent-runtime → model-runtime}/openrouter/fixtures/models.json +0 -0
  194. /package/src/libs/{agent-runtime → model-runtime}/openrouter/index.ts +0 -0
  195. /package/src/libs/{agent-runtime → model-runtime}/openrouter/type.ts +0 -0
  196. /package/src/libs/{agent-runtime → model-runtime}/perplexity/index.ts +0 -0
  197. /package/src/libs/{agent-runtime → model-runtime}/ppio/__snapshots__/index.test.ts.snap +0 -0
  198. /package/src/libs/{agent-runtime → model-runtime}/ppio/fixtures/models.json +0 -0
  199. /package/src/libs/{agent-runtime → model-runtime}/ppio/index.ts +0 -0
  200. /package/src/libs/{agent-runtime → model-runtime}/ppio/type.ts +0 -0
  201. /package/src/libs/{agent-runtime → model-runtime}/providerTestUtils.test.ts +0 -0
  202. /package/src/libs/{agent-runtime → model-runtime}/qiniu/index.ts +0 -0
  203. /package/src/libs/{agent-runtime → model-runtime}/qwen/index.ts +0 -0
  204. /package/src/libs/{agent-runtime → model-runtime}/runtimeMap.ts +0 -0
  205. /package/src/libs/{agent-runtime → model-runtime}/sambanova/index.ts +0 -0
  206. /package/src/libs/{agent-runtime → model-runtime}/search1api/index.ts +0 -0
  207. /package/src/libs/{agent-runtime → model-runtime}/sensenova/index.ts +0 -0
  208. /package/src/libs/{agent-runtime → model-runtime}/spark/index.ts +0 -0
  209. /package/src/libs/{agent-runtime → model-runtime}/stepfun/index.ts +0 -0
  210. /package/src/libs/{agent-runtime → model-runtime}/taichu/index.ts +0 -0
  211. /package/src/libs/{agent-runtime → model-runtime}/tencentcloud/index.ts +0 -0
  212. /package/src/libs/{agent-runtime → model-runtime}/togetherai/fixtures/models.json +0 -0
  213. /package/src/libs/{agent-runtime → model-runtime}/togetherai/index.ts +0 -0
  214. /package/src/libs/{agent-runtime → model-runtime}/togetherai/type.ts +0 -0
  215. /package/src/libs/{agent-runtime → model-runtime}/types/chat.ts +0 -0
  216. /package/src/libs/{agent-runtime → model-runtime}/types/embeddings.ts +0 -0
  217. /package/src/libs/{agent-runtime → model-runtime}/types/index.ts +0 -0
  218. /package/src/libs/{agent-runtime → model-runtime}/types/model.ts +0 -0
  219. /package/src/libs/{agent-runtime → model-runtime}/types/textToImage.ts +0 -0
  220. /package/src/libs/{agent-runtime → model-runtime}/types/tts.ts +0 -0
  221. /package/src/libs/{agent-runtime → model-runtime}/types/type.ts +0 -0
  222. /package/src/libs/{agent-runtime → model-runtime}/upstage/index.ts +0 -0
  223. /package/src/libs/{agent-runtime → model-runtime}/utils/anthropicHelpers.test.ts +0 -0
  224. /package/src/libs/{agent-runtime → model-runtime}/utils/anthropicHelpers.ts +0 -0
  225. /package/src/libs/{agent-runtime → model-runtime}/utils/cloudflareHelpers.test.ts +0 -0
  226. /package/src/libs/{agent-runtime → model-runtime}/utils/cloudflareHelpers.ts +0 -0
  227. /package/src/libs/{agent-runtime → model-runtime}/utils/createError.ts +0 -0
  228. /package/src/libs/{agent-runtime → model-runtime}/utils/debugStream.test.ts +0 -0
  229. /package/src/libs/{agent-runtime → model-runtime}/utils/debugStream.ts +0 -0
  230. /package/src/libs/{agent-runtime → model-runtime}/utils/desensitizeUrl.test.ts +0 -0
  231. /package/src/libs/{agent-runtime → model-runtime}/utils/desensitizeUrl.ts +0 -0
  232. /package/src/libs/{agent-runtime → model-runtime}/utils/handleOpenAIError.ts +0 -0
  233. /package/src/libs/{agent-runtime → model-runtime}/utils/openaiCompatibleFactory/index.ts +0 -0
  234. /package/src/libs/{agent-runtime → model-runtime}/utils/openaiHelpers.test.ts +0 -0
  235. /package/src/libs/{agent-runtime → model-runtime}/utils/response.ts +0 -0
  236. /package/src/libs/{agent-runtime → model-runtime}/utils/sensenovaHelpers.test.ts +0 -0
  237. /package/src/libs/{agent-runtime → model-runtime}/utils/sensenovaHelpers.ts +0 -0
  238. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/__snapshots__/protocol.test.ts.snap +0 -0
  239. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/anthropic.test.ts +0 -0
  240. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/anthropic.ts +0 -0
  241. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/bedrock/claude.ts +0 -0
  242. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/bedrock/common.ts +0 -0
  243. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/bedrock/index.ts +0 -0
  244. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/bedrock/llama.test.ts +0 -0
  245. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/bedrock/llama.ts +0 -0
  246. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/google-ai.test.ts +0 -0
  247. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/google-ai.ts +0 -0
  248. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/index.ts +0 -0
  249. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/model.ts +0 -0
  250. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/ollama.test.ts +0 -0
  251. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/openai.ts +0 -0
  252. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/protocol.test.ts +0 -0
  253. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/protocol.ts +0 -0
  254. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/qwen.ts +0 -0
  255. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/spark.test.ts +0 -0
  256. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/spark.ts +0 -0
  257. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/vertex-ai.test.ts +0 -0
  258. /package/src/libs/{agent-runtime → model-runtime}/utils/streams/vertex-ai.ts +0 -0
  259. /package/src/libs/{agent-runtime → model-runtime}/utils/uriParser.test.ts +0 -0
  260. /package/src/libs/{agent-runtime → model-runtime}/utils/uriParser.ts +0 -0
  261. /package/src/libs/{agent-runtime → model-runtime}/utils/usageConverter.test.ts +0 -0
  262. /package/src/libs/{agent-runtime → model-runtime}/utils/usageConverter.ts +0 -0
  263. /package/src/libs/{agent-runtime → model-runtime}/vertexai/index.ts +0 -0
  264. /package/src/libs/{agent-runtime → model-runtime}/vllm/index.ts +0 -0
  265. /package/src/libs/{agent-runtime → model-runtime}/volcengine/index.ts +0 -0
  266. /package/src/libs/{agent-runtime → model-runtime}/wenxin/index.ts +0 -0
  267. /package/src/libs/{agent-runtime → model-runtime}/xai/index.ts +0 -0
  268. /package/src/libs/{agent-runtime → model-runtime}/xinference/index.ts +0 -0
  269. /package/src/libs/{agent-runtime → model-runtime}/zeroone/index.ts +0 -0
  270. /package/src/libs/{agent-runtime → model-runtime}/zhipu/index.ts +0 -0
@@ -0,0 +1,128 @@
1
+ 'use client';
2
+
3
+ import {
4
+ Form,
5
+ type FormGroupItemType,
6
+ Icon,
7
+ Select,
8
+ SliderWithInput,
9
+ highlighterThemes,
10
+ mermaidThemes,
11
+ } from '@lobehub/ui';
12
+ import { Skeleton } from 'antd';
13
+ import isEqual from 'fast-deep-equal';
14
+ import { Loader2Icon } from 'lucide-react';
15
+ import { memo, useState } from 'react';
16
+ import { useTranslation } from 'react-i18next';
17
+
18
+ import { FORM_STYLE } from '@/const/layoutTokens';
19
+ import { useUserStore } from '@/store/user';
20
+ import { settingsSelectors } from '@/store/user/selectors';
21
+
22
+ import ChatPreview from './ChatPreview';
23
+ import HighlighterPreview from './HighlighterPreview';
24
+ import MermaidPreview from './MermaidPreview';
25
+
26
+ const ChatAppearance = memo(() => {
27
+ const { t } = useTranslation('setting');
28
+ const { general } = useUserStore(settingsSelectors.currentSettings, isEqual);
29
+ const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);
30
+ const [loading, setLoading] = useState(false);
31
+
32
+ if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
33
+
34
+ const theme: FormGroupItemType = {
35
+ children: [
36
+ {
37
+ children: <ChatPreview fontSize={general.fontSize} />,
38
+ noStyle: true,
39
+ },
40
+ {
41
+ children: (
42
+ <SliderWithInput
43
+ marks={{
44
+ 12: {
45
+ label: 'A',
46
+ style: {
47
+ fontSize: 12,
48
+ marginTop: 4,
49
+ },
50
+ },
51
+ 14: {
52
+ label: t('settingChatAppearance.fontSize.marks.normal'),
53
+ style: {
54
+ fontSize: 14,
55
+ marginTop: 4,
56
+ },
57
+ },
58
+ 18: {
59
+ label: 'A',
60
+ style: {
61
+ fontSize: 18,
62
+ marginTop: 4,
63
+ },
64
+ },
65
+ }}
66
+ max={18}
67
+ min={12}
68
+ step={1}
69
+ />
70
+ ),
71
+ desc: t('settingChatAppearance.fontSize.desc'),
72
+ label: t('settingChatAppearance.fontSize.title'),
73
+ name: 'fontSize',
74
+ },
75
+ {
76
+ children: <HighlighterPreview theme={general.highlighterTheme} />,
77
+ noStyle: true,
78
+ },
79
+ {
80
+ children: (
81
+ <Select
82
+ options={highlighterThemes.map((item) => ({
83
+ label: item.displayName,
84
+ value: item.id,
85
+ }))}
86
+ />
87
+ ),
88
+ label: t('settingChatAppearance.highlighterTheme.title'),
89
+ name: 'highlighterTheme',
90
+ },
91
+ {
92
+ children: <MermaidPreview theme={general.mermaidTheme} />,
93
+ noStyle: true,
94
+ },
95
+ {
96
+ children: (
97
+ <Select
98
+ options={mermaidThemes.map((item) => ({
99
+ label: item.displayName,
100
+ value: item.id,
101
+ }))}
102
+ />
103
+ ),
104
+ label: t('settingChatAppearance.mermaidTheme.title'),
105
+ name: 'mermaidTheme',
106
+ },
107
+ ],
108
+ extra: loading && <Icon icon={Loader2Icon} size={16} spin style={{ opacity: 0.5 }} />,
109
+ title: t('settingChatAppearance.title'),
110
+ };
111
+
112
+ return (
113
+ <Form
114
+ initialValues={general}
115
+ items={[theme]}
116
+ itemsType={'group'}
117
+ onValuesChange={async (value) => {
118
+ setLoading(true);
119
+ await setSettings({ general: value });
120
+ setLoading(false);
121
+ }}
122
+ variant={'borderless'}
123
+ {...FORM_STYLE}
124
+ />
125
+ );
126
+ });
127
+
128
+ export default ChatAppearance;
@@ -1,14 +1,18 @@
1
1
  'use client';
2
2
 
3
- import { Button, Form, type FormGroupItemType, InputPassword } from '@lobehub/ui';
4
- import { App } from 'antd';
3
+ import { Form, type FormGroupItemType, Icon, ImageSelect, InputPassword } from '@lobehub/ui';
4
+ import { Select } from '@lobehub/ui';
5
+ import { Skeleton } from 'antd';
5
6
  import isEqual from 'fast-deep-equal';
6
- import { memo, useCallback } from 'react';
7
+ import { Loader2Icon, Monitor, Moon, Sun } from 'lucide-react';
8
+ import { memo, useState } from 'react';
7
9
  import { useTranslation } from 'react-i18next';
8
10
 
9
- import { useSyncSettings } from '@/app/[variants]/(main)/settings/hooks/useSyncSettings';
10
11
  import { FORM_STYLE } from '@/const/layoutTokens';
11
- import { DEFAULT_SETTINGS } from '@/const/settings';
12
+ import { imageUrl } from '@/const/url';
13
+ import { localeOptions } from '@/locales/resources';
14
+ import { useGlobalStore } from '@/store/global';
15
+ import { systemStatusSelectors } from '@/store/global/selectors';
12
16
  import { useServerConfigStore } from '@/store/serverConfig';
13
17
  import { serverConfigSelectors } from '@/store/serverConfig/selectors';
14
18
  import { useUserStore } from '@/store/user';
@@ -16,30 +20,67 @@ import { settingsSelectors } from '@/store/user/selectors';
16
20
 
17
21
  const Common = memo(() => {
18
22
  const { t } = useTranslation('setting');
19
- const [form] = Form.useForm();
20
23
 
21
24
  const showAccessCodeConfig = useServerConfigStore(serverConfigSelectors.enabledAccessCode);
22
-
23
25
  const settings = useUserStore(settingsSelectors.currentSettings, isEqual);
24
- const [setSettings, resetSettings] = useUserStore((s) => [s.setSettings, s.resetSettings]);
25
-
26
- const { message, modal } = App.useApp();
26
+ const themeMode = useGlobalStore(systemStatusSelectors.themeMode);
27
+ const language = useGlobalStore(systemStatusSelectors.language);
28
+ const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);
29
+ const [setThemeMode, switchLocale, isStatusInit] = useGlobalStore((s) => [
30
+ s.switchThemeMode,
31
+ s.switchLocale,
32
+ s.isStatusInit,
33
+ ]);
34
+ const [loading, setLoading] = useState(false);
27
35
 
28
- const handleReset = useCallback(() => {
29
- modal.confirm({
30
- centered: true,
31
- okButtonProps: { danger: true },
32
- onOk: () => {
33
- resetSettings();
34
- form.setFieldsValue(DEFAULT_SETTINGS);
35
- message.success(t('danger.reset.success'));
36
- },
37
- title: t('danger.reset.confirm'),
38
- });
39
- }, []);
36
+ if (!(isStatusInit && isUserStateInit))
37
+ return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
40
38
 
41
- const system: FormGroupItemType = {
39
+ const theme: FormGroupItemType = {
42
40
  children: [
41
+ {
42
+ children: (
43
+ <ImageSelect
44
+ height={60}
45
+ onChange={setThemeMode}
46
+ options={[
47
+ {
48
+ icon: Sun,
49
+ img: imageUrl('theme_light.webp'),
50
+ label: t('settingCommon.themeMode.light'),
51
+ value: 'light',
52
+ },
53
+ {
54
+ icon: Moon,
55
+ img: imageUrl('theme_dark.webp'),
56
+ label: t('settingCommon.themeMode.dark'),
57
+ value: 'dark',
58
+ },
59
+ {
60
+ icon: Monitor,
61
+ img: imageUrl('theme_auto.webp'),
62
+ label: t('settingCommon.themeMode.auto'),
63
+ value: 'auto',
64
+ },
65
+ ]}
66
+ unoptimized={false}
67
+ value={themeMode}
68
+ width={100}
69
+ />
70
+ ),
71
+ label: t('settingCommon.themeMode.title'),
72
+ minWidth: undefined,
73
+ },
74
+ {
75
+ children: (
76
+ <Select
77
+ defaultValue={language}
78
+ onChange={switchLocale}
79
+ options={[{ label: t('settingCommon.lang.autoMode'), value: 'auto' }, ...localeOptions]}
80
+ />
81
+ ),
82
+ label: t('settingCommon.lang.title'),
83
+ },
43
84
  {
44
85
  children: (
45
86
  <InputPassword
@@ -50,32 +91,23 @@ const Common = memo(() => {
50
91
  desc: t('settingSystem.accessCode.desc'),
51
92
  hidden: !showAccessCodeConfig,
52
93
  label: t('settingSystem.accessCode.title'),
53
- name: ['keyVaults', 'password'],
54
- },
55
- {
56
- children: (
57
- <Button danger onClick={handleReset} type={'primary'}>
58
- {t('danger.reset.action')}
59
- </Button>
60
- ),
61
- desc: t('danger.reset.desc'),
62
- label: t('danger.reset.title'),
63
- layout: 'horizontal',
64
- minWidth: undefined,
94
+ name: 'password',
65
95
  },
66
96
  ],
67
- title: t('settingSystem.title'),
97
+ extra: loading && <Icon icon={Loader2Icon} size={16} spin style={{ opacity: 0.5 }} />,
98
+ title: t('settingCommon.title'),
68
99
  };
69
100
 
70
- useSyncSettings(form);
71
-
72
101
  return (
73
102
  <Form
74
- form={form}
75
- initialValues={settings}
76
- items={[system]}
103
+ initialValues={settings.keyVaults}
104
+ items={[theme]}
77
105
  itemsType={'group'}
78
- onValuesChange={setSettings}
106
+ onValuesChange={async (v) => {
107
+ setLoading(true);
108
+ await setSettings({ keyVaults: v });
109
+ setLoading(false);
110
+ }}
79
111
  variant={'borderless'}
80
112
  {...FORM_STYLE}
81
113
  />
@@ -1,11 +1,13 @@
1
+ import Appearance from './features/Appearance';
2
+ import ChatAppearance from './features/ChatAppearance';
1
3
  import Common from './features/Common';
2
- import Theme from './features/Theme';
3
4
 
4
5
  const Page = () => {
5
6
  return (
6
7
  <>
7
- <Theme />
8
8
  <Common />
9
+ <Appearance />
10
+ <ChatAppearance />
9
11
  </>
10
12
  );
11
13
  };
@@ -1,8 +1,10 @@
1
1
  'use client';
2
2
 
3
- import { Form, type FormGroupItemType, HotkeyInput } from '@lobehub/ui';
3
+ import { Form, type FormGroupItemType, HotkeyInput, Icon } from '@lobehub/ui';
4
+ import { Skeleton } from 'antd';
4
5
  import isEqual from 'fast-deep-equal';
5
- import { memo } from 'react';
6
+ import { Loader2Icon } from 'lucide-react';
7
+ import { memo, useState } from 'react';
6
8
  import { useTranslation } from 'react-i18next';
7
9
 
8
10
  import { HOTKEYS_REGISTRATION } from '@/const/hotkeys';
@@ -20,17 +22,18 @@ const filterByDesktop = (item: HotkeyItem) => {
20
22
  if (!isDesktop) return !item.isDesktop;
21
23
  };
22
24
 
23
- const HOTKEY_SETTING_KEY = 'hotkey';
24
-
25
25
  const HotkeySetting = memo(() => {
26
26
  const { t } = useTranslation(['setting', 'hotkey']);
27
27
  const [form] = Form.useForm();
28
28
 
29
- const settings = useUserStore(settingsSelectors.currentSettings, isEqual);
30
- const [setSettings] = useUserStore((s) => [s.setSettings]);
29
+ const { hotkey } = useUserStore(settingsSelectors.currentSettings, isEqual);
30
+ const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);
31
+ const [loading, setLoading] = useState(false);
32
+
33
+ if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
31
34
 
32
35
  const mapHotkeyItem = (item: HotkeyItem) => {
33
- const hotkeyConflicts = Object.entries(settings.hotkey)
36
+ const hotkeyConflicts = Object.entries(hotkey)
34
37
  .map(([key, value]) => {
35
38
  if (key === item.id) return false;
36
39
  return value;
@@ -53,31 +56,29 @@ const HotkeySetting = memo(() => {
53
56
  ),
54
57
  desc: hotkeyMeta[item.id].desc ? t(`${item.id}.desc`, { ns: 'hotkey' }) : undefined,
55
58
  label: t(`${item.id}.title`, { ns: 'hotkey' }),
56
- name: [HOTKEY_SETTING_KEY, item.id],
59
+ name: item.id,
57
60
  };
58
61
  };
59
62
 
60
- const essential: FormGroupItemType = {
61
- children: HOTKEYS_REGISTRATION.filter((item) => item.group === HotkeyGroupEnum.Essential)
62
- .filter((item) => filterByDesktop(item))
63
- .map((item) => mapHotkeyItem(item)),
64
- title: t('hotkey.group.essential'),
65
- };
66
-
67
63
  const conversation: FormGroupItemType = {
68
64
  children: HOTKEYS_REGISTRATION.filter((item) => item.group === HotkeyGroupEnum.Conversation)
69
65
  .filter((item) => filterByDesktop(item))
70
66
  .map((item) => mapHotkeyItem(item)),
67
+ extra: loading && <Icon icon={Loader2Icon} size={16} spin style={{ opacity: 0.5 }} />,
71
68
  title: t('hotkey.group.conversation'),
72
69
  };
73
70
 
74
71
  return (
75
72
  <Form
76
73
  form={form}
77
- initialValues={settings}
78
- items={[essential, conversation]}
74
+ initialValues={hotkey}
75
+ items={[conversation]}
79
76
  itemsType={'group'}
80
- onValuesChange={setSettings}
77
+ onValuesChange={async (values) => {
78
+ setLoading(true);
79
+ await setSettings({ hotkey: values });
80
+ setLoading(false);
81
+ }}
81
82
  variant={'borderless'}
82
83
  {...FORM_STYLE}
83
84
  />
@@ -0,0 +1,88 @@
1
+ 'use client';
2
+
3
+ import { Form, type FormGroupItemType, HotkeyInput, Icon } from '@lobehub/ui';
4
+ import { Skeleton } from 'antd';
5
+ import isEqual from 'fast-deep-equal';
6
+ import { Loader2Icon } from 'lucide-react';
7
+ import { memo, useState } from 'react';
8
+ import { useTranslation } from 'react-i18next';
9
+
10
+ import { HOTKEYS_REGISTRATION } from '@/const/hotkeys';
11
+ import { FORM_STYLE } from '@/const/layoutTokens';
12
+ import { isDesktop } from '@/const/version';
13
+ import hotkeyMeta from '@/locales/default/hotkey';
14
+ import { useUserStore } from '@/store/user';
15
+ import { settingsSelectors } from '@/store/user/selectors';
16
+ import { HotkeyGroupEnum, HotkeyItem } from '@/types/hotkey';
17
+
18
+ const filterByDesktop = (item: HotkeyItem) => {
19
+ if (isDesktop) return true;
20
+
21
+ // is not desktop, filter out desktop only items
22
+ if (!isDesktop) return !item.isDesktop;
23
+ };
24
+
25
+ const HotkeySetting = memo(() => {
26
+ const { t } = useTranslation(['setting', 'hotkey']);
27
+ const [form] = Form.useForm();
28
+
29
+ const { hotkey } = useUserStore(settingsSelectors.currentSettings, isEqual);
30
+ const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);
31
+ const [loading, setLoading] = useState(false);
32
+
33
+ if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
34
+
35
+ const mapHotkeyItem = (item: HotkeyItem) => {
36
+ const hotkeyConflicts = Object.entries(hotkey)
37
+ .map(([key, value]) => {
38
+ if (key === item.id) return false;
39
+ return value;
40
+ })
41
+ .filter(Boolean) as string[];
42
+
43
+ return {
44
+ children: (
45
+ <HotkeyInput
46
+ disabled={item.nonEditable}
47
+ hotkeyConflicts={hotkeyConflicts}
48
+ placeholder={t('hotkey.record')}
49
+ resetValue={item.keys}
50
+ texts={{
51
+ conflicts: t('hotkey.conflicts'),
52
+ invalidCombination: t('hotkey.invalidCombination'),
53
+ reset: t('hotkey.reset'),
54
+ }}
55
+ />
56
+ ),
57
+ desc: hotkeyMeta[item.id].desc ? t(`${item.id}.desc`, { ns: 'hotkey' }) : undefined,
58
+ label: t(`${item.id}.title`, { ns: 'hotkey' }),
59
+ name: item.id,
60
+ };
61
+ };
62
+
63
+ const essential: FormGroupItemType = {
64
+ children: HOTKEYS_REGISTRATION.filter((item) => item.group === HotkeyGroupEnum.Essential)
65
+ .filter((item) => filterByDesktop(item))
66
+ .map((item) => mapHotkeyItem(item)),
67
+ extra: loading && <Icon icon={Loader2Icon} size={16} spin style={{ opacity: 0.5 }} />,
68
+ title: t('hotkey.group.essential'),
69
+ };
70
+
71
+ return (
72
+ <Form
73
+ form={form}
74
+ initialValues={hotkey}
75
+ items={[essential]}
76
+ itemsType={'group'}
77
+ onValuesChange={async (values) => {
78
+ setLoading(true);
79
+ await setSettings({ hotkey: values });
80
+ setLoading(false);
81
+ }}
82
+ variant={'borderless'}
83
+ {...FORM_STYLE}
84
+ />
85
+ );
86
+ });
87
+
88
+ export default HotkeySetting;
@@ -3,7 +3,8 @@ import { translation } from '@/server/translation';
3
3
  import { DynamicLayoutProps } from '@/types/next';
4
4
  import { RouteVariants } from '@/utils/server/routeVariants';
5
5
 
6
- import HotkeySetting from './features/HotkeySetting';
6
+ import Conversation from './features/Conversation';
7
+ import Essential from './features/Essential';
7
8
 
8
9
  export const generateMetadata = async (props: DynamicLayoutProps) => {
9
10
  const locale = await RouteVariants.getLocale(props);
@@ -16,7 +17,12 @@ export const generateMetadata = async (props: DynamicLayoutProps) => {
16
17
  };
17
18
 
18
19
  const Page = () => {
19
- return <HotkeySetting />;
20
+ return (
21
+ <>
22
+ <Essential />
23
+ <Conversation />
24
+ </>
25
+ );
20
26
  };
21
27
 
22
28
  Page.displayName = 'HotkeySetting';
@@ -5,7 +5,7 @@ import { createStyles } from 'antd-style';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
7
7
  import { AzureProviderCard } from '@/config/modelProviders';
8
- import { ModelProvider } from '@/libs/agent-runtime';
8
+ import { ModelProvider } from '@/libs/model-runtime';
9
9
  import { useUserStore } from '@/store/user';
10
10
  import { modelProviderSelectors } from '@/store/user/selectors';
11
11
 
@@ -5,7 +5,7 @@ import { memo, useState } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
7
7
  import { useUserStore } from '@/store/user';
8
- import { modelConfigSelectors } from '@/store/user/slices/modelList/selectors';
8
+ import { modelConfigSelectors } from '@/store/user/selectors';
9
9
 
10
10
  import ModelConfigForm from './Form';
11
11
 
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';
6
6
 
7
7
  import { FormInput, FormPassword } from '@/components/FormInput';
8
8
  import { AzureProviderCard } from '@/config/modelProviders';
9
- import { ModelProvider } from '@/libs/agent-runtime';
9
+ import { ModelProvider } from '@/libs/model-runtime';
10
10
  import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
11
11
  import { useUserStore } from '@/store/user';
12
12
  import { modelProviderSelectors } from '@/store/user/selectors';
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
4
4
 
5
5
  import { FormInput, FormPassword } from '@/components/FormInput';
6
6
  import { AzureAIProviderCard } from '@/config/modelProviders';
7
- import { ModelProvider } from '@/libs/agent-runtime';
7
+ import { ModelProvider } from '@/libs/model-runtime';
8
8
  import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
9
9
 
10
10
  import { KeyVaultsConfigKey, LLMProviderApiTokenKey, LLMProviderBaseUrlKey } from '../../const';
@@ -8,6 +8,7 @@ import { useCallback } from 'react';
8
8
  import { useTranslation } from 'react-i18next';
9
9
 
10
10
  import { FORM_STYLE } from '@/const/layoutTokens';
11
+ import { DEFAULT_SETTINGS } from '@/const/settings';
11
12
  import DataImporter from '@/features/DataImporter';
12
13
  import { configService } from '@/services/config';
13
14
  import { useChatStore } from '@/store/chat';
@@ -32,6 +33,7 @@ const AdvancedActions = () => {
32
33
  const [removeAllFiles] = useFileStore((s) => [s.removeAllFiles]);
33
34
  const removeAllPlugins = useToolStore((s) => s.removeAllPlugins);
34
35
  const settings = useUserStore(settingsSelectors.currentSettings, isEqual);
36
+ const [resetSettings] = useUserStore((s) => [s.resetSettings]);
35
37
 
36
38
  const handleClear = useCallback(() => {
37
39
  modal.confirm({
@@ -53,6 +55,19 @@ const AdvancedActions = () => {
53
55
  });
54
56
  }, []);
55
57
 
58
+ const handleReset = useCallback(() => {
59
+ modal.confirm({
60
+ centered: true,
61
+ okButtonProps: { danger: true },
62
+ onOk: () => {
63
+ resetSettings();
64
+ form.setFieldsValue(DEFAULT_SETTINGS);
65
+ message.success(t('danger.reset.success'));
66
+ },
67
+ title: t('danger.reset.confirm'),
68
+ });
69
+ }, []);
70
+
56
71
  const system: FormGroupItemType = {
57
72
  children: [
58
73
  {
@@ -93,6 +108,17 @@ const AdvancedActions = () => {
93
108
  layout: 'horizontal',
94
109
  minWidth: undefined,
95
110
  },
111
+ {
112
+ children: (
113
+ <Button danger onClick={handleReset} type={'primary'}>
114
+ {t('danger.reset.action')}
115
+ </Button>
116
+ ),
117
+ desc: t('danger.reset.desc'),
118
+ label: t('danger.reset.title'),
119
+ layout: 'horizontal',
120
+ minWidth: undefined,
121
+ },
96
122
  ],
97
123
  title: t('storage.actions.title'),
98
124
  };