@vectorx/agent-simulator 1.0.0 → 1.1.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 (311) hide show
  1. package/lib/app.d.ts +1 -1
  2. package/lib/app.js +4 -4
  3. package/lib/config/api.config.d.ts +0 -1
  4. package/lib/config/api.config.js +3 -2
  5. package/lib/config/app.config.d.ts +2 -1
  6. package/lib/config/app.config.js +0 -1
  7. package/lib/config/upload.config.d.ts +0 -1
  8. package/lib/config/upload.config.js +0 -1
  9. package/lib/container/container.d.ts +0 -1
  10. package/lib/container/container.js +4 -2
  11. package/lib/container/identifiers.d.ts +0 -1
  12. package/lib/container/identifiers.js +0 -1
  13. package/lib/container/index.d.ts +0 -1
  14. package/lib/container/index.js +0 -1
  15. package/lib/container/types.d.ts +9 -1
  16. package/lib/container/types.js +0 -1
  17. package/lib/controllers/agent.controller.d.ts +6 -3
  18. package/lib/controllers/agent.controller.js +17 -3
  19. package/lib/controllers/auth.controller.d.ts +4 -5
  20. package/lib/controllers/auth.controller.js +3 -4
  21. package/lib/controllers/simulator.controller.d.ts +2 -3
  22. package/lib/controllers/simulator.controller.js +1 -2
  23. package/lib/controllers/upload.controller.d.ts +1 -2
  24. package/lib/controllers/upload.controller.js +5 -2
  25. package/lib/index.d.ts +1 -2
  26. package/lib/index.js +0 -1
  27. package/lib/middleware/cors.middleware.d.ts +0 -1
  28. package/lib/middleware/cors.middleware.js +0 -1
  29. package/lib/middleware/error.middleware.d.ts +3 -4
  30. package/lib/middleware/error.middleware.js +2 -3
  31. package/lib/middleware/proxy.middleware.d.ts +1 -2
  32. package/lib/middleware/proxy.middleware.js +0 -1
  33. package/lib/middleware/upload.middleware.d.ts +0 -1
  34. package/lib/middleware/upload.middleware.js +0 -1
  35. package/lib/routes/agent.d.ts +0 -1
  36. package/lib/routes/agent.js +2 -1
  37. package/lib/routes/auth.d.ts +0 -1
  38. package/lib/routes/auth.js +0 -1
  39. package/lib/routes/index.d.ts +0 -1
  40. package/lib/routes/index.js +0 -1
  41. package/lib/routes/simulator.d.ts +0 -1
  42. package/lib/routes/simulator.js +0 -1
  43. package/lib/routes/upload.d.ts +0 -1
  44. package/lib/routes/upload.js +0 -1
  45. package/lib/services/agent.service.d.ts +15 -2
  46. package/lib/services/agent.service.js +34 -8
  47. package/lib/services/auth.service.d.ts +1 -2
  48. package/lib/services/auth.service.js +5 -6
  49. package/lib/services/simulator.service.d.ts +0 -1
  50. package/lib/services/simulator.service.js +0 -1
  51. package/lib/services/upload.service.d.ts +0 -1
  52. package/lib/services/upload.service.js +0 -1
  53. package/lib/simulator.d.ts +11 -1
  54. package/lib/simulator.js +90 -6
  55. package/lib/utils/env-helper.d.ts +0 -1
  56. package/lib/utils/env-helper.js +0 -1
  57. package/lib/utils/logger.d.ts +0 -1
  58. package/lib/utils/logger.js +0 -1
  59. package/lib/utils/request.d.ts +0 -1
  60. package/lib/utils/request.js +6 -2
  61. package/lib/utils/url-parser.d.ts +0 -1
  62. package/lib/utils/url-parser.js +1 -2
  63. package/lib/utils.d.ts +0 -1
  64. package/lib/utils.js +0 -1
  65. package/lib/webview-ui/Agent.d.ts +0 -1
  66. package/lib/webview-ui/Agent.js +0 -1
  67. package/lib/webview-ui/App.d.ts +0 -1
  68. package/lib/webview-ui/App.js +176 -34
  69. package/lib/webview-ui/ErrorBoundary.d.ts +0 -1
  70. package/lib/webview-ui/ErrorBoundary.js +0 -1
  71. package/lib/webview-ui/components/AsyncTaskBlock.d.ts +1 -2
  72. package/lib/webview-ui/components/AsyncTaskBlock.js +16 -5
  73. package/lib/webview-ui/components/AuthIndicator.d.ts +1 -2
  74. package/lib/webview-ui/components/AuthIndicator.js +0 -1
  75. package/lib/webview-ui/components/ErrorCard.d.ts +1 -2
  76. package/lib/webview-ui/components/ErrorCard.js +7 -5
  77. package/lib/webview-ui/components/KnowledgeBaseSearchBlock.d.ts +1 -2
  78. package/lib/webview-ui/components/KnowledgeBaseSearchBlock.js +4 -3
  79. package/lib/webview-ui/components/KnowledgeBaseSearchResult.d.ts +1 -2
  80. package/lib/webview-ui/components/KnowledgeBaseSearchResult.js +1 -2
  81. package/lib/webview-ui/components/MarkdownRenderer.d.ts +1 -2
  82. package/lib/webview-ui/components/MarkdownRenderer.js +3 -8
  83. package/lib/webview-ui/components/MessageRenderer.d.ts +1 -2
  84. package/lib/webview-ui/components/MessageRenderer.js +48 -5
  85. package/lib/webview-ui/components/MultimodalFileRenderer.d.ts +2 -2
  86. package/lib/webview-ui/components/MultimodalFileRenderer.js +97 -40
  87. package/lib/webview-ui/components/ThinkingBlock.d.ts +2 -3
  88. package/lib/webview-ui/components/ThinkingBlock.js +0 -1
  89. package/lib/webview-ui/components/ToolUseBlock.d.ts +1 -2
  90. package/lib/webview-ui/components/ToolUseBlock.js +1 -2
  91. package/lib/webview-ui/components/ToolUseBlockHeader.d.ts +1 -2
  92. package/lib/webview-ui/components/ToolUseBlockHeader.js +1 -2
  93. package/lib/webview-ui/components/UploadPreview.d.ts +1 -2
  94. package/lib/webview-ui/components/UploadPreview.js +0 -1
  95. package/lib/webview-ui/components/WelcomeModule.d.ts +0 -1
  96. package/lib/webview-ui/components/WelcomeModule.js +46 -16
  97. package/lib/webview-ui/components/index.d.ts +0 -1
  98. package/lib/webview-ui/components/index.js +0 -1
  99. package/lib/webview-ui/config/cos-config.d.ts +0 -1
  100. package/lib/webview-ui/config/cos-config.js +0 -1
  101. package/lib/webview-ui/config/http-config.d.ts +0 -1
  102. package/lib/webview-ui/config/http-config.js +0 -1
  103. package/lib/webview-ui/constants.d.ts +0 -1
  104. package/lib/webview-ui/constants.js +0 -1
  105. package/lib/webview-ui/contexts/AgentContext.d.ts +1 -2
  106. package/lib/webview-ui/contexts/AgentContext.js +0 -1
  107. package/lib/webview-ui/contexts/AuthContext.d.ts +2 -2
  108. package/lib/webview-ui/contexts/AuthContext.js +0 -1
  109. package/lib/webview-ui/contexts/ThemeContext.d.ts +2 -2
  110. package/lib/webview-ui/contexts/ThemeContext.js +0 -1
  111. package/lib/webview-ui/hooks/useAgentStatus.d.ts +4 -2
  112. package/lib/webview-ui/hooks/useAgentStatus.js +31 -5
  113. package/lib/webview-ui/hooks/useUploader.d.ts +0 -1
  114. package/lib/webview-ui/hooks/useUploader.js +5 -2
  115. package/lib/webview-ui/hooks/useUserAvatar.d.ts +0 -1
  116. package/lib/webview-ui/hooks/useUserAvatar.js +0 -1
  117. package/lib/webview-ui/index.d.ts +1 -1
  118. package/lib/webview-ui/index.js +1 -1
  119. package/lib/webview-ui/services/agent-service.d.ts +14 -1
  120. package/lib/webview-ui/services/agent-service.js +7 -1
  121. package/lib/webview-ui/services/index.d.ts +0 -1
  122. package/lib/webview-ui/services/index.js +0 -1
  123. package/lib/webview-ui/services/logger-service.d.ts +0 -1
  124. package/lib/webview-ui/services/logger-service.js +0 -1
  125. package/lib/webview-ui/styles/copilot.d.ts +0 -1
  126. package/lib/webview-ui/styles/copilot.js +80 -22
  127. package/lib/webview-ui/styles/workarea.d.ts +0 -1
  128. package/lib/webview-ui/styles/workarea.js +7 -2
  129. package/lib/webview-ui/types.d.ts +11 -2
  130. package/lib/webview-ui/types.js +0 -1
  131. package/lib/webview-ui/utils/cos.d.ts +0 -1
  132. package/lib/webview-ui/utils/cos.js +4 -3
  133. package/lib/webview-ui/utils/env-helper.d.ts +6 -1
  134. package/lib/webview-ui/utils/env-helper.js +16 -2
  135. package/lib/webview-ui/utils/http-client.d.ts +1 -2
  136. package/lib/webview-ui/utils/http-client.js +0 -1
  137. package/lib/webview-ui/utils/markdownHighlight.d.ts +3 -0
  138. package/lib/webview-ui/utils/markdownHighlight.js +75 -0
  139. package/lib/webview-ui/utils/stream-text-handler.d.ts +0 -1
  140. package/lib/webview-ui/utils/stream-text-handler.js +6 -3
  141. package/lib/webview-ui/utils/upload.d.ts +0 -1
  142. package/lib/webview-ui/utils/upload.js +5 -2
  143. package/lib/webview-ui/widgets/BubbleComponents.d.ts +1 -2
  144. package/lib/webview-ui/widgets/BubbleComponents.js +1 -2
  145. package/lib/webview-ui/widgets/ChatInput.d.ts +1 -2
  146. package/lib/webview-ui/widgets/ChatInput.js +63 -90
  147. package/lib/webview-ui/widgets/LogPanel.d.ts +2 -3
  148. package/lib/webview-ui/widgets/LogPanel.js +5 -2
  149. package/lib/webview-ui/widgets/SystemLogs.d.ts +1 -2
  150. package/lib/webview-ui/widgets/SystemLogs.js +26 -9
  151. package/lib/webview-ui/widgets/ToolBar.d.ts +4 -3
  152. package/lib/webview-ui/widgets/ToolBar.js +6 -4
  153. package/lib/webview-ui/widgets/WebSocketDebugger.d.ts +6 -0
  154. package/lib/webview-ui/widgets/WebSocketDebugger.js +226 -0
  155. package/lib/webview-ui/widgets/index.d.ts +0 -1
  156. package/lib/webview-ui/widgets/index.js +0 -1
  157. package/package.json +9 -7
  158. package/public/assets/main.js +193 -166
  159. package/public/assets/style.css +1 -1
  160. package/lib/app.d.ts.map +0 -1
  161. package/lib/app.js.map +0 -1
  162. package/lib/config/api.config.d.ts.map +0 -1
  163. package/lib/config/api.config.js.map +0 -1
  164. package/lib/config/app.config.d.ts.map +0 -1
  165. package/lib/config/app.config.js.map +0 -1
  166. package/lib/config/upload.config.d.ts.map +0 -1
  167. package/lib/config/upload.config.js.map +0 -1
  168. package/lib/container/container.d.ts.map +0 -1
  169. package/lib/container/container.js.map +0 -1
  170. package/lib/container/identifiers.d.ts.map +0 -1
  171. package/lib/container/identifiers.js.map +0 -1
  172. package/lib/container/index.d.ts.map +0 -1
  173. package/lib/container/index.js.map +0 -1
  174. package/lib/container/types.d.ts.map +0 -1
  175. package/lib/container/types.js.map +0 -1
  176. package/lib/controllers/agent.controller.d.ts.map +0 -1
  177. package/lib/controllers/agent.controller.js.map +0 -1
  178. package/lib/controllers/auth.controller.d.ts.map +0 -1
  179. package/lib/controllers/auth.controller.js.map +0 -1
  180. package/lib/controllers/simulator.controller.d.ts.map +0 -1
  181. package/lib/controllers/simulator.controller.js.map +0 -1
  182. package/lib/controllers/upload.controller.d.ts.map +0 -1
  183. package/lib/controllers/upload.controller.js.map +0 -1
  184. package/lib/index.d.ts.map +0 -1
  185. package/lib/index.js.map +0 -1
  186. package/lib/middleware/cors.middleware.d.ts.map +0 -1
  187. package/lib/middleware/cors.middleware.js.map +0 -1
  188. package/lib/middleware/error.middleware.d.ts.map +0 -1
  189. package/lib/middleware/error.middleware.js.map +0 -1
  190. package/lib/middleware/proxy.middleware.d.ts.map +0 -1
  191. package/lib/middleware/proxy.middleware.js.map +0 -1
  192. package/lib/middleware/upload.middleware.d.ts.map +0 -1
  193. package/lib/middleware/upload.middleware.js.map +0 -1
  194. package/lib/routes/agent.d.ts.map +0 -1
  195. package/lib/routes/agent.js.map +0 -1
  196. package/lib/routes/auth.d.ts.map +0 -1
  197. package/lib/routes/auth.js.map +0 -1
  198. package/lib/routes/index.d.ts.map +0 -1
  199. package/lib/routes/index.js.map +0 -1
  200. package/lib/routes/simulator.d.ts.map +0 -1
  201. package/lib/routes/simulator.js.map +0 -1
  202. package/lib/routes/upload.d.ts.map +0 -1
  203. package/lib/routes/upload.js.map +0 -1
  204. package/lib/services/agent.service.d.ts.map +0 -1
  205. package/lib/services/agent.service.js.map +0 -1
  206. package/lib/services/auth.service.d.ts.map +0 -1
  207. package/lib/services/auth.service.js.map +0 -1
  208. package/lib/services/simulator.service.d.ts.map +0 -1
  209. package/lib/services/simulator.service.js.map +0 -1
  210. package/lib/services/upload.service.d.ts.map +0 -1
  211. package/lib/services/upload.service.js.map +0 -1
  212. package/lib/simulator.d.ts.map +0 -1
  213. package/lib/simulator.js.map +0 -1
  214. package/lib/utils/env-helper.d.ts.map +0 -1
  215. package/lib/utils/env-helper.js.map +0 -1
  216. package/lib/utils/logger.d.ts.map +0 -1
  217. package/lib/utils/logger.js.map +0 -1
  218. package/lib/utils/request.d.ts.map +0 -1
  219. package/lib/utils/request.js.map +0 -1
  220. package/lib/utils/url-parser.d.ts.map +0 -1
  221. package/lib/utils/url-parser.js.map +0 -1
  222. package/lib/utils.d.ts.map +0 -1
  223. package/lib/utils.js.map +0 -1
  224. package/lib/webview-ui/Agent.d.ts.map +0 -1
  225. package/lib/webview-ui/Agent.js.map +0 -1
  226. package/lib/webview-ui/App.d.ts.map +0 -1
  227. package/lib/webview-ui/App.js.map +0 -1
  228. package/lib/webview-ui/ErrorBoundary.d.ts.map +0 -1
  229. package/lib/webview-ui/ErrorBoundary.js.map +0 -1
  230. package/lib/webview-ui/components/AsyncTaskBlock.d.ts.map +0 -1
  231. package/lib/webview-ui/components/AsyncTaskBlock.js.map +0 -1
  232. package/lib/webview-ui/components/AuthIndicator.d.ts.map +0 -1
  233. package/lib/webview-ui/components/AuthIndicator.js.map +0 -1
  234. package/lib/webview-ui/components/ErrorCard.d.ts.map +0 -1
  235. package/lib/webview-ui/components/ErrorCard.js.map +0 -1
  236. package/lib/webview-ui/components/KnowledgeBaseSearchBlock.d.ts.map +0 -1
  237. package/lib/webview-ui/components/KnowledgeBaseSearchBlock.js.map +0 -1
  238. package/lib/webview-ui/components/KnowledgeBaseSearchResult.d.ts.map +0 -1
  239. package/lib/webview-ui/components/KnowledgeBaseSearchResult.js.map +0 -1
  240. package/lib/webview-ui/components/MarkdownRenderer.d.ts.map +0 -1
  241. package/lib/webview-ui/components/MarkdownRenderer.js.map +0 -1
  242. package/lib/webview-ui/components/MessageRenderer.d.ts.map +0 -1
  243. package/lib/webview-ui/components/MessageRenderer.js.map +0 -1
  244. package/lib/webview-ui/components/MultimodalFileRenderer.d.ts.map +0 -1
  245. package/lib/webview-ui/components/MultimodalFileRenderer.js.map +0 -1
  246. package/lib/webview-ui/components/ThinkingBlock.d.ts.map +0 -1
  247. package/lib/webview-ui/components/ThinkingBlock.js.map +0 -1
  248. package/lib/webview-ui/components/ToolUseBlock.d.ts.map +0 -1
  249. package/lib/webview-ui/components/ToolUseBlock.js.map +0 -1
  250. package/lib/webview-ui/components/ToolUseBlockHeader.d.ts.map +0 -1
  251. package/lib/webview-ui/components/ToolUseBlockHeader.js.map +0 -1
  252. package/lib/webview-ui/components/UploadPreview.d.ts.map +0 -1
  253. package/lib/webview-ui/components/UploadPreview.js.map +0 -1
  254. package/lib/webview-ui/components/WelcomeModule.d.ts.map +0 -1
  255. package/lib/webview-ui/components/WelcomeModule.js.map +0 -1
  256. package/lib/webview-ui/components/index.d.ts.map +0 -1
  257. package/lib/webview-ui/components/index.js.map +0 -1
  258. package/lib/webview-ui/config/cos-config.d.ts.map +0 -1
  259. package/lib/webview-ui/config/cos-config.js.map +0 -1
  260. package/lib/webview-ui/config/http-config.d.ts.map +0 -1
  261. package/lib/webview-ui/config/http-config.js.map +0 -1
  262. package/lib/webview-ui/constants.d.ts.map +0 -1
  263. package/lib/webview-ui/constants.js.map +0 -1
  264. package/lib/webview-ui/contexts/AgentContext.d.ts.map +0 -1
  265. package/lib/webview-ui/contexts/AgentContext.js.map +0 -1
  266. package/lib/webview-ui/contexts/AuthContext.d.ts.map +0 -1
  267. package/lib/webview-ui/contexts/AuthContext.js.map +0 -1
  268. package/lib/webview-ui/contexts/ThemeContext.d.ts.map +0 -1
  269. package/lib/webview-ui/contexts/ThemeContext.js.map +0 -1
  270. package/lib/webview-ui/hooks/useAgentStatus.d.ts.map +0 -1
  271. package/lib/webview-ui/hooks/useAgentStatus.js.map +0 -1
  272. package/lib/webview-ui/hooks/useUploader.d.ts.map +0 -1
  273. package/lib/webview-ui/hooks/useUploader.js.map +0 -1
  274. package/lib/webview-ui/hooks/useUserAvatar.d.ts.map +0 -1
  275. package/lib/webview-ui/hooks/useUserAvatar.js.map +0 -1
  276. package/lib/webview-ui/index.d.ts.map +0 -1
  277. package/lib/webview-ui/index.js.map +0 -1
  278. package/lib/webview-ui/services/agent-service.d.ts.map +0 -1
  279. package/lib/webview-ui/services/agent-service.js.map +0 -1
  280. package/lib/webview-ui/services/index.d.ts.map +0 -1
  281. package/lib/webview-ui/services/index.js.map +0 -1
  282. package/lib/webview-ui/services/logger-service.d.ts.map +0 -1
  283. package/lib/webview-ui/services/logger-service.js.map +0 -1
  284. package/lib/webview-ui/styles/copilot.d.ts.map +0 -1
  285. package/lib/webview-ui/styles/copilot.js.map +0 -1
  286. package/lib/webview-ui/styles/workarea.d.ts.map +0 -1
  287. package/lib/webview-ui/styles/workarea.js.map +0 -1
  288. package/lib/webview-ui/types.d.ts.map +0 -1
  289. package/lib/webview-ui/types.js.map +0 -1
  290. package/lib/webview-ui/utils/cos.d.ts.map +0 -1
  291. package/lib/webview-ui/utils/cos.js.map +0 -1
  292. package/lib/webview-ui/utils/env-helper.d.ts.map +0 -1
  293. package/lib/webview-ui/utils/env-helper.js.map +0 -1
  294. package/lib/webview-ui/utils/http-client.d.ts.map +0 -1
  295. package/lib/webview-ui/utils/http-client.js.map +0 -1
  296. package/lib/webview-ui/utils/stream-text-handler.d.ts.map +0 -1
  297. package/lib/webview-ui/utils/stream-text-handler.js.map +0 -1
  298. package/lib/webview-ui/utils/upload.d.ts.map +0 -1
  299. package/lib/webview-ui/utils/upload.js.map +0 -1
  300. package/lib/webview-ui/widgets/BubbleComponents.d.ts.map +0 -1
  301. package/lib/webview-ui/widgets/BubbleComponents.js.map +0 -1
  302. package/lib/webview-ui/widgets/ChatInput.d.ts.map +0 -1
  303. package/lib/webview-ui/widgets/ChatInput.js.map +0 -1
  304. package/lib/webview-ui/widgets/LogPanel.d.ts.map +0 -1
  305. package/lib/webview-ui/widgets/LogPanel.js.map +0 -1
  306. package/lib/webview-ui/widgets/SystemLogs.d.ts.map +0 -1
  307. package/lib/webview-ui/widgets/SystemLogs.js.map +0 -1
  308. package/lib/webview-ui/widgets/ToolBar.d.ts.map +0 -1
  309. package/lib/webview-ui/widgets/ToolBar.js.map +0 -1
  310. package/lib/webview-ui/widgets/index.d.ts.map +0 -1
  311. package/lib/webview-ui/widgets/index.js.map +0 -1
