@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
@@ -1,8 +1,8 @@
1
1
  import { NextResponse } from 'next/server';
2
2
 
3
3
  import { checkAuth } from '@/app/(backend)/middleware/auth';
4
- import { ChatCompletionErrorPayload } from '@/libs/agent-runtime';
5
- import { TextToImagePayload } from '@/libs/agent-runtime/types';
4
+ import { ChatCompletionErrorPayload } from '@/libs/model-runtime';
5
+ import { TextToImagePayload } from '@/libs/model-runtime/types';
6
6
  import { initAgentRuntimeWithUserPayload } from '@/server/modules/AgentRuntime';
7
7
  import { ChatErrorType } from '@/types/fetch';
8
8
  import { createErrorResponse } from '@/utils/errorResponse';
@@ -1,9 +1,9 @@
1
- import { ChatItem } from '@lobehub/ui/chat';
2
1
  import isEqual from 'fast-deep-equal';
3
2
  import React, { useMemo } from 'react';
4
3
  import { useTranslation } from 'react-i18next';
5
4
  import { Flexbox } from 'react-layout-kit';
6
5
 
6
+ import ChatItem from '@/features/ChatItem';
7
7
  import { useAgentStore } from '@/store/agent';
8
8
  import { agentChatConfigSelectors, agentSelectors } from '@/store/agent/selectors';
9
9
  import { useChatStore } from '@/store/chat';
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { Tabs } from '@lobehub/ui';
4
+ import { Skeleton } from 'antd';
4
5
  import { useTheme } from 'antd-style';
5
6
  import isEqual from 'fast-deep-equal';
6
7
  import { useQueryState } from 'nuqs';
@@ -21,11 +22,16 @@ const Page = memo(() => {
21
22
  });
22
23
  const config = useUserStore(settingsSelectors.defaultAgentConfig, isEqual);
23
24
  const meta = useUserStore(settingsSelectors.defaultAgentMeta, isEqual);
24
- const [updateAgent] = useUserStore((s) => [s.updateDefaultAgent]);
25
- const isUserStateInit = useUserStore((s) => s.isUserStateInit);
25
+ const [updateAgent, isUserStateInit] = useUserStore((s) => [
26
+ s.updateDefaultAgent,
27
+ s.isUserStateInit,
28
+ ]);
29
+
26
30
  const theme = useTheme();
27
31
  const mobile = useServerConfigStore((s) => s.isMobile);
28
32
 
