@zero-library/chat-copilot 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CloudUploadOutlined, PaperClipOutlined, LoadingOutlined, createFromIconfontCN, EnterOutlined, DownloadOutlined, CloseOutlined, PlusOutlined, CommentOutlined, FileTextOutlined, CopyOutlined, LikeOutlined, DislikeOutlined, ToolOutlined, PlayCircleOutlined, DotChartOutlined, RedoOutlined, DeleteOutlined, ClockCircleOutlined, CheckCircleOutlined } from '@ant-design/icons';
2
2
  import { Attachments, Sender, Think, FileCard, Bubble, XProvider, Mermaid, CodeHighlighter, Conversations, Welcome, Prompts } from '@ant-design/x-v2';
3
- import { useRefState, useDebounce, useSyncInput, createTokenManager, isEmptyObj, markdownToText, RenderWrapper, shouldRender, isFunction, downloadFile, LuyaFilePreview, MarkdownEditor, useDeepEffect, isObject, useWebSocket, isNullOrUnDef, isNumber, getFileSuffixName, isBoolean, UserAvatar, htmlToMarkdown, copyText, FileIcon, LazyComponent, deepCopy, transforms, deepMerge, buildUrlParams, createRequest, HttpStatus, isArray, isString, isExternal, formatSize, isDef, isNull, transform, emit, getWebSocketUrl, safeParseJson } from '@zero-library/common';
4
- import { App, Badge, Button, Flex, Typography, Tooltip, Tag, Spin, Splitter, theme, Collapse, Avatar, Space, Popover, Form, Skeleton, Alert, Empty, Input, InputNumber, Switch as Switch$1, message, List, Drawer, Upload, Card, Table, Progress as Progress$1, Divider as Divider$1, Select as Select$1 } from 'antd';
3
+ import { useRefState, useDebounce, useSyncInput, createTokenManager, isEmptyObj, markdownToText, RenderWrapper, shouldRender, isFunction, downloadFile, LuyaFilePreview, MarkdownEditor, useDeepEffect, isObject, useWebSocket, isNullOrUnDef, isNumber, getFileSuffixName, isBoolean, UserAvatar, htmlToMarkdown, copyText, FileIcon, LazyComponent, deepCopy, transforms, deepMerge, buildUrlParams, createRequest, HttpStatus, isArray, isString, isExternal, transform, emit, getWebSocketUrl, safeParseJson } from '@zero-library/common';
4
+ import { App, Badge, Button, Flex, Typography, Tooltip, Tag, Spin, Splitter, theme, Collapse, Avatar, Space, Popover, Skeleton, Alert, Empty, message, List, Drawer, Card, Table, Progress as Progress$1, Divider as Divider$1, Switch as Switch$1, Select as Select$1, Input } from 'antd';
5
5
  import React6, { createContext, forwardRef, useRef, useEffect, useImperativeHandle, useMemo, memo, useState, useContext, useCallback } from 'react';
6
6
  import { useSnapshot, proxy } from 'valtio';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -36,7 +36,7 @@ var styles_module_default = {
36
36
  quoteTooltipContainer: "styles_module_quoteTooltipContainer"
37
37
  };