@@ -3,6 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MessageRenderer = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const _1 = require(".");
6
+ /** 将 part(image/video/audio)转为 MultimodalFile,供 MultimodalFileRenderer 渲染 */
7
+ function partToMultimodalFile(part, messageId, index) {
8
+ const type = part.type;
9
+ return {
10
+ id: `${messageId}-part-${index}`,
11
+ name: type === "image" ? "图片" : type === "video" ? "视频" : "音频",
12
+ url: part.content,
13
+ type,
14
+ size: 0,
15
+ mimeType: type === "audio" ? "audio/mpeg" : type === "image" ? "image/png" : "video/mp4",
16
+ uploadTime: Date.now(),
17
+ status: "success",
18
+ metadata: part.metadata,
19
+ };
20
+ }
6
21
  const cardComponentMap = {
7
22
  knowledge_base_search: _1.KnowledgeBaseSearchBlock,
8
23
  knowledge_base_search_response: (props) => (0, jsx_runtime_1.jsx)(_1.KnowledgeBaseSearchBlock, { ...props, isResponse: true }),
@@ -12,8 +27,37 @@ const cardComponentMap = {
12
27
  error_card: (props) => (0, jsx_runtime_1.jsx)(_1.ErrorCard, { ...props }),
13
28
  };
14
29
  const MessageRenderer = ({ message }) => {
15
- const { cards, reasoningContent, content, files, type } = message;
16
- return ((0, jsx_runtime_1.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "10px" }, children: [cards?.map((card, index) => {
30
+ const { cards, reasoningContent, content, files, type, metadata, parts } = message;
31
+ // parts 时按多段顺序渲染
32
+ const renderBody = () => {
33
+ if (parts?.length) {
34
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: parts.map((part, index) => {
35
+ if (part.type === "text") {
36
+ return part.content ? ((0, jsx_runtime_1.jsx)(_1.MarkdownRenderer, { content: part.content }, `${message.id}-part-${index}`)) : null;
37
+ }
38
+ if (part.type === "image" || part.type === "video" || part.type === "audio") {
39
+ const file = partToMultimodalFile(part, message.id, index);
40
+ return (0, jsx_runtime_1.jsx)(_1.MultimodalFileRenderer, { files: [file] }, `${message.id}-part-${index}`);
41
+ }
42
+ return null;
43
+ }) }));
44
+ }
45
+ // 兼容:无 parts 时按原 type/content 渲染
46
+ if (type === "error")
47
+ return null;
48
+ if (type === "image")
49
+ return ((0, jsx_runtime_1.jsx)(_1.MultimodalFileRenderer, { files: files || [], primaryMedia: content ? { url: content, type: "image" } : undefined }));
50
+ if (type === "audio")
51
+ return ((0, jsx_runtime_1.jsx)(_1.MultimodalFileRenderer, { files: files || [], primaryMedia: content ? { url: content, type: "audio", metadata } : undefined }));
52
+ if (content)
53
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(_1.MarkdownRenderer, { content: content }), (0, jsx_runtime_1.jsx)(_1.MultimodalFileRenderer, { files: files || [] })] }));
54
+ return (0, jsx_runtime_1.jsx)(_1.MultimodalFileRenderer, { files: files || [] });
55
+ };
56
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
57
+ display: "flex",
58
+ flexDirection: "column",
59
+ gap: "4px",
60
+ }, children: [cards?.map((card, index) => {
17
61
  const CardComponent = cardComponentMap[card.type];
18
62
  if (!CardComponent) {
19
63
  console.warn(`No component found for card type: ${card.type}`);
@@ -23,11 +67,10 @@ const MessageRenderer = ({ message }) => {
23
67
  try {
24
68
  cardContent = JSON.parse(card.content);
25
69
  }
26
- catch (e) {
70
+ catch (_e) {
27
71
  cardContent = { content: card.content };
28
72
  }
29
73
  return (0, jsx_runtime_1.jsx)(CardComponent, { ...cardContent }, index);
30
- }), reasoningContent && (0, jsx_runtime_1.jsx)(_1.ThinkingBlock, { message: message }), type === "error" ? null : type === "image" ? ((0, jsx_runtime_1.jsx)(_1.MultimodalFileRenderer, { files: files || [], primaryMedia: content ? { url: content, type: "image" } : undefined })) : content ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(_1.MarkdownRenderer, { content: content }), (0, jsx_runtime_1.jsx)(_1.MultimodalFileRenderer, { files: files || [] })] })) : ((0, jsx_runtime_1.jsx)(_1.MultimodalFileRenderer, { files: files || [] }))] }));
74
+ }), reasoningContent && (0, jsx_runtime_1.jsx)(_1.ThinkingBlock, { message: message }), renderBody()] }));
31
75
  };