33
+ if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
34
+
29
35
  return (
30
36
  <>
31
37
  {mobile && (
@@ -0,0 +1,298 @@
1
+ import { Block } from '@lobehub/ui';
2
+ import { createStyles } from 'antd-style';
3
+ import { rgba } from 'polished';
4
+ import { memo } from 'react';
5
+ import { Flexbox } from 'react-layout-kit';
6
+
7
+ const useStyles = createStyles(({ css, token }) => {
8
+ return {
9
+ agent: css`
10
+ padding: 4px;
11
+ border-radius: 2px;
12
+ `,
13
+ agentActive: css`
14
+ background: ${token.colorFillSecondary};
15
+ `,
16
+ bubble: css`
17
+ padding: 6px;
18
+ border: 1px solid ${rgba(token.colorBorderSecondary, 0.66)};
19
+ border-radius: 3px;
20
+ background-color: ${token.colorBgContainer};
21
+ `,
22
+ container: css`
23
+ overflow: hidden;
24
+ justify-self: flex-end;
25
+
26
+ width: 332px;
27
+ height: 200px;
28
+ border: 1px solid ${token.colorBorder};
29
+ border-radius: ${token.borderRadiusLG}px;
30
+
31
+ background: ${token.colorBgLayout};
32
+ `,
33
+ conversation: css`
34
+ background: ${token.colorBgContainerSecondary};
35
+ `,
36
+ header: css`
37
+ border-block-end: 1px solid ${token.colorBorderSecondary};
38
+ `,
39
+ icon: css`
40
+ flex: none;
41
+ border-radius: 2px;
42
+ background: ${token.colorFillSecondary};
43
+ `,
44
+ input: css`
45
+ border-block-start: 1px solid ${token.colorBorderSecondary};
46
+ `,
47
+ nav: css`
48
+ padding: 4px;
49
+ border-inline-end: 1px solid ${token.colorBorderSecondary};
50
+ background: ${token.colorBgLayout};
51
+ `,
52
+ sidebar: css`
53
+ padding: 4px;
54
+ border-inline-end: 1px solid ${token.colorBorderSecondary};
55
+ background: ${token.colorBgLayout};
56
+ `,
57
+ };
58
+ });
59
+
60
+ const AgentItem = memo<{
61
+ active?: boolean;
62
+ color?: string;
63
+ }>(({ active, color }) => {
64
+ const { cx, styles, theme } = useStyles();
65
+ return (
66
+ <Flexbox
67
+ align={'center'}
68
+ className={cx(styles.agent, active && styles.agentActive)}
69
+ gap={4}
70
+ horizontal
71
+ width={'100%'}
72
+ >
73
+ <Flexbox
74
+ className={styles.icon}
75
+ height={12}
76
+ style={{ background: color, borderRadius: '50%' }}
77
+ width={12}
78
+ />
79
+ <Flexbox flex={1} gap={4}>
80
+ <Flexbox
81
+ className={styles.icon}
82
+ height={2}
83
+ style={{
84
+ background: theme.colorTextTertiary,
85
+ }}
86
+ width={'66%'}
87
+ />
88
+ <Flexbox
89
+ className={styles.icon}
90
+ height={2}
91
+ style={{
92
+ background: theme.colorTextQuaternary,
93
+ }}
94
+ width={'100%'}
95
+ />
96
+ </Flexbox>
97
+ </Flexbox>
98
+ );
99
+ });
100
+
101
+ const Preview = memo(() => {
102
+ const { styles, theme } = useStyles();
103
+
104
+ const nav = (
105
+ <Flexbox align={'center'} className={styles.nav} gap={8} width={24}>
106
+ <Flexbox
107
+ className={styles.icon}
108
+ height={14}
109
+ style={{ border: `2px solid ${theme.colorPrimary}`, borderRadius: '50%' }}
110
+ width={14}
111
+ />
112
+ <Flexbox className={styles.icon} height={12} width={12} />
113
+ <Flexbox className={styles.icon} height={12} width={12} />
114
+ <Flexbox className={styles.icon} height={12} width={12} />
115
+ </Flexbox>
116
+ );
117
+
118
+ const sidebar = (
119
+ <Flexbox className={styles.sidebar} gap={4} width={72}>
120
+ <Flexbox
121
+ gap={4}
122
+ paddingInline={2}
123
+ style={{
124
+ paddingTop: 4,
125
+ }}
126
+ >
127
+ <Flexbox className={styles.icon} height={8} width={'50%'} />
128
+ <Flexbox
129
+ className={styles.icon}
130
+ height={8}
131
+ style={{
132
+ background: theme.colorFillTertiary,
133
+ }}
134
+ width={'100%'}
135
+ />
136
+ </Flexbox>
137
+ <AgentItem />
138
+ <AgentItem active />
139
+ <AgentItem />
140
+ <AgentItem />
141
+ </Flexbox>
142
+ );
143
+
144
+ const header = (
145
+ <Flexbox
146
+ align={'center'}
147
+ className={styles.header}
148
+ horizontal
149
+ justify={'space-between'}
150
+ padding={4}
151
+ >
152
+ <Flexbox align={'center'} gap={4} horizontal>
153
+ <Flexbox className={styles.icon} height={12} style={{ borderRadius: '50%' }} width={12} />
154
+ <Flexbox className={styles.icon} height={8} width={32} />
155
+ </Flexbox>
156
+ <Flexbox gap={2} horizontal>
157
+ <Flexbox className={styles.icon} height={10} width={10} />
158
+ <Flexbox className={styles.icon} height={10} width={10} />
159
+ </Flexbox>
160
+ </Flexbox>
161
+ );
162
+
163
+ const input = (
164
+ <Flexbox
165
+ align={'flex-end'}
166
+ className={styles.input}
167
+ height={48}
168
+ justify={'flex-end'}
169
+ padding={8}
170
+ >
171
+ <Flexbox
172
+ className={styles.icon}
173
+ height={12}
174
+ style={{
175
+ background: theme.colorPrimary,
176
+ }}
177
+ width={32}
178
+ />
179
+ </Flexbox>
180
+ );
181
+
182
+ return (
183
+ <Block className={styles.container} horizontal shadow variant={'outlined'}>
184
+ {nav}
185
+ {sidebar}
186
+ <Flexbox className={styles.conversation} flex={1}>
187
+ {header}
188
+ <Flexbox align={'flex-start'} flex={1} gap={8} padding={6}>
189
+ <Flexbox align={'center'} gap={4} horizontal justify={'flex-end'} width={'100%'}>
190
+ <Flexbox className={styles.bubble} gap={4} width={64}>
191
+ <Flexbox
192
+ className={styles.icon}
193
+ height={2}
194
+ style={{
195
+ background: theme.colorTextQuaternary,
196
+ }}
197
+ width={'100%'}
198
+ />
199
+ <Flexbox
200
+ className={styles.icon}
201
+ height={2}
202
+ style={{
203
+ background: theme.colorTextQuaternary,
204
+ }}
205
+ width={'66%'}
206
+ />
207
+ </Flexbox>
208
+ <Flexbox
209
+ className={styles.icon}
210
+ height={14}
211
+ style={{ borderRadius: '50%' }}
212
+ width={14}
213
+ />
214
+ </Flexbox>
215
+ <Flexbox gap={4} horizontal>
216
+ <Flexbox
217
+ className={styles.icon}
218
+ height={14}
219
+ style={{ borderRadius: '50%' }}
220
+ width={14}
221
+ />
222
+ <Flexbox className={styles.bubble} gap={4} width={160}>
223
+ <Flexbox
224
+ className={styles.icon}
225
+ height={2}
226
+ style={{
227
+ background: theme.colorTextQuaternary,
228
+ }}
229
+ width={'100%'}
230
+ />
231
+ <Flexbox
232
+ className={styles.icon}
233
+ height={2}
234
+ style={{
235
+ background: theme.colorTextQuaternary,
236
+ }}
237
+ width={'66%'}
238
+ />
239
+ <Flexbox
240
+ className={styles.icon}
241
+ height={2}
242
+ style={{
243
+ background: theme.colorTextQuaternary,
244
+ }}
245
+ width={'100%'}
246
+ />
247
+ <Flexbox
248
+ className={styles.icon}
249
+ height={2}
250
+ style={{
251
+ background: theme.colorTextQuaternary,
252
+ }}
253
+ width={'100%'}
254
+ />
255
+ <Flexbox
256
+ className={styles.icon}
257
+ height={2}
258
+ style={{
259
+ background: theme.colorTextQuaternary,
260
+ }}
261
+ width={'33%'}
262
+ />
263
+ </Flexbox>
264
+ </Flexbox>
265
+ <Flexbox align={'center'} gap={4} horizontal justify={'flex-end'} width={'100%'}>
266
+ <Flexbox className={styles.bubble} gap={4} width={100}>
267
+ <Flexbox
268
+ className={styles.icon}
269
+ height={2}
270
+ style={{
271
+ background: theme.colorTextQuaternary,
272
+ }}
273
+ width={'100%'}
274
+ />
275
+ <Flexbox
276
+ className={styles.icon}
277
+ height={2}
278
+ style={{
279
+ background: theme.colorTextQuaternary,
280
+ }}
281
+ width={'66%'}
282
+ />
283
+ </Flexbox>
284
+ <Flexbox
285
+ className={styles.icon}
286
+ height={14}
287
+ style={{ borderRadius: '50%' }}
288
+ width={14}
289
+ />
290
+ </Flexbox>
291
+ </Flexbox>
292
+ {input}
293
+ </Flexbox>
294
+ </Block>
295
+ );
296
+ });
297
+
298
+ export default Preview;
@@ -2,20 +2,15 @@ import { ColorSwatches, NeutralColors, findCustomThemeName, neutralColors } from
2
2
  import { memo } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
 
5
- import { useUserStore } from '@/store/user';
6
- import { userGeneralSettingsSelectors } from '@/store/user/selectors';
7
-
8
- const ThemeSwatchesNeutral = memo(() => {
5
+ const ThemeSwatchesNeutral = memo<{
6
+ onChange?: (v: NeutralColors) => void;
7
+ value?: NeutralColors;
8
+ }>(({ value, onChange }) => {
9
9
  const { t } = useTranslation('color');
10
10
 
11
- const [neutralColor, updateGeneralConfig] = useUserStore((s) => [
12
- userGeneralSettingsSelectors.neutralColor(s),
13
- s.updateGeneralConfig,
14
- ]);
15
-
16
11
  const handleSelect = (v: any) => {
17
12
  const name = findCustomThemeName('neutral', v) as NeutralColors;
18
- updateGeneralConfig({ neutralColor: name || '' });
13
+ onChange?.(name || '');
19
14
  };
20
15
 
21
16
  return (
@@ -47,7 +42,7 @@ const ThemeSwatchesNeutral = memo(() => {
47
42
  },
48
43
  ]}
49
44
  onChange={handleSelect}
50
- value={neutralColor ? neutralColors[neutralColor] : undefined}
45
+ value={value ? neutralColors[value] : undefined}
51
46
  />
52
47
  );
53
48
  });
@@ -2,19 +2,15 @@ import { ColorSwatches, PrimaryColors, findCustomThemeName, primaryColors } from
2
2
  import { memo } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
 
5
- import { useUserStore } from '@/store/user';
6
- import { userGeneralSettingsSelectors } from '@/store/user/selectors';
7
-
8
- const ThemeSwatchesPrimary = memo(() => {
5
+ const ThemeSwatchesPrimary = memo<{
6
+ onChange?: (v: PrimaryColors) => void;
7
+ value?: PrimaryColors;
8
+ }>(({ onChange, value }) => {
9
9
  const { t } = useTranslation('color');
10
- const [primaryColor, updateGeneralConfig] = useUserStore((s) => [
11
- userGeneralSettingsSelectors.primaryColor(s),
12
- s.updateGeneralConfig,
13
- ]);
14
10
 
15
11
  const handleSelect = (v: any) => {
16
12
  const name = findCustomThemeName('primary', v) as PrimaryColors;
17
- updateGeneralConfig({ primaryColor: name || '' });
13
+ onChange?.(name || '');
18
14
  };
19
15
 
20
16
  return (
@@ -74,7 +70,7 @@ const ThemeSwatchesPrimary = memo(() => {
74
70
  },
75
71
  ]}
76
72
  onChange={handleSelect}
77
- value={primaryColor ? primaryColors[primaryColor] : undefined}
73
+ value={value ? primaryColors[value] : undefined}
78
74
  />
79
75
  );
80
76
  });
@@ -0,0 +1,67 @@
1
+ 'use client';
2
+
3
+ import { Form, type FormGroupItemType, 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 { FORM_STYLE } from '@/const/layoutTokens';
11
+ import { useUserStore } from '@/store/user';
12
+ import { settingsSelectors } from '@/store/user/slices/settings/selectors';
13
+
14
+ import Preview from './Preview';
15
+ import { ThemeSwatchesNeutral, ThemeSwatchesPrimary } from './ThemeSwatches';
16
+
17
+ const Appearance = memo(() => {
18
+ const { t } = useTranslation('setting');
19
+ const { general } = useUserStore(settingsSelectors.currentSettings, isEqual);
20
+ const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);
21
+ const [loading, setLoading] = useState(false);
22
+
23
+ if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
24
+
25
+ const theme: FormGroupItemType = {
26
+ children: [
27
+ {
28
+ children: <Preview />,
29
+ label: t('settingAppearance.preview.title'),
30
+ minWidth: undefined,
31
+ },
32
+ {
33
+ children: <ThemeSwatchesPrimary />,
34
+ desc: t('settingAppearance.primaryColor.desc'),
35
+ label: t('settingAppearance.primaryColor.title'),
36
+ minWidth: undefined,
37
+ name: 'primaryColor',
38
+ },
39
+ {
40
+ children: <ThemeSwatchesNeutral />,
41
+ desc: t('settingAppearance.neutralColor.desc'),
42
+ label: t('settingAppearance.neutralColor.title'),
43
+ minWidth: undefined,
44
+ name: 'neutralColor',
45
+ },
46
+ ],
47
+ extra: loading && <Icon icon={Loader2Icon} size={16} spin style={{ opacity: 0.5 }} />,
48
+ title: t('settingAppearance.title'),
49
+ };
50
+
51
+ return (
52
+ <Form
53
+ initialValues={general}
54
+ items={[theme]}
55
+ itemsType={'group'}
56
+ onValuesChange={async (value) => {
57
+ setLoading(true);
58
+ await setSettings({ general: value });
59
+ setLoading(false);
60
+ }}
61
+ variant={'borderless'}
62
+ {...FORM_STYLE}
63
+ />
64
+ );
65
+ });
66
+
67
+ export default Appearance;
@@ -0,0 +1,35 @@
1
+ import { Block, MarkdownProps } from '@lobehub/ui';
2
+ import { ChatItem } from '@lobehub/ui/chat';
3
+ import { useTheme } from 'antd-style';
4
+ import { memo } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+
7
+ import { BRANDING_NAME } from '@/const/branding';
8
+ import { DEFAULT_INBOX_AVATAR } from '@/const/meta';
9
+
10
+ const ChatPreview = memo<Pick<MarkdownProps, 'fontSize'>>(({ fontSize }) => {
11
+ const theme = useTheme();
12
+ const { t } = useTranslation('welcome');
13
+ return (
14
+ <Block
15
+ style={{
16
+ background: theme.colorBgContainerSecondary,
17
+ marginBlock: 16,
18
+ minHeight: 110,
19
+ }}
20
+ variant={'outlined'}
21
+ >
22
+ <ChatItem
23
+ avatar={{
24
+ avatar: DEFAULT_INBOX_AVATAR,
25
+ }}
26
+ fontSize={fontSize}
27
+ message={t('guide.defaultMessageWithoutCreate', {
28
+ appName: BRANDING_NAME,
29
+ })}
30
+ />
31
+ </Block>
32
+ );
33
+ });
34
+
35
+ export default ChatPreview;
@@ -0,0 +1,55 @@
1
+ import { Block, HighlighterProps } from '@lobehub/ui';
2
+ import { ChatItem } from '@lobehub/ui/chat';
3
+ import { useTheme } from 'antd-style';
4
+ import { memo } from 'react';
5
+
6
+ import { DEFAULT_INBOX_AVATAR } from '@/const/meta';
7
+
8
+ const code = `
9
+ \`\`\`ts
10
+ const person = { name: "Alice", age: 30 };
11
+ type PersonType = typeof person; // { name: string; age: number }
12
+
13
+ // 'satisfies' to ensure a type matches but allows more specific types
14
+ type Animal = { name: string };
15
+ const dog = { name: "Buddy", breed: "Golden Retriever" } satisfies Animal;
16
+ \`\`\`
17
+ `;
18
+
19
+ const HighlighterPreview = memo<{ theme?: HighlighterProps['theme'] }>(
20
+ ({ theme }) => {
21
+ const token = useTheme();
22
+
23
+ return (
24
+ <Block
25
+ style={{
26
+ background: token.colorBgContainerSecondary,
27
+ marginBlock: 16,
28
+ minHeight: 260,
29
+ paddingBottom: 16,
30
+ }}
31
+ variant={'outlined'}
32
+ >
33
+ <ChatItem
34
+ avatar={{
35
+ avatar: DEFAULT_INBOX_AVATAR,
36
+ }}
37
+ markdownProps={{
38
+ componentProps: {
39
+ highlight: {
40
+ fullFeatured: false,
41
+ theme,
42
+ },
43
+ },
44
+ }}
45
+ message={code}
46
+ />
47
+ </Block>
48
+ );
49
+ },
50
+ (prevProps, nextProps) => {
51
+ return prevProps.theme === nextProps.theme;
52
+ },
53
+ );
54
+
55
+ export default HighlighterPreview;
@@ -0,0 +1,51 @@
1
+ import { Block, MermaidProps } from '@lobehub/ui';
2
+ import { ChatItem } from '@lobehub/ui/chat';
3
+ import { useTheme } from 'antd-style';
4
+ import { memo } from 'react';
5
+
6
+ import { DEFAULT_INBOX_AVATAR } from '@/const/meta';
7
+
8
+ const code = `\`\`\`mermaid
9
+ sequenceDiagram
10
+ Alice->>John: Hello John, how are you?
11
+ John-->>Alice: Great!
12
+ Alice-)John: See you later!
13
+ \`\`\`
14
+ `;
15
+
16
+ const MermaidPreview = memo<{ theme?: MermaidProps['theme'] }>(
17
+ ({ theme }) => {
18
+ const token = useTheme();
19
+ return (
20
+ <Block
21
+ style={{
22
+ background: token.colorBgContainerSecondary,
23
+ marginBlock: 16,
24
+ minHeight: 320,
25
+ paddingBottom: 16,
26
+ }}
27
+ variant={'outlined'}
28
+ >
29
+ <ChatItem
30
+ avatar={{
31
+ avatar: DEFAULT_INBOX_AVATAR,
32
+ }}
33
+ markdownProps={{
34
+ componentProps: {
35
+ mermaid: {
36
+ fullFeatured: false,
37
+ theme,
38
+ },
39
+ },
40
+ }}
41
+ message={code}
42
+ />
43
+ </Block>
44
+ );
45
+ },
46
+ (prevProps, nextProps) => {
47
+ return prevProps.theme === nextProps.theme;
48
+ },
49
+ );
50
+
51
+ export default MermaidPreview;