38
38
  var Attachments_default = forwardRef(({ fileUpload, fileUploadConfig, fileList = [], onChange, extraParams }, ref) => {
39
- const { message: message3 } = App.useApp();
39
+ const { message: message2 } = App.useApp();
40
40
  const chatStore = useChatStore();
41
41
  const agentState = useSnapshot(chatStore.agent);
42
42
  const fileListRef = useRef([]);
@@ -64,7 +64,7 @@ var Attachments_default = forwardRef(({ fileUpload, fileUploadConfig, fileList =
64
64
  onChange(files);
65
65
  }, [attachedFiles]);
66
66
  const onErrorTip = useDebounce((errorMsg) => {
67
- message3.error(errorMsg);
67
+ message2.error(errorMsg);
68
68
  }, 300);
69
69
  const findConfig = (file) => {
70
70
  return fileUploadConfig?.allowedTypes?.find((type) => type === getFileSuffixName(file.name)) || "";
@@ -329,41 +329,6 @@ var classifyTime = (timestamp) => {
329
329
  return "\u66F4\u65E9";
330
330
  }
331
331
  };
332
- var variablesToObject = (variables) => {
333
- if (!isArray(variables)) return {};
334
- const jsonTypes = ["OBJECT", "ARRAY", "ARRAY_STRING", "ARRAY_NUMBER", "ARRAY_DECIMAL", "ARRAY_BOOLEAN", "ARRAY_OBJECT"];
335
- return variables.reduce(
336
- (acc, cur) => {
337
- if (cur.type === "BOOLEAN") {
338
- if (isDef(cur.value) && !isNull(cur.value)) {
339
- acc[cur.name] = cur.value;
340
- }
341
- } else if (jsonTypes.includes(cur.type)) {
342
- if (isDef(cur.value) && !isNull(cur.value)) {
343
- if (typeof cur.value === "string") {
344
- if (cur.value === "") {
345
- acc[cur.name] = cur.type === "OBJECT" ? {} : [];
346
- } else {
347
- try {
348
- acc[cur.name] = JSON.parse(cur.value);
349
- } catch (e) {
350
- acc[cur.name] = cur.type === "OBJECT" ? {} : [];
351
- }
352
- }
353
- } else {
354
- acc[cur.name] = cur.value;
355
- }
356
- }
357
- } else {
358
- if (isDef(cur.value) && !isNull(cur.value) && cur.value !== "") {
359
- acc[cur.name] = cur.value;
360
- }
361
- }
362
- return acc;
363
- },
364
- {}
365
- );
366
- };
367
332
  var getChatSocketUrl = (baseURL, params) => {
368
333
  return buildUrlParams(params, getWebSocketUrl(`${baseURL}/ws`), "comma");
369
334
  };
@@ -373,7 +338,7 @@ var CONV_MODE = {
373
338
  PROD: 1,
374
339
  DEBUG: 2
375
340
  };
376
- var flowSpecState = proxy({
341
+ proxy({
377
342
  nodes: []
378
343
  });
379
344
  function setLogPanelOpen(_open, _executionId) {
@@ -578,17 +543,6 @@ function createChatStore() {
578
543
  const setAgentModel = (model) => {
579
544
  agent.model = { ...agent.model, ...model };
580
545
  };
581
- const getUserInput = async (agentId) => {
582
- agent.loading = true;
583
- try {
584
- const res = await config.services.request.getAgentUserInput(agentId);
585
- if (res.data?.inputs && agent.agentInfo.userInput?.length === 0) {
586
- agent.agentInfo.userInput = res.data.inputs.filter((item) => item.enableEdit);
587
- }
588
- } finally {
589
- agent.loading = false;
590
- }
591
- };
592
546
  const setAgent = (agentInfo) => {
593
547
  agent.agentInfo = agentInfo;
594
548
  if (agentInfo.agentType === 2 /* AUTONOMOUS */) {
@@ -598,13 +552,6 @@ function createChatStore() {
598
552
  });
599
553
  }
600
554
  };
601
- const setUserInput = (userInput) => {
602
- if (config.params?.convMeta?.mode === CONV_MODE.PROD && agent.agentInfo.agentType === 1 /* FLOW */) {
603
- getUserInput(agent.agentInfo.id);
604
- } else if (agent.agentInfo.userInput) {
605
- agent.agentInfo.userInput = userInput;
606
- }
607
- };
608
555
  const getAgentInfo = async (id) => {
609
556
  config.loading = true;
610
557
  if (agent.agentInfo.id === id) return;
@@ -1160,9 +1107,9 @@ function createChatStore() {
1160
1107
  }
1161
1108
  }
1162
1109
  }
1163
- function processMessageContent(message3) {
1110
+ function processMessageContent(message2) {
1164
1111
  const newMessage = {
1165
- ...message3,
1112
+ ...message2,
1166
1113
  agentId: agent.agentInfo.id
1167
1114
  };
1168
1115
  const contentList = Array.isArray(newMessage.content) ? newMessage.content : [];
@@ -1209,13 +1156,13 @@ function createChatStore() {
1209
1156
  }
1210
1157
  processMessageContent(newMessage);
1211
1158
  };
1212
- const sendMessage = async (message3, msgFiles = [], params) => {
1159
+ const sendMessage = async (message2, msgFiles = [], params) => {
1213
1160
  const conversationId = conversation.active.id;
1214
1161
  if (conversation.messages[conversationId].loading) return;
1215
1162
  let msgContent = "", files;
1216
1163
  const references = conversation.messages[conversationId].references;
1217
- if (message3) {
1218
- msgContent = message3;
1164
+ if (message2) {
1165
+ msgContent = message2;
1219
1166
  files = msgFiles;
1220
1167
  } else {
1221
1168
  if (references?.type === 1 && references?.content?.msgContent) {
@@ -1227,22 +1174,6 @@ function createChatStore() {
1227
1174
  if (!msgContent) return;
1228
1175
  const canProceed = await config.hooks?.onBeforeSend?.(msgContent, files || []);
1229
1176
  if (canProceed === false) return;
1230
- if (agent.agentInfo.userInput?.length) {
1231
- const invalid = agent.agentInfo.userInput.some((item) => {
1232
- const isRequired = item.rules?.some((r) => r.type === "required");
1233
- if (isRequired) {
1234
- if (item.type === "BOOLEAN") {
1235
- return isNullOrUnDef(item.value);
1236
- }
1237
- return isNullOrUnDef(item.value) || item.value === "";
1238
- }
1239
- return false;
1240
- });
1241
- if (invalid) {
1242
- message.error("\u8BF7\u68C0\u67E5\u8F93\u5165\u53C2\u6570");
1243
- return;
1244
- }
1245
- }
1246
1177
  conversation.messages[conversationId].loading = true;
1247
1178
  const idx = conversations.list.items.findIndex((item) => item.id === conversationId);
1248
1179
  if (idx !== -1 && !conversations.list.items[idx].label) {
@@ -1261,10 +1192,9 @@ function createChatStore() {
1261
1192
  responseMode: 2
1262
1193
  };
1263
1194
  const extraParams = deepCopy(config.params?.params || {});
1264
- const userInputParams = variablesToObject(agent.agentInfo.userInput || []);
1265
- Object.assign(extraParams, userInputParams, message3 ? {} : { ...references?.params }, params);
1195
+ Object.assign(extraParams, message2 ? {} : { ...references?.params }, params);
1266
1196
  sendParams.params = extraParams;
1267
- if (!message3) {
1197
+ if (!message2) {
1268
1198
  setContent("");
1269
1199
  setContentParams();
1270
1200
  setFileList([]);
@@ -1327,7 +1257,7 @@ function createChatStore() {
1327
1257
  /** 设置智能体 */
1328
1258
  setAgent,
1329
1259
  /** 设置智能体用户输入 */
1330
- setUserInput,
1260
+ // setUserInput,
1331
1261
  /** 设置会话配置 */
1332
1262
  setConversationSpec,
1333
1263
  /** 历史会话状态 */
@@ -1361,7 +1291,7 @@ function createChatStore() {
1361
1291
  /** 接收消息 */
1362
1292
  acceptMessage,
1363
1293
  /** 获取智能体用户输入 */
1364
- getUserInput,
1294
+ // getUserInput,
1365
1295
  /** 消息反馈 */
1366
1296
  feedback
1367
1297
  };
@@ -1381,7 +1311,6 @@ var styles_module_default2 = {
1381
1311
  bubbleList: "styles_module_bubbleList",
1382
1312
  resourceBtn: "styles_module_resourceBtn",
1383
1313
  resourceBtnActive: "styles_module_resourceBtnActive",
1384
- userInputCollapse: "styles_module_userInputCollapse",
1385
1314
  logoArea: "styles_module_logoArea",
1386
1315
  logoContainer: "styles_module_logoContainer",
1387
1316
  staticHalo: "styles_module_staticHalo",
@@ -2087,12 +2016,12 @@ var DocDrawer_default = ({ title, open, onClose, paramsStr }) => {
2087
2016
  }, [paramsStr]);
2088
2017
  return /* @__PURE__ */ jsx(Drawer, { title, push: false, size: "100%", open, onClose, children: /* @__PURE__ */ jsx(Spin, { spinning: loading, children: content ? /* @__PURE__ */ jsx(XMarkdown, { content }) : /* @__PURE__ */ jsx(Empty, { className: "m-t-32" }) }) });
2089
2018
  };
2090
- var IndexQuote_default = ({ data, loading, message: message3 }) => {
2019
+ var IndexQuote_default = ({ data, loading, message: message2 }) => {
2091
2020
  const [open, setOpen] = useState(false);
2092
2021
  const citation = useMemo(() => {
2093
- const citations = message3.content?.find((item) => item.type === "citation")?.citations ?? [];
2022
+ const citations = message2.content?.find((item) => item.type === "citation")?.citations ?? [];
2094
2023
  return citations?.find((item) => String(item.citationId) === String(data.citationId));
2095
- }, [data.citationId, message3.content]);
2024
+ }, [data.citationId, message2.content]);
2096
2025
  const onClick = () => {
2097
2026
  if (!citation?.citationUrl) return;
2098
2027
  if (isExternal(citation.citationUrl)) {
@@ -2237,16 +2166,16 @@ function preprocessCustomTagPayloads(content = "", payloadTagPattern) {
2237
2166
  payloadMap
2238
2167
  };
2239
2168
  }
2240
- var adaptMarkdownComponent = (Component, payloadMap = /* @__PURE__ */ new Map(), message3) => {
2169
+ var adaptMarkdownComponent = (Component, payloadMap = /* @__PURE__ */ new Map(), message2) => {
2241
2170
  const WrappedComponent = ({ children, streamStatus, ...rest }) => {
2242
2171
  const rawData = resolveMappedMarkdownPayload(children, payloadMap);
2243
- return /* @__PURE__ */ jsx(Component, { message: message3, ...rest, data: rawData, loading: streamStatus === "loading" });
2172
+ return /* @__PURE__ */ jsx(Component, { message: message2, ...rest, data: rawData, loading: streamStatus === "loading" });
2244
2173
  };
2245
2174
  WrappedComponent.displayName = `AdaptedMarkdownComponent(${Component.displayName || Component.name || "Anonymous"})`;
2246
2175
  return WrappedComponent;
2247
2176
  };
2248
- var adaptMarkdownComponents = (components, payloadMap = /* @__PURE__ */ new Map(), message3) => Object.fromEntries(Object.entries(components ?? {}).map(([key, Component]) => [key, adaptMarkdownComponent(Component, payloadMap, message3)]));
2249
- var XMarkdown_default = ({ message: message3, components = {}, content = "", ...rest }) => {
2177
+ var adaptMarkdownComponents = (components, payloadMap = /* @__PURE__ */ new Map(), message2) => Object.fromEntries(Object.entries(components ?? {}).map(([key, Component]) => [key, adaptMarkdownComponent(Component, payloadMap, message2)]));
2178
+ var XMarkdown_default = ({ message: message2, components = {}, content = "", ...rest }) => {
2250
2179
  const config = useMemo(() => getMarkdownConfig(), []);
2251
2180
  const formattedContent = useMemo(() => formatMixedContent(content), [content]);
2252
2181
  const newComponents = useMemo(
@@ -2271,7 +2200,7 @@ var XMarkdown_default = ({ message: message3, components = {}, content = "", ...
2271
2200
  () => preprocessCustomTagPayloads(formattedContent, payloadTagPattern),
2272
2201
  [formattedContent, payloadTagPattern]
2273
2202
  );
2274
- const markdownComponents = useMemo(() => adaptMarkdownComponents(newComponents, payloadMap, message3), [componentKeys, message3, payloadMap]);
2203
+ const markdownComponents = useMemo(() => adaptMarkdownComponents(newComponents, payloadMap, message2), [componentKeys, message2, payloadMap]);
2275
2204
  return /* @__PURE__ */ jsx(
2276
2205
  XMarkdown,
2277
2206
  {
@@ -3166,9 +3095,9 @@ function diffConversationMessages(messages, prevCursors) {
3166
3095
  const nextCursors = [];
3167
3096
  const pendingItems = [];
3168
3097
  for (let messageIndex = 0; messageIndex < messages.length; messageIndex += 1) {
3169
- const message3 = messages[messageIndex];
3170
- const messageId = String(message3?.messageId ?? messageIndex);
3171
- const items = Array.isArray(message3?.content) ? message3.content : [];
3098
+ const message2 = messages[messageIndex];
3099
+ const messageId = String(message2?.messageId ?? messageIndex);
3100
+ const items = Array.isArray(message2?.content) ? message2.content : [];
3172
3101
  const prevCursor = prevCursors[messageIndex];
3173
3102
  const startIndex = prevCursor ? prevCursor.contentLength : 0;
3174
3103
  if (prevCursor && (prevCursor.messageId !== messageId || items.length < prevCursor.contentLength)) {
@@ -3199,9 +3128,9 @@ function initializeWizardSurface(state, surfaceId, effects, nextWizardSteps) {
3199
3128
  }
3200
3129
  function reduceA2uiRuntimeMessages(state, messages) {
3201
3130
  const { shouldReplayAll, pendingItems, nextCursors } = diffConversationMessages(messages || [], state.processedMessageCursors);
3202
- const itemsToProcess = shouldReplayAll ? messages.flatMap((message3, messageIndex) => {
3203
- const messageId = String(message3?.messageId ?? messageIndex);
3204
- const items = Array.isArray(message3?.content) ? message3.content : [];
3131
+ const itemsToProcess = shouldReplayAll ? messages.flatMap((message2, messageIndex) => {
3132
+ const messageId = String(message2?.messageId ?? messageIndex);
3133
+ const items = Array.isArray(message2?.content) ? message2.content : [];
3205
3134
  return items.map((item) => ({ messageIndex, messageId, item }));
3206
3135
  }) : pendingItems;
3207
3136
  if (!shouldReplayAll && itemsToProcess.length === 0) {
@@ -3251,9 +3180,9 @@ function reduceA2uiRuntimeMessages(state, messages) {
3251
3180
  delete nextState.modelPathBySurface[surfaceId];
3252
3181
  }
3253
3182
  });
3254
- nextState.processedMessageCursors = shouldReplayAll ? messages.map((message3, messageIndex) => ({
3255
- messageId: String(message3?.messageId ?? messageIndex),
3256
- contentLength: Array.isArray(message3?.content) ? message3.content.length : 0
3183
+ nextState.processedMessageCursors = shouldReplayAll ? messages.map((message2, messageIndex) => ({
3184
+ messageId: String(message2?.messageId ?? messageIndex),
3185
+ contentLength: Array.isArray(message2?.content) ? message2.content.length : 0
3257
3186
  })) : nextCursors;
3258
3187
  nextState.wizardStepBySurface = { ...nextState.wizardStepBySurface, ...nextWizardSteps };
3259
3188
  if (deletedSurfaceIds.size) {
@@ -3590,9 +3519,9 @@ function diffMessages(messages, prevCursors) {
3590
3519
  const nextCursors = [];
3591
3520
  const pendingItems = [];
3592
3521
  for (let messageIndex = 0; messageIndex < messages.length; messageIndex += 1) {
3593
- const message3 = messages[messageIndex];
3594
- const messageId = String(message3?.messageId ?? messageIndex);
3595
- const items = Array.isArray(message3?.content) ? message3.content : [];
3522
+ const message2 = messages[messageIndex];
3523
+ const messageId = String(message2?.messageId ?? messageIndex);
3524
+ const items = Array.isArray(message2?.content) ? message2.content : [];
3596
3525
  const prevCursor = prevCursors[messageIndex];
3597
3526
  const startIndex = prevCursor ? prevCursor.contentLength : 0;
3598
3527
  if (prevCursor && (prevCursor.messageId !== messageId || items.length < prevCursor.contentLength)) {
@@ -3623,8 +3552,8 @@ function A2uiRuntimeProvider({ messages, children }) {
3623
3552
  }, [conversationId]);
3624
3553
  React6.useEffect(() => {
3625
3554
  const { shouldReplayAll, nextCursors, pendingItems } = diffMessages(messages, processedMessageCursorsRef.current);
3626
- const itemsToProcess = shouldReplayAll ? messages.flatMap((message3) => {
3627
- const items = Array.isArray(message3?.content) ? message3.content : [];
3555
+ const itemsToProcess = shouldReplayAll ? messages.flatMap((message2) => {
3556
+ const items = Array.isArray(message2?.content) ? message2.content : [];
3628
3557
  return items.map((item) => ({ item }));
3629
3558
  }) : pendingItems;
3630
3559
  if (!shouldReplayAll && itemsToProcess.length === 0) return;
@@ -3636,9 +3565,9 @@ function A2uiRuntimeProvider({ messages, children }) {
3636
3565
  const surfaceId = extractSurfaceId3(item.command);
3637
3566
  if (surfaceId) nextLatestCommandIndexBySurface[surfaceId] = nextCommandIndex;
3638
3567
  });
3639
- processedMessageCursorsRef.current = shouldReplayAll ? messages.map((message3, messageIndex) => ({
3640
- messageId: String(message3?.messageId ?? messageIndex),
3641
- contentLength: Array.isArray(message3?.content) ? message3.content.length : 0
3568
+ processedMessageCursorsRef.current = shouldReplayAll ? messages.map((message2, messageIndex) => ({
3569
+ messageId: String(message2?.messageId ?? messageIndex),
3570
+ contentLength: Array.isArray(message2?.content) ? message2.content.length : 0
3642
3571
  })) : nextCursors;
3643
3572
  latestCommandIndexBySurfaceRef.current = nextLatestCommandIndexBySurface;
3644
3573
  commandIndexRef.current = nextCommandIndex;
@@ -3923,21 +3852,21 @@ var ToolCallNode = React6.memo(({ item }) => {
3923
3852
  return /* @__PURE__ */ jsx(tool_call_item_default, { item });
3924
3853
  });
3925
3854
  var TextNode = React6.memo(
3926
- ({ item, role, customComponents, message: message3 }) => {
3855
+ ({ item, role, customComponents, message: message2 }) => {
3927
3856
  const content = toA2uiDisplayText(role, item?.messageContent);
3928
3857
  if (typeof content === "string" && content.startsWith("Question:")) {
3929
3858
  return /* @__PURE__ */ jsx(QuestionSummary, { content });
3930
3859
  }
3931
3860
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3932
3861
  !!item.reasoningContent && /* @__PURE__ */ jsx(Think, { title: "\u6DF1\u5EA6\u601D\u8003", children: item.reasoningContent }),
3933
- !!content && /* @__PURE__ */ jsx(XMarkdown_default, { message: message3, components: customComponents, content })
3862
+ !!content && /* @__PURE__ */ jsx(XMarkdown_default, { message: message2, components: customComponents, content })
3934
3863
  ] });
3935
3864
  }
3936
3865
  );
3937
3866
  var StepErrorNode = React6.memo(
3938
- ({ item, customComponents, message: message3 }) => {
3867
+ ({ item, customComponents, message: message2 }) => {
3939
3868
  if (!item.errorMessage) return null;
3940
- return /* @__PURE__ */ jsx(XMarkdown_default, { message: message3, components: customComponents, content: item.errorMessage });
3869
+ return /* @__PURE__ */ jsx(XMarkdown_default, { message: message2, components: customComponents, content: item.errorMessage });
3941
3870
  }
3942
3871
  );
3943
3872
  var FilesNode = React6.memo(({ item }) => {
@@ -3967,9 +3896,9 @@ var FilesNode = React6.memo(({ item }) => {
3967
3896
  }, [item.files]);
3968
3897
  return /* @__PURE__ */ jsx(FileCard.List, { items: fileItems });
3969
3898
  });
3970
- var MessageRender_default = React6.memo(({ role, message: message3, messageIndex = -1, loading, containerRef, customComponents }) => {
3899
+ var MessageRender_default = React6.memo(({ role, message: message2, messageIndex = -1, loading, containerRef, customComponents }) => {
3971
3900
  const content = useMemo(() => {
3972
- return (message3.content || []).filter((item) => {
3901
+ return (message2.content || []).filter((item) => {
3973
3902
  if (!RENDERABLE_MESSAGE_TYPES.includes(item.type)) {
3974
3903
  return false;
3975
3904
  }
@@ -3981,12 +3910,12 @@ var MessageRender_default = React6.memo(({ role, message: message3, messageIndex
3981
3910
  }
3982
3911
  return true;
3983
3912
  });
3984
- }, [loading, message3.content]);
3913
+ }, [loading, message2.content]);
3985
3914
  const quoteMsg = useMemo(() => {
3986
3915
  const quoteMsg2 = {};
3987
- if (message3.params) {
3916
+ if (message2.params) {
3988
3917
  try {
3989
- const citation = JSON.parse(message3.params).citation;
3918
+ const citation = JSON.parse(message2.params).citation;
3990
3919
  if (citation) {
3991
3920
  quoteMsg2.messageContent = citation;
3992
3921
  }
@@ -3994,7 +3923,7 @@ var MessageRender_default = React6.memo(({ role, message: message3, messageIndex
3994
3923
  }
3995
3924
  }
3996
3925
  return isEmptyObj(quoteMsg2) ? null : quoteMsg2;
3997
- }, [message3.params, message3.quoteMsg]);
3926
+ }, [message2.params, message2.quoteMsg]);
3998
3927
  if (content.length === 0) return null;
3999
3928
  return /* @__PURE__ */ jsxs(Flex, { ref: containerRef, vertical: true, gap: 8, children: [
4000
3929
  content.map((item, index) => {
@@ -4008,8 +3937,8 @@ var MessageRender_default = React6.memo(({ role, message: message3, messageIndex
4008
3937
  content: /* @__PURE__ */ jsxs(Fragment, { children: [
4009
3938
  item.type === "runStarted" && /* @__PURE__ */ jsx(RunStartedNode, { loading }, `flow-start-${index}`),
4010
3939
  (item.type === "toolCall" || item.type === "toolResult") && /* @__PURE__ */ jsx(ToolCallNode, { item }, `tool-call-${item.toolCallId || index}`),
4011
- item.type === "text" && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(TextNode, { item, role: message3.role, customComponents, message: message3 }, `message-${index}`) }),
4012
- item.type === "stepError" && /* @__PURE__ */ jsx(StepErrorNode, { item, customComponents, message: message3 }, `step-error-${index}`),
3940
+ item.type === "text" && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(TextNode, { item, role: message2.role, customComponents, message: message2 }, `message-${index}`) }),
3941
+ item.type === "stepError" && /* @__PURE__ */ jsx(StepErrorNode, { item, customComponents, message: message2 }, `step-error-${index}`),
4013
3942
  item.type === "files" && /* @__PURE__ */ jsx(FilesNode, { item }, `files-${index}`),
4014
3943
  item.type === "plan" && /* @__PURE__ */ jsx(A2uiPlanNode, { item }, `plan-${index}`)
4015
3944
  ] })
@@ -4137,14 +4066,14 @@ var BubbleListItems_default = ({
4137
4066
  const messageRefs = useRef({});
4138
4067
  const chatRecords = useMemo(() => {
4139
4068
  const chatRecords2 = [];
4140
- conversationMessages.forEach((message3, messageIndex) => {
4141
- const role = getRole(message3.role);
4069
+ conversationMessages.forEach((message2, messageIndex) => {
4070
+ const role = getRole(message2.role);
4142
4071
  const isLeftBubble = role.user === "agent";
4143
- const isMessageLoading = !!message3.generating;
4072
+ const isMessageLoading = !!message2.generating;
4144
4073
  const showLogButton = isDebug && isLeftBubble && !isMessageLoading && isWorkFlow;
4145
- const baseKey = `${message3.executionId}-${messageIndex}`;
4074
+ const baseKey = `${message2.executionId}-${messageIndex}`;
4146
4075
  const footerNode = !isMessageLoading ? /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 8, children: [
4147
- message3.stopFlag && isLeftBubble && /* @__PURE__ */ jsx(Text3, { type: "secondary", style: { flex: "none" }, children: "\u5DF2\u505C\u6B62" }),
4076
+ message2.stopFlag && isLeftBubble && /* @__PURE__ */ jsx(Text3, { type: "secondary", style: { flex: "none" }, children: "\u5DF2\u505C\u6B62" }),
4148
4077
  /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 4, children: [
4149
4078
  showLogButton && /* @__PURE__ */ jsx(
4150
4079
  Button,
@@ -4154,7 +4083,7 @@ var BubbleListItems_default = ({
4154
4083
  size: "small",
4155
4084
  icon: /* @__PURE__ */ jsx(FileTextOutlined, {}),
4156
4085
  onClick: () => {
4157
- setLogPanelOpen(true, message3.executionId);
4086
+ setLogPanelOpen(true, message2.executionId);
4158
4087
  }
4159
4088
  }
4160
4089
  ),
@@ -4177,21 +4106,21 @@ var BubbleListItems_default = ({
4177
4106
  /* @__PURE__ */ jsx(
4178
4107
  Button,
4179
4108
  {
4180
- color: message3.feedback === 1 ? "primary" : "default",
4109
+ color: message2.feedback === 1 ? "primary" : "default",
4181
4110
  size: "small",
4182
4111
  variant: "text",
4183
4112
  icon: /* @__PURE__ */ jsx(LikeOutlined, {}),
4184
- onClick: () => chatStore.feedback(message3.executionId, 1, messageIndex)
4113
+ onClick: () => chatStore.feedback(message2.executionId, 1, messageIndex)
4185
4114
  }
4186
4115
  ),
4187
4116
  /* @__PURE__ */ jsx(
4188
4117
  Button,
4189
4118
  {
4190
- color: message3.feedback === 2 ? "primary" : "default",
4119
+ color: message2.feedback === 2 ? "primary" : "default",
4191
4120
  size: "small",
4192
4121
  variant: "text",
4193
4122
  icon: /* @__PURE__ */ jsx(DislikeOutlined, {}),
4194
- onClick: () => chatStore.feedback(message3.executionId, 2, messageIndex)
4123
+ onClick: () => chatStore.feedback(message2.executionId, 2, messageIndex)
4195
4124
  }
4196
4125
  ),
4197
4126
  /* @__PURE__ */ jsx(
@@ -4199,7 +4128,7 @@ var BubbleListItems_default = ({
4199
4128
  {
4200
4129
  control: agentActions,
4201
4130
  ctx: {
4202
- message: message3,
4131
+ message: message2,
4203
4132
  get dom() {
4204
4133
  return messageRefs.current[baseKey];
4205
4134
  }
@@ -4218,7 +4147,7 @@ var BubbleListItems_default = ({
4218
4147
  MessageRender_default,
4219
4148
  {
4220
4149
  role,
4221
- message: message3,
4150
+ message: message2,
4222
4151
  messageIndex,
4223
4152
  customComponents,
4224
4153
  loading: isMessageLoading,
@@ -4502,326 +4431,6 @@ var ChatSenderHeader = () => {
4502
4431
  ] });
4503
4432
  };
4504
4433
  var ChatSenderHeader_default = ChatSenderHeader;
4505
- var MonacoEditor = ({ value = "", onChange, placeholder, height = 200, readOnly = false, style }) => {
4506
- const handleKeyDownCapture = useCallback((e) => {
4507
- if (e.key === " " || e.code === "Space") {
4508
- e.stopPropagation();
4509
- }
4510
- }, []);
4511
- const handleKeyUpCapture = useCallback((e) => {
4512
- if (e.key === " " || e.code === "Space") {
4513
- e.stopPropagation();
4514
- }
4515
- }, []);
4516
- const handleScriptChange = useCallback(
4517
- (event) => {
4518
- onChange?.(event.target.value || "");
4519
- },
4520
- [onChange]
4521
- );
4522
- return /* @__PURE__ */ jsx("div", { style, onKeyDownCapture: handleKeyDownCapture, onKeyUpCapture: handleKeyUpCapture, children: /* @__PURE__ */ jsx(
4523
- Input.TextArea,
4524
- {
4525
- value,
4526
- onChange: handleScriptChange,
4527
- readOnly,
4528
- placeholder,
4529
- autoSize: false,
4530
- style: {
4531
- height,
4532
- resize: "vertical",
4533
- fontFamily: 'Monaco, Menlo, Consolas, "Courier New", monospace',
4534
- ...style
4535
- }
4536
- }
4537
- ) });
4538
- };
4539
- var MonacoEditor_default = MonacoEditor;
4540
- var { Text: Text5 } = Typography;
4541
- var START_NODE_TYPE = "start";
4542
- var FormFileUpload = ({ value, onChange, multiple = false }) => {
4543
- const { token } = theme.useToken();
4544
- const fileList = Array.isArray(value) ? value : value ? [value] : [];
4545
- const chatStore = useChatStore();
4546
- const configState = useSnapshot(chatStore.config);
4547
- const conversationState = useSnapshot(chatStore.conversation);
4548
- const customRequest = async (options) => {
4549
- const { file, onSuccess, onError } = options;
4550
- try {
4551
- const formData = new FormData();
4552
- formData.append("file", file);
4553
- const res = await configState.services.request.chatUpload(chatStore.agent.agentInfo.id, formData, conversationState.active.id);
4554
- if (res.code === 200 && res.data?.length) {
4555
- const uploadedFile = res.data[0];
4556
- onSuccess(uploadedFile);
4557
- if (multiple) {
4558
- onChange?.([...fileList, uploadedFile]);
4559
- } else {
4560
- onChange?.([uploadedFile]);
4561
- }
4562
- } else {
4563
- message.error(res.message || "\u4E0A\u4F20\u5931\u8D25");
4564
- onError(new Error(res.message));
4565
- }
4566
- } catch (error) {
4567
- onError(error);
4568
- }
4569
- };
4570
- const handleRemove = (fileToRemove) => {
4571
- const newList = fileList.filter((f) => f.id !== fileToRemove.id);
4572
- onChange?.(newList.length > 0 ? newList : void 0);
4573
- };
4574
- return /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 12, style: { width: "100%" }, children: [
4575
- !multiple && fileList.length >= 1 ? null : /* @__PURE__ */ jsx(Upload, { multiple, customRequest, showUploadList: false, children: /* @__PURE__ */ jsx(Button, { icon: /* @__PURE__ */ jsx(CloudUploadOutlined, {}), children: "\u4ECE\u672C\u5730\u4E0A\u4F20" }) }),
4576
- fileList.length > 0 && /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 8, children: fileList.map((file) => /* @__PURE__ */ jsxs(
4577
- Flex,
4578
- {
4579
- align: "center",
4580
- justify: "space-between",
4581
- style: {
4582
- padding: "8px 12px",
4583
- backgroundColor: token.colorFillAlter,
4584
- borderRadius: token.borderRadiusLG || 8,
4585
- border: `1px solid ${token.colorBorderSecondary}`
4586
- },
4587
- children: [
4588
- /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 12, style: { overflow: "hidden", flex: 1 }, children: [
4589
- /* @__PURE__ */ jsx(
4590
- "div",
4591
- {
4592
- style: {
4593
- width: 40,
4594
- height: 40,
4595
- backgroundColor: "#000",
4596
- borderRadius: token.borderRadiusSM || 4,
4597
- display: "flex",
4598
- alignItems: "center",
4599
- justifyContent: "center",
4600
- flexShrink: 0
4601
- },
4602
- children: /* @__PURE__ */ jsx(FileIcon, { suffix: file.extension || getFileSuffixName(file.name), fontSize: 20 })
4603
- }
4604
- ),
4605
- /* @__PURE__ */ jsxs("div", { style: { overflow: "hidden", display: "flex", flexDirection: "column", flex: 1 }, children: [
4606
- /* @__PURE__ */ jsx(Text5, { ellipsis: true, style: { width: "100%", fontSize: 14, fontWeight: 500 }, children: file.name }),
4607
- /* @__PURE__ */ jsxs(Text5, { type: "secondary", style: { fontSize: 12 }, children: [
4608
- (file.extension || getFileSuffixName(file.name)).toUpperCase(),
4609
- " \u2022 ",
4610
- formatSize(file.size, { from: "B" })
4611
- ] })
4612
- ] })
4613
- ] }),
4614
- /* @__PURE__ */ jsx(Button, { type: "text", icon: /* @__PURE__ */ jsx(DeleteOutlined, {}), onClick: () => handleRemove(file), style: { color: token.colorTextSecondary } })
4615
- ]
4616
- },
4617
- file.id || file.uid
4618
- )) })
4619
- ] });
4620
- };
4621
- var FormMonacoEditor = ({ value, onChange }) => {
4622
- const { token } = theme.useToken();
4623
- return /* @__PURE__ */ jsx("div", { style: { backgroundColor: token.colorFillAlter, padding: 8, borderRadius: token.borderRadius }, children: /* @__PURE__ */ jsx(MonacoEditor_default, { language: "json", placeholder: "\u8BF7\u8F93\u5165\u503C...", height: 80, value, onChange }) });
4624
- };
4625
- var UserInputPanel = () => {
4626
- const chatStore = useChatStore();
4627
- const agentSnap = useSnapshot(chatStore.agent);
4628
- const flowSpecSnap = useSnapshot(flowSpecState);
4629
- const [form] = Form.useForm();
4630
- const [activeKey, setActiveKey] = useState(["1"]);
4631
- const { layout } = useSnapshot(chatStore.config);
4632
- const startNode = useMemo(() => {
4633
- return flowSpecSnap.nodes.find((n) => String(n.type || "").toLowerCase() === START_NODE_TYPE);
4634
- }, [flowSpecSnap.nodes]);
4635
- const inputs = useMemo(() => {
4636
- if (agentSnap.agentInfo.userInput?.length > 0) {
4637
- return agentSnap.agentInfo.userInput.filter((i) => i.enableEdit);
4638
- }
4639
- return (startNode?.data.input || []).filter((i) => i.enableEdit);
4640
- }, [startNode, agentSnap.agentInfo.userInput]);
4641
- useEffect(() => {
4642
- if (inputs.length > 0) {
4643
- const initialValues = inputs.reduce((acc, cur) => {
4644
- const value = cur.value;
4645
- acc[cur.name] = value;
4646
- return acc;
4647
- }, {});
4648
- form.setFieldsValue(initialValues);
4649
- }
4650
- }, [inputs, form]);
4651
- const handleValuesChange = (changedValues) => {
4652
- if (agentSnap.agentInfo.userInput?.length > 0) {
4653
- const newInput = agentSnap.agentInfo.userInput.map((v) => {
4654
- if (v.name in changedValues) {
4655
- const newValue = changedValues[v.name];
4656
- return { ...v, value: newValue };
4657
- }
4658
- return v;
4659
- });
4660
- chatStore.setAgent({ ...agentSnap.agentInfo, userInput: newInput });
4661
- return;
4662
- }
4663
- const nodeIndex = flowSpecState.nodes.findIndex((n) => n.id === startNode?.id);
4664
- if (nodeIndex > -1) {
4665
- const currentInput = flowSpecState.nodes[nodeIndex].data.input;
4666
- const newInput = currentInput.map((v) => {
4667
- if (v.name in changedValues) {
4668
- const newValue = changedValues[v.name];
4669
- return { ...v, value: newValue };
4670
- }
4671
- return v;
4672
- });
4673
- flowSpecState.nodes[nodeIndex].data.input = newInput;
4674
- }
4675
- };
4676
- const handleStartChat = () => {
4677
- form.validateFields().then(() => {
4678
- setActiveKey([]);
4679
- }).catch(() => {
4680
- message.error("\u8BF7\u68C0\u67E5\u8F93\u5165\u53C2\u6570");
4681
- });
4682
- };
4683
- const renderFormItem = (item) => {
4684
- const itemStyle = { marginBottom: 0 };
4685
- const commonProps = {
4686
- label: item.name,
4687
- name: item.name,
4688
- style: itemStyle,
4689
- rules: item.rules?.map((r) => {
4690
- const valStr = String(r.value || "");
4691
- if (r.type === "required") return { required: true, message: r.message };
4692
- if (r.type === "email") return { type: "email", message: r.message };
4693
- if (r.type === "pattern") return { pattern: new RegExp(valStr), message: r.message };
4694
- if (r.type === "max" || r.type === "min") {
4695
- return {
4696
- validator: (_, val) => {
4697
- if (val === void 0 || val === null || val === "") return Promise.resolve();
4698
- const numVal = Number(val);
4699
- if (isNaN(numVal)) return Promise.resolve();
4700
- if (r.type === "max" && numVal > Number(valStr)) return Promise.reject(new Error(r.message));
4701
- if (r.type === "min" && numVal < Number(valStr)) return Promise.reject(new Error(r.message));
4702
- return Promise.resolve();
4703
- }
4704
- };
4705
- }
4706
- if (r.type === "length") {
4707
- const [min, max] = valStr.split(",").map((v) => v ? Number(v) : void 0);
4708
- return {
4709
- validator: (_, val) => {
4710
- if (val === void 0 || val === null || val === "") return Promise.resolve();
4711
- const strVal = String(val);
4712
- if (min !== void 0 && strVal.length < min) return Promise.reject(new Error(r.message));
4713
- if (max !== void 0 && strVal.length > max) return Promise.reject(new Error(r.message));
4714
- return Promise.resolve();
4715
- }
4716
- };
4717
- }
4718
- if (r.type === "size") {
4719
- const [min, max] = valStr.split(",").map((v) => v ? Number(v) : void 0);
4720
- return {
4721
- validator: (_, val) => {
4722
- if (val === void 0 || val === null || val === "") return Promise.resolve();
4723
- let len = 0;
4724
- if (Array.isArray(val)) {
4725
- len = val.length;
4726
- } else if (typeof val === "string") {
4727
- try {
4728
- const parsed = JSON.parse(val);
4729
- if (Array.isArray(parsed)) len = parsed.length;
4730
- else return Promise.resolve();
4731
- } catch (e) {
4732
- return Promise.resolve();
4733
- }
4734
- } else {
4735
- return Promise.resolve();
4736
- }
4737
- if (min !== void 0 && len < min) return Promise.reject(new Error(r.message));
4738
- if (max !== void 0 && len > max) return Promise.reject(new Error(r.message));
4739
- return Promise.resolve();
4740
- }
4741
- };
4742
- }
4743
- if (r.type === "enum") {
4744
- const options = valStr.split(",").map((s) => s.trim());
4745
- return {
4746
- validator: (_, val) => {
4747
- if (val === void 0 || val === null || val === "") return Promise.resolve();
4748
- if (options.includes(String(val))) return Promise.resolve();
4749
- return Promise.reject(new Error(r.message));
4750
- }
4751
- };
4752
- }
4753
- return {};
4754
- })
4755
- };
4756
- if (["STRING", "LONG"].includes(item.type)) {
4757
- return /* @__PURE__ */ jsx(Form.Item, { ...commonProps, children: /* @__PURE__ */ jsx(Input, { placeholder: "\u8BF7\u8F93\u5165\u503C" }) });
4758
- }
4759
- if (["NUMBER"].includes(item.type)) {
4760
- return /* @__PURE__ */ jsx(Form.Item, { ...commonProps, children: /* @__PURE__ */ jsx(InputNumber, { style: { width: "100%" }, placeholder: "\u8BF7\u8F93\u5165\u6570\u503C" }) });
4761
- }
4762
- if (item.type === "BOOLEAN") {
4763
- return /* @__PURE__ */ jsx(Form.Item, { style: itemStyle, name: item.name, valuePropName: "checked", children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", children: [
4764
- /* @__PURE__ */ jsx("span", { children: item.name }),
4765
- /* @__PURE__ */ jsx(Switch$1, { size: "small" })
4766
- ] }) });
4767
- }
4768
- if (item.type === "FILE") {
4769
- return /* @__PURE__ */ jsx(Form.Item, { ...commonProps, children: /* @__PURE__ */ jsx(FormFileUpload, { multiple: false }) });
4770
- }
4771
- if (item.type === "ARRAY_FILE") {
4772
- return /* @__PURE__ */ jsx(Form.Item, { ...commonProps, children: /* @__PURE__ */ jsx(FormFileUpload, { multiple: true }) });
4773
- }
4774
- if (["OBJECT", "ARRAY", "ARRAY_STRING", "ARRAY_NUMBER", "ARRAY_DECIMAL", "ARRAY_BOOLEAN", "ARRAY_OBJECT"].includes(item.type)) {
4775
- return /* @__PURE__ */ jsx(Form.Item, { ...commonProps, children: /* @__PURE__ */ jsx(FormMonacoEditor, {}) });
4776
- }
4777
- return /* @__PURE__ */ jsx(Form.Item, { ...commonProps, children: /* @__PURE__ */ jsx(Input, { placeholder: "\u8BF7\u8F93\u5165\u503C" }) });
4778
- };
4779
- const genExtra = () => {
4780
- if (activeKey.includes("1")) return null;
4781
- return /* @__PURE__ */ jsx(
4782
- Button,
4783
- {
4784
- type: "text",
4785
- size: "small",
4786
- onClick: (e) => {
4787
- e.stopPropagation();
4788
- setActiveKey(["1"]);
4789
- },
4790
- children: "\u7F16\u8F91"
4791
- }
4792
- );
4793
- };
4794
- const items = [
4795
- {
4796
- key: "1",
4797
- label: "\u53C2\u6570\u8BBE\u7F6E",
4798
- extra: genExtra(),
4799
- children: /* @__PURE__ */ jsxs(Fragment, { children: [
4800
- /* @__PURE__ */ jsx(Form, { form, layout: "vertical", onValuesChange: handleValuesChange, style: { maxHeight: 500, overflow: "auto", paddingRight: 16 }, children: inputs.length > 0 ? /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 12, children: inputs.map((item) => /* @__PURE__ */ jsx(React6.Fragment, { children: renderFormItem(item) }, item.name)) }) : /* @__PURE__ */ jsx("div", { style: { padding: "10px", color: "#999", textAlign: "center" }, children: "\u6682\u65E0\u7528\u6237\u8F93\u5165\u5B57\u6BB5" }) }),
4801
- /* @__PURE__ */ jsx(Flex, { align: "center", justify: "center", className: "m-t-16", children: /* @__PURE__ */ jsx(Button, { type: "primary", onClick: handleStartChat, children: "\u5F00\u59CB\u4F1A\u8BDD" }) })
4802
- ] })
4803
- }
4804
- ];
4805
- return /* @__PURE__ */ jsx("div", { className: styles_module_default2.userInputCollapse, children: /* @__PURE__ */ jsx(
4806
- Collapse,
4807
- {
4808
- activeKey,
4809
- onChange: (keys) => {
4810
- const newKeys = typeof keys === "string" ? [keys] : keys;
4811
- setActiveKey(newKeys);
4812
- },
4813
- items,
4814
- className: "m-16",
4815
- styles: {
4816
- body: {
4817
- paddingRight: 0,
4818
- paddingBottom: 10
4819
- }
4820
- }
4821
- }
4822
- ) });
4823
- };
4824
- var UserInputPanel_default = UserInputPanel;
4825
4434
 
4826
4435
  // src/ui/layouts/components/styles.module.less
4827
4436
  var styles_module_default5 = {
@@ -4846,11 +4455,10 @@ var ChatMainPanel = memo(
4846
4455
  []
4847
4456
  );
4848
4457
  const configState = useSnapshot(chatStore.config);
4849
- const agentState = useSnapshot(chatStore.agent);
4458
+ useSnapshot(chatStore.agent);
4850
4459
  return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames2("height-full"), children: [
4851
4460
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
4852
4461
  /* @__PURE__ */ jsxs(Flex, { justify: "center", align: "center", vertical: true, gap: 24, className: classNames2("height-full", styles_module_default5.bodyWidth), children: [
4853
- shouldRender(agentState.agentInfo.userInput && agentState.agentInfo.userInput.length > 0) && /* @__PURE__ */ jsx(RenderWrapper, { DefaultComponent: UserInputPanel_default }),
4854
4462
  shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsx("div", { className: "full-scroll", style: { width: "100%" }, children: /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.messageList, DefaultComponent: BubbleListItems_default }) }),
4855
4463
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.senderHeader, DefaultComponent: /* @__PURE__ */ jsx(ChatSenderHeader_default, {}) }),
4856
4464
  /* @__PURE__ */ jsxs(Flex, { className: styles_module_default5.inputContainer, vertical: true, gap: 8, children: [
@@ -4920,7 +4528,7 @@ var index_module_default2 = {
4920
4528
  animatedSplitter: "index_module_animatedSplitter",
4921
4529
  hideSplitterBar: "index_module_hideSplitterBar"
4922
4530
  };
4923
- var layouts_default = forwardRef(({ theme: theme4, params, hooks, layout, config, services }, _ref) => {
4531
+ var layouts_default = forwardRef(({ theme: theme3, params, hooks, layout, config, services }, _ref) => {
4924
4532
  const chatStore = useMemo(() => createChatStore(), []);
4925
4533
  const senderRef = useRef(null);
4926
4534
  useImperativeHandle(
@@ -4969,11 +4577,6 @@ var layouts_default = forwardRef(({ theme: theme4, params, hooks, layout, config
4969
4577
  chatStore.setAgent({ ...agentState.agentInfo, config: config.agent.config || {} });
4970
4578
  }
4971
4579
  }, [agentState.agentInfo.id, config.agent?.config]);
4972
- useDeepEffect(() => {
4973
- if (agentState.agentInfo.id) {
4974
- chatStore.setUserInput(config.agent.userInput);
4975
- }
4976
- }, [agentState.agentInfo.id, config.agent?.userInput]);
4977
4580
  useDeepEffect(() => {
4978
4581
  if (config?.agent?.id) {
4979
4582
  chatStore.getAgentInfo(config.agent.id);
@@ -5000,20 +4603,20 @@ var layouts_default = forwardRef(({ theme: theme4, params, hooks, layout, config
5000
4603
  }, [hasPreView]);
5001
4604
  useWebSocket({
5002
4605
  url: configState.services.websocketUrls?.[0],
5003
- onMessage: (message3) => chatStore.acceptMessage(message3.payload),
4606
+ onMessage: (message2) => chatStore.acceptMessage(message2.payload),
5004
4607
  clientHeartbeat: false,
5005
4608
  reconnectInterval: 1e4
5006
4609
  });
5007
4610
  useWebSocket({
5008
4611
  url: configState.services.websocketUrls?.[1],
5009
- onMessage: (message3) => chatStore.acceptMessage(message3.payload),
4612
+ onMessage: (message2) => chatStore.acceptMessage(message2.payload),
5010
4613
  clientHeartbeat: false,
5011
4614
  reconnectInterval: 1e4
5012
4615
  });
5013
4616
  useEffect(() => {
5014
4617
  hooks?.onBeforeInit?.();
5015
4618
  }, []);
5016
- return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: {}, ...theme4 }, children: /* @__PURE__ */ jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsx(Spin, { spinning: configState.loading, classNames: { root: index_module_default2.spinWrapper }, children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames2(index_module_default2.chatLayout, "zero-chat-layout", "height-full"), children: [
4619
+ return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: {}, ...theme3 }, children: /* @__PURE__ */ jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsx(Spin, { spinning: configState.loading, classNames: { root: index_module_default2.spinWrapper }, children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames2(index_module_default2.chatLayout, "zero-chat-layout", "height-full"), children: [
5017
4620
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
5018
4621
  /* @__PURE__ */ jsxs(Flex, { ref: containerRef, className: "full-scroll", children: [
5019
4622
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.leftPanel }),