32
76
  exports.MessageRenderer = MessageRenderer;
33
- //# sourceMappingURL=MessageRenderer.js.map
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import type React from "react";
2
2
  import type { MultimodalFile } from "../types";
3
3
  interface MultimodalFileRendererProps {
4
4
  files: MultimodalFile[];
@@ -11,10 +11,10 @@ interface MultimodalFileRendererProps {
11
11
  type: "image" | "video" | "audio";
12
12
  name?: string;
13
13
  thumbnail?: string;
14
+ metadata?: Record<string, any>;
14
15
  };
15
16
  maxPreviewCount?: number;
16
17
  showDownload?: boolean;
17
18
  }
18
19
  export declare const MultimodalFileRenderer: React.FC<MultimodalFileRendererProps>;
19
20
  export {};
20
- //# sourceMappingURL=MultimodalFileRenderer.d.ts.map
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const icons_1 = require("@ant-design/icons");
6
6
  const antd_1 = require("antd");
7
7
  const react_1 = require("react");
8
+ const ThemeContext_1 = require("../contexts/ThemeContext");
8
9
  const { Text } = antd_1.Typography;
9
10
  // 文件类型图标映射
10
11
  const fileTypeIcons = {
@@ -22,6 +23,24 @@ const fileTypeNames = {
22
23
  video: "视频",
23
24
  audio: "音频",
24
25
  };
26
+ // 音频卡片容器样式
27
+ const getAudioCardStyle = (isDark) => ({
28
+ width: "100%",
29
+ borderRadius: "8px",
30
+ background: isDark ? "#1f1f1f" : "#fafafa",
31
+ border: `1px solid ${isDark ? "#303030" : "#f0f0f0"}`,
32
+ padding: "12px",
33
+ });
34
+ // 音频元数据标签样式
35
+ const getAudioTagStyle = (isDark) => ({
36
+ fontSize: "11px",
37
+ padding: "1px 6px",
38
+ borderRadius: "4px",
39
+ background: isDark ? "#111a2c" : "#e6f4ff",
40
+ color: isDark ? "#3c89e8" : "#1677ff",
41
+ fontFamily: "monospace",
42
+ lineHeight: "18px",
43
+ });
25
44
  // 格式化文件大小
26
45
  const formatFileSize = (bytes) => {
27
46
  if (bytes === 0)
@@ -32,7 +51,7 @@ const formatFileSize = (bytes) => {
32
51
  return Number.parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
33
52
  };
34
53
  // 单个文件组件
35
- const FileItem = ({ file, onDownload }) => {
54
+ const FileItem = ({ file, isDark, onDownload }) => {
36
55
  const [previewVisible, setPreviewVisible] = (0, react_1.useState)(false);
37
56
  const [imagePreviewVisible, setImagePreviewVisible] = (0, react_1.useState)(false);
38
57
  const handleDownload = () => {
@@ -84,7 +103,11 @@ const FileItem = ({ file, onDownload }) => {
84
103
  border: "1px solid #d9d9d9",
85
104
  borderRadius: "8px",
86
105
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
87
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: { fontSize: "36px", color: "#10a37f", marginBottom: "12px" }, children: (0, jsx_runtime_1.jsx)(icons_1.PictureOutlined, {}) }), (0, jsx_runtime_1.jsx)(Text, { style: {
106
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
107
+ fontSize: "36px",
108
+ color: "#10a37f",
109
+ marginBottom: "12px",
110
+ }, children: (0, jsx_runtime_1.jsx)(icons_1.PictureOutlined, {}) }), (0, jsx_runtime_1.jsx)(Text, { style: {
88
111
  fontSize: "13px",
89
112
  textAlign: "center",
90
113
  fontWeight: 500,
@@ -97,7 +120,10 @@ const FileItem = ({ file, onDownload }) => {
97
120
  maxHeight: "200px",
98
121
  borderRadius: "8px",
99
122
  cursor: "pointer",
100
- }, onClick: () => setImagePreviewVisible(true), preview: false }), (0, jsx_runtime_1.jsx)(antd_1.Tooltip, { title: "\u9884\u89C8", children: (0, jsx_runtime_1.jsx)(antd_1.Button, { type: "text", icon: (0, jsx_runtime_1.jsx)(icons_1.EyeOutlined, {}), size: "small", style: {
123
+ }, preview: {
124
+ visible: imagePreviewVisible,
125
+ onVisibleChange: (v) => setImagePreviewVisible(v),
126
+ } }), (0, jsx_runtime_1.jsx)(antd_1.Tooltip, { title: "\u9884\u89C8", children: (0, jsx_runtime_1.jsx)(antd_1.Button, { type: "text", icon: (0, jsx_runtime_1.jsx)(icons_1.EyeOutlined, {}), size: "small", style: {
101
127
  position: "absolute",
102
128
  top: "8px",
103
129
  right: "8px",
@@ -106,61 +132,86 @@ const FileItem = ({ file, onDownload }) => {
106
132
  border: "none",
107
133
  }, onClick: handlePreview }) })] }));
108
134
  case "video":
109
- return ((0, jsx_runtime_1.jsx)("div", { style: { maxWidth: "100%", maxHeight: "200px", borderRadius: "8px" }, children: "\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u89C6\u9891\u64AD\u653E" }));
110
- case "audio":
111
- return (0, jsx_runtime_1.jsx)("div", { style: { width: "100%" }, children: "\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u97F3\u9891\u64AD\u653E" });
135
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
136
+ maxWidth: "100%",
137
+ maxHeight: "200px",
138
+ borderRadius: "8px",
139
+ }, children: "\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u89C6\u9891\u64AD\u653E" }));
140
+ case "audio": {
141
+ const tagStyle = getAudioTagStyle(isDark);
142
+ return ((0, jsx_runtime_1.jsxs)("div", { style: getAudioCardStyle(isDark), children: [(0, jsx_runtime_1.jsx)("audio", { controls: true, preload: "auto", style: { width: "100%", borderRadius: "6px" }, children: (0, jsx_runtime_1.jsx)("source", { src: file.url, type: file.mimeType || undefined }) }), file.metadata && ((0, jsx_runtime_1.jsxs)("div", { style: {
143
+ marginTop: "8px",
144
+ display: "flex",
145
+ flexWrap: "wrap",
146
+ gap: "6px",
147
+ }, children: [file.metadata.model && (0, jsx_runtime_1.jsx)("span", { style: tagStyle, children: file.metadata.model }), file.metadata.voice && (0, jsx_runtime_1.jsxs)("span", { style: tagStyle, children: ["voice: ", file.metadata.voice] }), file.metadata.format && (0, jsx_runtime_1.jsx)("span", { style: tagStyle, children: file.metadata.format }), file.metadata.sizeBytes > 0 && ((0, jsx_runtime_1.jsx)("span", { style: tagStyle, children: formatFileSize(file.metadata.sizeBytes) })), file.metadata.mode && (0, jsx_runtime_1.jsxs)("span", { style: tagStyle, children: ["mode: ", file.metadata.mode] }), file.metadata.characters != null && ((0, jsx_runtime_1.jsxs)("span", { style: tagStyle, children: ["chars: ", file.metadata.characters] })), file.metadata.chunks != null && ((0, jsx_runtime_1.jsxs)("span", { style: tagStyle, children: ["chunks: ", file.metadata.chunks] }))] }))] }));
148
+ }
112
149
  case "pdf":
113
150
  case "document":
114
- return ((0, jsx_runtime_1.jsxs)(antd_1.Card, { size: "small", style: {
115
- width: "240px",
116
- height: "140px",
151
+ return ((0, jsx_runtime_1.jsx)(antd_1.Card, { size: "small", style: {
152
+ width: "315px",
153
+ minHeight: "88px",
117
154
  display: "flex",
118
- flexDirection: "column",
119
- justifyContent: "center",
155
+ flexDirection: "row",
120
156
  alignItems: "center",
121
157
  cursor: file.fileSource === "openai" && !file.url ? "default" : "pointer",
122
158
  border: "1px solid #d9d9d9",
123
159
  borderRadius: "8px",
124
160
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
125
161
  transition: "all 0.3s ease",
126
- }, hoverable: !(file.fileSource === "openai" && !file.url), onClick: file.fileSource === "openai" && !file.url ? undefined : handlePreview, children: [(0, jsx_runtime_1.jsx)("div", { style: {
127
- fontSize: "36px",
128
- color: file.type === "pdf" ? "#ff4d4f" : "#1890ff",
129
- marginBottom: "12px",
130
- }, children: fileTypeIcons[file.type] }), (0, jsx_runtime_1.jsx)(Text, { style: {
131
- fontSize: "13px",
132
- textAlign: "center",
133
- fontWeight: 500,
134
- marginBottom: "4px",
135
- maxWidth: "200px",
136
- }, ellipsis: { tooltip: file.name }, children: file.name }), (0, jsx_runtime_1.jsx)(Text, { type: "secondary", style: { fontSize: "11px" }, children: file.fileSource === "openai" && file.fileId
137
- ? `OpenAI 文件 • ID: ${file.fileId.slice(0, 8)}...`
138
- : file.size > 0
139
- ? formatFileSize(file.size)
140
- : fileTypeNames[file.type] })] }));
162
+ }, hoverable: !(file.fileSource === "openai" && !file.url), onClick: file.fileSource === "openai" && !file.url ? undefined : handlePreview, children: (0, jsx_runtime_1.jsxs)("div", { style: {
163
+ display: "flex",
164
+ alignItems: "center",
165
+ gap: 12,
166
+ width: "100%",
167
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
168
+ fontSize: "32px",
169
+ color: file.type === "pdf" ? "#ff4d4f" : "#1890ff",
170
+ flexShrink: 0,
171
+ }, children: fileTypeIcons[file.type] }), (0, jsx_runtime_1.jsxs)("div", { style: {
172
+ display: "flex",
173
+ flexDirection: "column",
174
+ alignItems: "flex-start",
175
+ gap: 4,
176
+ width: "100%",
177
+ minWidth: 0,
178
+ }, children: [(0, jsx_runtime_1.jsx)(Text, { style: {
179
+ fontSize: "13px",
180
+ fontWeight: 500,
181
+ maxWidth: "100%",
182
+ }, ellipsis: { tooltip: file.name }, children: file.name }), (0, jsx_runtime_1.jsx)(Text, { type: "secondary", style: { fontSize: "11px" }, children: file.fileSource === "openai" && file.fileId
183
+ ? `OpenAI 文件 • ID: ${file.fileId.slice(0, 8)}...`
184
+ : file.size > 0
185
+ ? formatFileSize(file.size)
186
+ : fileTypeNames[file.type] })] })] }) }));
141
187
  default:
142
188
  return null;
143
189
  }
144
190
  };
145
191
  const renderStatus = () => {
192
+ const statusGap = "4px"; /* 图片/文件与下方信息行间距 */
146
193
  switch (file.status) {
147
194
  case "uploading":
148
- return ((0, jsx_runtime_1.jsxs)("div", { style: { marginTop: "8px" }, children: [(0, jsx_runtime_1.jsx)(antd_1.Progress, { percent: 0, size: "small", status: "active" }), (0, jsx_runtime_1.jsx)(Text, { type: "secondary", style: { fontSize: "12px" }, children: "\u4E0A\u4F20\u4E2D..." })] }));
195
+ return ((0, jsx_runtime_1.jsxs)("div", { style: { marginTop: statusGap }, children: [(0, jsx_runtime_1.jsx)(antd_1.Progress, { percent: 0, size: "small", status: "active" }), (0, jsx_runtime_1.jsx)(Text, { type: "secondary", style: { fontSize: "12px" }, children: "\u4E0A\u4F20\u4E2D..." })] }));
149
196
  case "error":
150
- return ((0, jsx_runtime_1.jsxs)("div", { style: { marginTop: "8px", color: "#ff4d4f" }, children: [(0, jsx_runtime_1.jsx)(icons_1.ExclamationCircleOutlined, { style: { marginRight: "4px" } }), (0, jsx_runtime_1.jsx)(Text, { type: "danger", style: { fontSize: "12px" }, children: file.errorMessage || "上传失败" })] }));
197
+ return ((0, jsx_runtime_1.jsxs)("div", { style: { marginTop: statusGap, color: "#ff4d4f" }, children: [(0, jsx_runtime_1.jsx)(icons_1.ExclamationCircleOutlined, { style: { marginRight: "4px" } }), (0, jsx_runtime_1.jsx)(Text, { type: "danger", style: { fontSize: "12px" }, children: file.errorMessage || "上传失败" })] }));
151
198
  case "success":
152
- return ((0, jsx_runtime_1.jsx)("div", { style: { marginTop: "8px" }, children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { size: "small", children: [(0, jsx_runtime_1.jsxs)(Text, { type: "secondary", style: { fontSize: "12px" }, children: [file.fileSource === "openai" ? "OpenAI " : "", fileTypeNames[file.type], " \u2022 ", formatFileSize(file.size), file.fileSource === "openai" && file.fileId ? ` • ID: ${file.fileId.slice(0, 8)}...` : ""] }), (0, jsx_runtime_1.jsxs)(antd_1.Space, { size: "small", children: [!(file.fileSource === "openai" && !file.url) && ((0, jsx_runtime_1.jsx)(antd_1.Tooltip, { title: "\u9884\u89C8", children: (0, jsx_runtime_1.jsx)(antd_1.Button, { type: "text", icon: (0, jsx_runtime_1.jsx)(icons_1.EyeOutlined, {}), size: "small", onClick: handlePreview }) })), (0, jsx_runtime_1.jsx)(antd_1.Tooltip, { title: file.fileSource === "openai" && !file.url ? "OpenAI 文件无法直接下载" : "下载", children: (0, jsx_runtime_1.jsx)(antd_1.Button, { type: "text", icon: (0, jsx_runtime_1.jsx)(icons_1.DownloadOutlined, {}), size: "small", onClick: handleDownload, disabled: file.fileSource === "openai" && !file.url }) })] })] }) }));
199
+ return ((0, jsx_runtime_1.jsx)("div", { style: { marginTop: statusGap }, children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { size: "small", children: [(0, jsx_runtime_1.jsxs)(Text, { type: "secondary", style: { fontSize: "12px" }, children: [file.fileSource === "openai" ? "OpenAI " : "", fileTypeNames[file.type], file.size > 0 ? ` • ${formatFileSize(file.size)}` : "", file.fileSource === "openai" && file.fileId
200
+ ? ` • ID: ${file.fileId.slice(0, 8)}...`
201
+ : ""] }), (0, jsx_runtime_1.jsxs)(antd_1.Space, { size: "small", children: [!(file.fileSource === "openai" && !file.url) && ((0, jsx_runtime_1.jsx)(antd_1.Tooltip, { title: "\u9884\u89C8", children: (0, jsx_runtime_1.jsx)(antd_1.Button, { type: "text", icon: (0, jsx_runtime_1.jsx)(icons_1.EyeOutlined, {}), size: "small", onClick: handlePreview }) })), (0, jsx_runtime_1.jsx)(antd_1.Tooltip, { title: file.fileSource === "openai" && !file.url ? "OpenAI 文件无法直接下载" : "下载", children: (0, jsx_runtime_1.jsx)(antd_1.Button, { type: "text", icon: (0, jsx_runtime_1.jsx)(icons_1.DownloadOutlined, {}), size: "small", onClick: handleDownload, disabled: file.fileSource === "openai" && !file.url }) })] })] }) }));
153
202
  default:
154
203
  return null;
155
204
  }
156
205
  };
157
- return ((0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: "16px" }, children: [renderFileContent(), renderStatus(), file.url && ((0, jsx_runtime_1.jsx)(antd_1.Image, { style: { display: "none" }, src: file.url, alt: file.name, preview: {
158
- visible: imagePreviewVisible,
159
- onVisibleChange: setImagePreviewVisible,
160
- } })), (0, jsx_runtime_1.jsxs)(antd_1.Modal, { title: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [fileTypeIcons[file.type], (0, jsx_runtime_1.jsx)("span", { children: file.name })] }), open: previewVisible, onCancel: () => setPreviewVisible(false), footer: [
206
+ const hasAudioMetadata = file.type === "audio" && file.metadata;
207
+ return ((0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: hasAudioMetadata ? "4px" : "8px" }, children: [renderFileContent(), !hasAudioMetadata && renderStatus(), (0, jsx_runtime_1.jsxs)(antd_1.Modal, { title: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [fileTypeIcons[file.type], (0, jsx_runtime_1.jsx)("span", { children: file.name })] }), open: previewVisible, onCancel: () => setPreviewVisible(false), footer: [
161
208
  (0, jsx_runtime_1.jsx)(antd_1.Button, { type: "primary", icon: (0, jsx_runtime_1.jsx)(icons_1.DownloadOutlined, {}), onClick: handleDownload, children: "\u4E0B\u8F7D\u6587\u4EF6" }, "download"),
162
209
  (0, jsx_runtime_1.jsx)(antd_1.Button, { onClick: () => setPreviewVisible(false), children: "\u5173\u95ED" }, "close"),
163
- ], width: "90%", style: { top: 20 }, destroyOnClose: true, children: [file.type === "pdf" && file.url && ((0, jsx_runtime_1.jsx)("div", { style: { height: "75vh", border: "1px solid #d9d9d9", borderRadius: "4px" }, children: (0, jsx_runtime_1.jsx)("iframe", { src: `${file.url}#toolbar=1&navpanes=1&scrollbar=1`, style: {
210
+ ], width: "90%", style: { top: 20 }, destroyOnClose: true, children: [file.type === "pdf" && file.url && ((0, jsx_runtime_1.jsx)("div", { style: {
211
+ height: "75vh",
212
+ border: "1px solid #d9d9d9",
213
+ borderRadius: "4px",
214
+ }, children: (0, jsx_runtime_1.jsx)("iframe", { src: `${file.url}#toolbar=1&navpanes=1&scrollbar=1`, style: {
164
215
  width: "100%",
165
216
  height: "100%",
166
217
  border: "none",
@@ -173,7 +224,11 @@ const FileItem = ({ file, onDownload }) => {
173
224
  background: "#fafafa",
174
225
  borderRadius: "8px",
175
226
  border: "1px dashed #d9d9d9",
176
- }, children: [(0, jsx_runtime_1.jsx)(icons_1.FileTextOutlined, { style: { fontSize: "72px", color: "#10a37f", marginBottom: "16px" } }), (0, jsx_runtime_1.jsx)("div", { style: { marginBottom: "8px" }, children: (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: "16px", fontWeight: 500 }, children: "OpenAI \u6587\u4EF6" }) }), (0, jsx_runtime_1.jsx)("div", { style: { marginBottom: "8px" }, children: (0, jsx_runtime_1.jsxs)(Text, { type: "secondary", style: { fontSize: "14px" }, children: ["\u6587\u4EF6 ID: ", file.fileId || file.id] }) }), (0, jsx_runtime_1.jsx)("div", { style: { marginBottom: "24px" }, children: (0, jsx_runtime_1.jsx)(Text, { type: "secondary", children: "OpenAI \u6587\u4EF6\u65E0\u6CD5\u5728\u7EBF\u9884\u89C8\uFF0C\u6587\u4EF6\u5DF2\u4E0A\u4F20\u5230\u670D\u52A1\u5668" }) })] })), file.type === "document" && ((0, jsx_runtime_1.jsxs)("div", { style: {
227
+ }, children: [(0, jsx_runtime_1.jsx)(icons_1.FileTextOutlined, { style: {
228
+ fontSize: "72px",
229
+ color: "#10a37f",
230
+ marginBottom: "16px",
231
+ } }), (0, jsx_runtime_1.jsx)("div", { style: { marginBottom: "8px" }, children: (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: "16px", fontWeight: 500 }, children: "OpenAI \u6587\u4EF6" }) }), (0, jsx_runtime_1.jsx)("div", { style: { marginBottom: "8px" }, children: (0, jsx_runtime_1.jsxs)(Text, { type: "secondary", style: { fontSize: "14px" }, children: ["\u6587\u4EF6 ID: ", file.fileId || file.id] }) }), (0, jsx_runtime_1.jsx)("div", { style: { marginBottom: "24px" }, children: (0, jsx_runtime_1.jsx)(Text, { type: "secondary", children: "OpenAI \u6587\u4EF6\u65E0\u6CD5\u5728\u7EBF\u9884\u89C8\uFF0C\u6587\u4EF6\u5DF2\u4E0A\u4F20\u5230\u670D\u52A1\u5668" }) })] })), file.type === "document" && ((0, jsx_runtime_1.jsxs)("div", { style: {
177
232
  textAlign: "center",
178
233
  padding: "60px 20px",
179
234
  background: "#fafafa",
@@ -185,10 +240,11 @@ const FileItem = ({ file, onDownload }) => {
185
240
  marginBottom: "16px",
186
241
  } }), (0, jsx_runtime_1.jsx)("div", { style: { marginBottom: "8px" }, children: (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: "16px", fontWeight: 500 }, children: file.fileSource === "openai" ? "OpenAI 文件" : "文档预览" }) }), file.fileSource === "openai" && file.fileId && ((0, jsx_runtime_1.jsx)("div", { style: { marginBottom: "8px" }, children: (0, jsx_runtime_1.jsxs)(Text, { type: "secondary", style: { fontSize: "14px" }, children: ["\u6587\u4EF6 ID: ", file.fileId] }) })), (0, jsx_runtime_1.jsx)("div", { style: { marginBottom: "24px" }, children: (0, jsx_runtime_1.jsx)(Text, { type: "secondary", children: file.fileSource === "openai"
187
242
  ? "OpenAI 文件无法在线预览,文件已上传到服务器"
188
- : "暂不支持此类型文档的在线预览,请下载后查看" }) }), (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [!(file.fileSource === "openai" && !file.url) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, { type: "primary", icon: (0, jsx_runtime_1.jsx)(icons_1.DownloadOutlined, {}), onClick: handleDownload, children: "\u4E0B\u8F7D\u6587\u6863" }), file.url && ((0, jsx_runtime_1.jsx)(antd_1.Button, { icon: (0, jsx_runtime_1.jsx)(icons_1.EyeOutlined, {}), onClick: () => window.open(file.url, "_blank"), children: "\u65B0\u7A97\u53E3\u6253\u5F00" }))] })), file.fileSource === "openai" && !file.url && (0, jsx_runtime_1.jsx)(antd_1.Button, { disabled: true, children: "OpenAI \u6587\u4EF6\u65E0\u6CD5\u76F4\u63A5\u4E0B\u8F7D" })] })] }))] })] }));
243
+ : "暂不支持此类型文档的在线预览,请下载后查看" }) }), (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [!(file.fileSource === "openai" && !file.url) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, { type: "primary", icon: (0, jsx_runtime_1.jsx)(icons_1.DownloadOutlined, {}), onClick: handleDownload, children: "\u4E0B\u8F7D\u6587\u6863" }), file.url && ((0, jsx_runtime_1.jsx)(antd_1.Button, { icon: (0, jsx_runtime_1.jsx)(icons_1.EyeOutlined, {}), onClick: () => window.open(file.url, "_blank"), children: "\u65B0\u7A97\u53E3\u6253\u5F00" }))] })), file.fileSource === "openai" && !file.url && ((0, jsx_runtime_1.jsx)(antd_1.Button, { disabled: true, children: "OpenAI \u6587\u4EF6\u65E0\u6CD5\u76F4\u63A5\u4E0B\u8F7D" }))] })] }))] })] }));
189
244
  };
190
245
  // 主组件
191
246
  const MultimodalFileRenderer = ({ files, primaryMedia, maxPreviewCount = 4, showDownload = true, }) => {
247
+ const { isDark } = (0, ThemeContext_1.useThemeHook)();
192
248
  const [showAll, setShowAll] = (0, react_1.useState)(false);
193
249
  // 将 primaryMedia 统一转为文件项,放在首位(若存在)
194
250
  const primaryAsFile = primaryMedia
@@ -197,11 +253,12 @@ const MultimodalFileRenderer = ({ files, primaryMedia, maxPreviewCount = 4, show
197
253
  name: primaryMedia.name || "模型输出",
198
254
  url: primaryMedia.url,
199
255
  type: primaryMedia.type,
200
- size: 0,
201
- mimeType: "",
256
+ size: primaryMedia.metadata?.sizeBytes || 0,
257
+ mimeType: primaryMedia.type === "audio" ? `audio/${primaryMedia.metadata?.format || "mp3"}` : "",
202
258
  uploadTime: Date.now(),
203
259
  status: "success",
204
260
  thumbnail: primaryMedia.thumbnail,
261
+ metadata: primaryMedia.metadata,
205
262
  }
206
263
  : null;
207
264
  const mergedFiles = primaryAsFile ? [primaryAsFile, ...(files || [])] : files || [];
@@ -210,7 +267,7 @@ const MultimodalFileRenderer = ({ files, primaryMedia, maxPreviewCount = 4, show
210
267
  }
211
268
  const displayFiles = showAll ? mergedFiles : mergedFiles.slice(0, maxPreviewCount);
212
269
  const hasMore = mergedFiles.length > maxPreviewCount;
213
- return ((0, jsx_runtime_1.jsxs)("div", { style: { marginTop: "12px" }, children: [(0, jsx_runtime_1.jsx)("div", { className: "multimodal-file-grid", children: displayFiles.map((file) => ((0, jsx_runtime_1.jsx)(FileItem, { file: file, onDownload: showDownload ? undefined : undefined }, file.id))) }), hasMore && !showAll && ((0, jsx_runtime_1.jsxs)(antd_1.Button, { type: "link", size: "small", onClick: () => setShowAll(true), style: { padding: 0 }, children: ["\u663E\u793A\u5168\u90E8 ", mergedFiles.length, " \u4E2A\u6587\u4EF6"] })), hasMore && showAll && ((0, jsx_runtime_1.jsx)(antd_1.Button, { type: "link", size: "small", onClick: () => setShowAll(false), style: { padding: 0 }, children: "\u6536\u8D77" }))] }));
270
+ const isAudioOnly = mergedFiles.length === 1 && mergedFiles[0].type === "audio";
271
+ return ((0, jsx_runtime_1.jsxs)("div", { style: { marginTop: "4px" }, children: [(0, jsx_runtime_1.jsx)("div", { className: "multimodal-file-grid", children: displayFiles.map((file) => ((0, jsx_runtime_1.jsx)(FileItem, { file: file, isDark: isDark, onDownload: showDownload ? undefined : undefined }, file.id))) }), hasMore && !showAll && ((0, jsx_runtime_1.jsxs)(antd_1.Button, { type: "link", size: "small", onClick: () => setShowAll(true), style: { padding: 0 }, children: ["\u663E\u793A\u5168\u90E8 ", mergedFiles.length, " \u4E2A\u6587\u4EF6"] })), hasMore && showAll && ((0, jsx_runtime_1.jsx)(antd_1.Button, { type: "link", size: "small", onClick: () => setShowAll(false), style: { padding: 0 }, children: "\u6536\u8D77" }))] }));
214
272
  };
215
273
  exports.MultimodalFileRenderer = MultimodalFileRenderer;
216
- //# sourceMappingURL=MultimodalFileRenderer.js.map
@@ -1,8 +1,7 @@
1
- import React from "react";
2
- import { ChatMessage } from "../types";
1
+ import type React from "react";
2
+ import type { ChatMessage } from "../types";
3
3
  interface ThinkingBlockProps {
4
4
  message: ChatMessage;
5
5
  }
6
6
  export declare const ThinkingBlock: React.FC<ThinkingBlockProps>;
7
7
  export {};
8
- //# sourceMappingURL=ThinkingBlock.d.ts.map
@@ -72,4 +72,3 @@ const ThinkingBlock = ({ message }) => {
72
72
  return ((0, jsx_runtime_1.jsx)("div", { className: styles.thinkingContainer, children: (0, jsx_runtime_1.jsx)(antd_1.Collapse, { items: collapseItems, size: "small", defaultActiveKey: ["1"], ghost: true, expandIconPosition: "end", className: styles.transparentCollapse }) }));
73
73
  };
74
74
  exports.ThinkingBlock = ThinkingBlock;
75
- //# sourceMappingURL=ThinkingBlock.js.map
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import type React from "react";
2
2
  interface ToolUseBlockProps {
3
3
  tool_name: string;
4
4
  tool_args?: Record<string, any>;
@@ -7,4 +7,3 @@ interface ToolUseBlockProps {
7
7
  }
8
8
  export declare const ToolUseBlock: React.FC<ToolUseBlockProps>;
9
9
  export {};
10
- //# sourceMappingURL=ToolUseBlock.d.ts.map
@@ -4,11 +4,10 @@ exports.ToolUseBlock = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const _1 = require(".");
7
- const ToolUseBlock = ({ tool_name, tool_args, result, isResponse }) => {
7
+ const ToolUseBlock = ({ tool_name, tool_args, result, isResponse, }) => {
8
8
  const [isExpanded, setIsExpanded] = (0, react_1.useState)(true);
9
9
  const headerText = isResponse ? `工具调用结果: ${tool_name}` : `工具调用: ${tool_name}`;
10
10
  const content = isResponse ? result : tool_args;
11
11
  return ((0, jsx_runtime_1.jsxs)("div", { className: "tool-use-block", children: [(0, jsx_runtime_1.jsx)(_1.ToolUseBlockHeader, { toolName: headerText, isExpanded: isExpanded, onToggleExpand: () => setIsExpanded(!isExpanded) }), isExpanded && ((0, jsx_runtime_1.jsx)("div", { className: "tool-use-body", children: (0, jsx_runtime_1.jsx)("pre", { children: (0, jsx_runtime_1.jsx)("code", { children: JSON.stringify(content, null, 2) }) }) }))] }));
12
12
  };
13
13
  exports.ToolUseBlock = ToolUseBlock;
14
- //# sourceMappingURL=ToolUseBlock.js.map
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import type React from "react";
2
2
  interface ToolUseBlockHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
3
3
  toolName: string;
4
4
  isExpanded: boolean;
@@ -7,4 +7,3 @@ interface ToolUseBlockHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
7
7
  }
8
8
  export declare const ToolUseBlockHeader: React.FC<ToolUseBlockHeaderProps>;
9
9
  export {};
10
- //# sourceMappingURL=ToolUseBlockHeader.d.ts.map
@@ -25,7 +25,6 @@ const useStyles = (0, antd_style_1.createStyles)(({ token, css }) => ({
25
25
  }));
26
26
  const ToolUseBlockHeader = ({ toolName, isExpanded, onToggleExpand, icon, className, ...props }) => {
27
27
  const { styles, cx } = useStyles();
28
- return ((0, jsx_runtime_1.jsxs)("div", { className: cx(styles.header, className), onClick: onToggleExpand, ...props, children: [isExpanded ? (0, jsx_runtime_1.jsx)(icons_1.CaretDownOutlined, { className: styles.icon }) : (0, jsx_runtime_1.jsx)(icons_1.CaretRightOutlined, { className: styles.icon }), icon && (0, jsx_runtime_1.jsx)("span", { className: styles.icon, children: icon }), toolName] }));
28
+ return ((0, jsx_runtime_1.jsxs)("div", { className: cx(styles.header, className), onClick: onToggleExpand, ...props, children: [isExpanded ? ((0, jsx_runtime_1.jsx)(icons_1.CaretDownOutlined, { className: styles.icon })) : ((0, jsx_runtime_1.jsx)(icons_1.CaretRightOutlined, { className: styles.icon })), icon && (0, jsx_runtime_1.jsx)("span", { className: styles.icon, children: icon }), toolName] }));
29
29
  };
30
30
  exports.ToolUseBlockHeader = ToolUseBlockHeader;
31
- //# sourceMappingURL=ToolUseBlockHeader.js.map
@@ -1,6 +1,5 @@
1
- import React from "react";
1
+ import type React from "react";
2
2
  import type { MultimodalFile } from "../types";
3
3
  export declare const UploadPreview: React.FC<{
4
4
  files: MultimodalFile[];
5
5
  }>;
6
- //# sourceMappingURL=UploadPreview.d.ts.map
@@ -9,4 +9,3 @@ const UploadPreview = ({ files }) => {
9
9
  return (0, jsx_runtime_1.jsx)(MultimodalFileRenderer_1.MultimodalFileRenderer, { files: files });
10
10
  };
11
11
  exports.UploadPreview = UploadPreview;
12
- //# sourceMappingURL=UploadPreview.js.map
@@ -7,4 +7,3 @@ interface WelcomeModuleProps {
7
7
  }
8
8
  export declare const WelcomeModule: React.FC<WelcomeModuleProps>;
9
9
  export {};
10
- //# sourceMappingURL=WelcomeModule.d.ts.map
@@ -38,6 +38,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
38
38
  const icons_1 = require("@ant-design/icons");
39
39
  const antd_1 = require("antd");
40
40
  const react_1 = __importStar(require("react"));
41
+ const env_helper_1 = require("../utils/env-helper");
41
42
  require("./WelcomeModule.less");
42
43
  const { Title, Text, Paragraph } = antd_1.Typography;
43
44
  const MODULES = [
@@ -60,7 +61,12 @@ const MODULES = [
60
61
  description: "图片生成与智能识别分析",
61
62
  icon: (0, jsx_runtime_1.jsx)(icons_1.PictureOutlined, { style: { fontSize: 20, color: "#52c41a" } }),
62
63
  color: "#52c41a",
63
- prompts: ["给我一个五彩斑斓的黑", "生成一张夕阳下的海滩图片", "画一只可爱的小猫咪", "创作一幅抽象艺术作品"],
64
+ prompts: [
65
+ "给我一个五彩斑斓的黑",
66
+ "生成一张夕阳下的海滩图片",
67
+ "画一只可爱的小猫咪",
68
+ "创作一幅抽象艺术作品",
69
+ ],
64
70
  },
65
71
  {
66
72
  id: "video",
@@ -68,7 +74,12 @@ const MODULES = [
68
74
  description: "AI视频生成与编辑",
69
75
  icon: (0, jsx_runtime_1.jsx)(icons_1.VideoCameraOutlined, { style: { fontSize: 20, color: "#fa541c" } }),
70
76
  color: "#fa541c",
71
- prompts: ["生成一段海浪拍打沙滩的视频", "制作一个产品展示动画", "创建一段城市夜景延时摄影", "生成一个logo动效视频"],
77
+ prompts: [
78
+ "生成一段海浪拍打沙滩的视频",
79
+ "制作一个产品展示动画",
80
+ "创建一段城市夜景延时摄影",
81
+ "生成一个logo动效视频",
82
+ ],
72
83
  disabled: true,
73
84
  disabledReason: "逐步开放中",
74
85
  },
@@ -78,14 +89,24 @@ const MODULES = [
78
89
  description: "协同工作的智能体系统",
79
90
  icon: (0, jsx_runtime_1.jsx)(icons_1.ClusterOutlined, { style: { fontSize: 20, color: "#722ed1" } }),
80
91
  color: "#722ed1",
81
- prompts: ["协调多个AI完成项目规划", "让团队AI协作写代码", "多智能体讨论解决方案", "AI团队头脑风暴创意"],
92
+ prompts: [
93
+ "协调多个AI完成项目规划",
94
+ "让团队AI协作写代码",
95
+ "多智能体讨论解决方案",
96
+ "AI团队头脑风暴创意",
97
+ ],
82
98
  disabled: true,
83
99
  disabledReason: "逐步开放中",
84
100
  },
85
101
  ];
86
- const WelcomeModule = ({ onPromptSelect, onModuleChange, isDark = false }) => {
102
+ const WelcomeModule = ({ onPromptSelect, onModuleChange, isDark = false, }) => {
87
103
  const [selectedModule, setSelectedModule] = (0, react_1.useState)(null);
88
104
  const [isVisible, setIsVisible] = (0, react_1.useState)(false);
105
+ const embedded = (0, env_helper_1.isEmbeddedInIde)();
106
+ const iconSize = embedded ? 16 : 24;
107
+ const arrowSize = embedded ? 10 : 14;
108
+ const gutterSize = embedded ? [12, 12] : [24, 24];
109
+ const promptGutter = embedded ? [10, 10] : [20, 20];
89
110
  (0, react_1.useEffect)(() => {
90
111
  // 组件挂载后的入场动画
91
112
  const timer = setTimeout(() => setIsVisible(true), 100);
@@ -105,15 +126,20 @@ const WelcomeModule = ({ onPromptSelect, onModuleChange, isDark = false }) => {
105
126
  const selectedModuleData = MODULES.find((m) => m.id === selectedModule);
106
127
  return ((0, jsx_runtime_1.jsx)("div", { className: `welcome-module-container ${isVisible ? "visible" : ""}`, children: !selectedModule ? (
107
128
  // 模块选择视图
108
- (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: `welcome-header ${isVisible ? "visible" : ""}`, children: [(0, jsx_runtime_1.jsx)(Title, { level: 1, className: `welcome-title ${isDark ? "dark" : "light"}`, children: "\u5C0F\u7A0B\u5E8F\u5F00\u653E\u5E73\u53F0\u667A\u80FD\u4F53\u8C03\u8BD5\u5668" }), (0, jsx_runtime_1.jsx)(Paragraph, { className: `welcome-description ${isDark ? "dark" : "light"}`, children: "\u63A2\u7D22\u5E73\u53F0\u591A\u5143\u5316AI\u80FD\u529B\uFF0C\u9009\u62E9\u4E00\u4E2A\u6A21\u5757\u5FEB\u901F\u8FDB\u884C\u8C03\u8BD5" })] }), (0, jsx_runtime_1.jsx)(antd_1.Row, { gutter: [24, 24], children: MODULES.map((module, index) => ((0, jsx_runtime_1.jsx)(antd_1.Col, { xs: 24, sm: 12, children: (0, jsx_runtime_1.jsx)("div", { className: `module-card-wrapper ${isVisible ? "visible" : ""}`, children: (0, jsx_runtime_1.jsxs)(antd_1.Card, { hoverable: !module.disabled, className: `welcome-module-card ${isDark ? "dark" : "light"} ${module.disabled ? "disabled" : ""}`, onClick: () => !module.disabled && handleModuleClick(module.id), styles: {
129
+ (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: `welcome-header ${isVisible ? "visible" : ""}`, children: [(0, jsx_runtime_1.jsx)(Title, { level: 1, className: `welcome-title ${isDark ? "dark" : "light"}`, children: "\u5C0F\u7A0B\u5E8F\u5F00\u653E\u5E73\u53F0\u667A\u80FD\u4F53\u8C03\u8BD5\u5668" }), (0, jsx_runtime_1.jsx)(Paragraph, { className: `welcome-description ${isDark ? "dark" : "light"}`, children: "\u63A2\u7D22\u5E73\u53F0\u591A\u5143\u5316AI\u80FD\u529B\uFF0C\u9009\u62E9\u4E00\u4E2A\u6A21\u5757\u5FEB\u901F\u8FDB\u884C\u8C03\u8BD5" })] }), (0, jsx_runtime_1.jsx)(antd_1.Row, { gutter: gutterSize, children: MODULES.map((module) => ((0, jsx_runtime_1.jsx)(antd_1.Col, { xs: 24, sm: 12, children: (0, jsx_runtime_1.jsx)("div", { className: `module-card-wrapper ${isVisible ? "visible" : ""}`, children: (0, jsx_runtime_1.jsxs)(antd_1.Card, { hoverable: !module.disabled, className: `welcome-module-card ${isDark ? "dark" : "light"} ${module.disabled ? "disabled" : ""}`, onClick: () => !module.disabled && handleModuleClick(module.id), styles: {
109
130
  body: { padding: 0 },
110
131
  }, children: [(0, jsx_runtime_1.jsx)("div", { className: "decorative-bg", style: {
111
132
  background: `${module.color}10`,
112
- } }), (0, jsx_runtime_1.jsxs)("div", { className: `card-header ${isDark ? "dark" : "light"}`, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 20, marginBottom: 16 }, children: [(0, jsx_runtime_1.jsx)("div", { className: `module-icon-container ${isDark ? "dark" : "light"}`, style: {
133
+ } }), (0, jsx_runtime_1.jsxs)("div", { className: `card-header ${isDark ? "dark" : "light"}`, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
134
+ display: "flex",
135
+ alignItems: "center",
136
+ gap: embedded ? 12 : 20,
137
+ marginBottom: embedded ? 8 : 16,
138
+ }, children: [(0, jsx_runtime_1.jsx)("div", { className: `module-icon-container ${isDark ? "dark" : "light"}`, style: {
113
139
  borderColor: `${module.color}30`,
114
140
  }, children: react_1.default.cloneElement(module.icon, {
115
141
  style: {
116
- fontSize: 24,
142
+ fontSize: iconSize,
117
143
  color: module.color,
118
144
  filter: "drop-shadow(0 2px 4px rgba(0,0,0,0.1))",
119
145
  },
@@ -122,40 +148,44 @@ const WelcomeModule = ({ onPromptSelect, onModuleChange, isDark = false }) => {
122
148
  alignItems: "center",
123
149
  justifyContent: "space-between",
124
150
  width: "100%",
125
- }, children: [(0, jsx_runtime_1.jsx)(Text, { className: `footer-text ${isDark ? "dark" : "light"}`, style: { color: module.disabled ? "#999" : undefined }, children: module.disabledReason }), (0, jsx_runtime_1.jsx)("div", { className: "arrow-container disabled", style: {
151
+ }, children: [(0, jsx_runtime_1.jsx)(Text, { className: `footer-text ${isDark ? "dark" : "light"}`, style: {
152
+ color: module.disabled ? "#999" : undefined,
153
+ }, children: module.disabledReason }), (0, jsx_runtime_1.jsx)("div", { className: "arrow-container disabled", style: {
126
154
  background: "#f5f5f5",
127
155
  opacity: 0.5,
128
156
  }, children: (0, jsx_runtime_1.jsx)(icons_1.RightOutlined, { style: {
129
157
  color: "#ccc",
130
- fontSize: 14,
158
+ fontSize: arrowSize,
131
159
  fontWeight: "bold",
132
160
  } }) })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Text, { className: `footer-text ${isDark ? "dark" : "light"}`, children: "\u70B9\u51FB\u8FDB\u5165" }), (0, jsx_runtime_1.jsx)("div", { className: "arrow-container", style: {
133
161
  background: `${module.color}15`,
134
162
  }, children: (0, jsx_runtime_1.jsx)(icons_1.RightOutlined, { style: {
135
163
  color: module.color,
136
- fontSize: 14,
164
+ fontSize: arrowSize,
137
165
  fontWeight: "bold",
138
166
  } }) })] })) })] }) }) }, module.id))) })] })) : (
139
167
  // 提示词选择视图
140
- (0, jsx_runtime_1.jsxs)("div", { className: `prompt-selection-view ${isVisible ? "visible" : ""}`, children: [(0, jsx_runtime_1.jsx)("div", { style: { marginBottom: 32 }, children: (0, jsx_runtime_1.jsx)(antd_1.Button, { type: "text", onClick: handleBackToModules, className: `back-button ${isDark ? "dark" : "light"}`, children: "\u2190 \u8FD4\u56DE\u6A21\u5757\u9009\u62E9" }) }), (0, jsx_runtime_1.jsxs)("div", { style: { textAlign: "center", marginBottom: 48 }, children: [(0, jsx_runtime_1.jsxs)("div", { className: `module-header ${isDark ? "dark" : "light"}`, children: [(0, jsx_runtime_1.jsx)("div", { className: `header-icon ${isDark ? "dark" : "light"}`, style: {
168
+ (0, jsx_runtime_1.jsxs)("div", { className: `prompt-selection-view ${isVisible ? "visible" : ""}`, children: [(0, jsx_runtime_1.jsx)("div", { style: { marginBottom: 32 }, children: (0, jsx_runtime_1.jsx)(antd_1.Button, { type: "text", onClick: handleBackToModules, className: `back-button ${isDark ? "dark" : "light"}`, children: "\u2190 \u8FD4\u56DE\u6A21\u5757\u9009\u62E9" }) }), (0, jsx_runtime_1.jsxs)("div", { style: {
169
+ textAlign: "center",
170
+ marginBottom: embedded ? 20 : 48,
171
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { className: `module-header ${isDark ? "dark" : "light"}`, children: [(0, jsx_runtime_1.jsx)("div", { className: `header-icon ${isDark ? "dark" : "light"}`, style: {
141
172
  borderColor: `${selectedModuleData?.color}30`,
142
173
  }, children: react_1.default.cloneElement(selectedModuleData?.icon, {
143
174
  style: {
144
- fontSize: 24,
175
+ fontSize: iconSize,
145
176
  color: selectedModuleData?.color,
146
177
  filter: "drop-shadow(0 2px 4px rgba(0,0,0,0.1))",
147
178
  },
148
- }) }), (0, jsx_runtime_1.jsx)(Title, { level: 2, className: `header-title ${isDark ? "dark" : "light"}`, children: selectedModuleData?.title })] }), (0, jsx_runtime_1.jsx)(Paragraph, { className: `prompt-description ${isDark ? "dark" : "light"}`, children: "\u9009\u62E9\u4E00\u4E2A\u63D0\u793A\u8BCD\u5F00\u59CB\u5BF9\u8BDD\uFF0C\u6216\u8005\u8F93\u5165\u4F60\u81EA\u5DF1\u7684\u95EE\u9898" })] }), (0, jsx_runtime_1.jsx)(antd_1.Row, { gutter: [20, 20], children: selectedModuleData?.prompts.map((prompt, index) => ((0, jsx_runtime_1.jsx)(antd_1.Col, { xs: 24, sm: 12, children: (0, jsx_runtime_1.jsx)("div", { className: `prompt-card-wrapper ${isVisible ? "visible" : ""}`, children: (0, jsx_runtime_1.jsxs)(antd_1.Card, { hoverable: true, className: `welcome-prompt-card ${isDark ? "dark" : "light"}`, styles: {
149
- body: { padding: "24px" },
179
+ }) }), (0, jsx_runtime_1.jsx)(Title, { level: 2, className: `header-title ${isDark ? "dark" : "light"}`, children: selectedModuleData?.title })] }), (0, jsx_runtime_1.jsx)(Paragraph, { className: `prompt-description ${isDark ? "dark" : "light"}`, children: "\u9009\u62E9\u4E00\u4E2A\u63D0\u793A\u8BCD\u5F00\u59CB\u5BF9\u8BDD\uFF0C\u6216\u8005\u8F93\u5165\u4F60\u81EA\u5DF1\u7684\u95EE\u9898" })] }), (0, jsx_runtime_1.jsx)(antd_1.Row, { gutter: promptGutter, children: selectedModuleData?.prompts.map((prompt, index) => ((0, jsx_runtime_1.jsx)(antd_1.Col, { xs: 24, sm: 12, children: (0, jsx_runtime_1.jsx)("div", { className: `prompt-card-wrapper ${isVisible ? "visible" : ""}`, children: (0, jsx_runtime_1.jsxs)(antd_1.Card, { hoverable: true, className: `welcome-prompt-card ${isDark ? "dark" : "light"}`, styles: {
180
+ body: { padding: embedded ? "12px" : "24px" },
150
181
  }, onClick: () => handlePromptClick(prompt), children: [(0, jsx_runtime_1.jsx)("div", { className: "prompt-border", style: {
151
182
  background: `linear-gradient(90deg, ${selectedModuleData?.color}, ${selectedModuleData?.color}80)`,
152
183
  } }), (0, jsx_runtime_1.jsxs)("div", { className: "prompt-content", children: [(0, jsx_runtime_1.jsx)(Text, { className: `prompt-text ${isDark ? "dark" : "light"}`, children: prompt }), (0, jsx_runtime_1.jsx)("div", { className: "prompt-arrow", style: {
153
184
  background: `${selectedModuleData?.color}15`,
154
185
  }, children: (0, jsx_runtime_1.jsx)(icons_1.RightOutlined, { style: {
155
186
  color: selectedModuleData?.color,
156
- fontSize: 12,
187
+ fontSize: embedded ? 9 : 12,
157
188
  fontWeight: "bold",
158
189
  } }) })] })] }) }) }, index))) })] })) }));
159
190
  };
160
191
  exports.WelcomeModule = WelcomeModule;
161
- //# sourceMappingURL=WelcomeModule.js.map
@@ -11,4 +11,3 @@ export * from "./UploadPreview";
11
11
  export * from "./AsyncTaskBlock";
12
12
  export * from "./WelcomeModule";
13
13
  export * from "./ErrorCard";
14
- //# sourceMappingURL=index.d.ts.map
@@ -27,4 +27,3 @@ __exportStar(require("./UploadPreview"), exports);
27
27
  __exportStar(require("./AsyncTaskBlock"), exports);
28
28
  __exportStar(require("./WelcomeModule"), exports);
29
29
  __exportStar(require("./ErrorCard"), exports);
30
- //# sourceMappingURL=index.js.map
@@ -38,4 +38,3 @@ export declare const uploadConfig: {
38
38
  "application/vnd.openxmlformats-officedocument.presentationml.presentation": "document";
39
39
  };
40
40
  };
41
- //# sourceMappingURL=cos-config.d.ts.map