@zero-library/chat-copilot 1.0.11 → 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) {
@@ -1253,7 +1184,6 @@ function createChatStore() {
1253
1184
  message: msgContent,
1254
1185
  convMeta: config.params.convMeta,
1255
1186
  files,
1256
- params,
1257
1187
  spec: {
1258
1188
  ...conversation.active.spec,
1259
1189
  model: agent.model
@@ -1262,10 +1192,9 @@ function createChatStore() {
1262
1192
  responseMode: 2
1263
1193
  };
1264
1194
  const extraParams = deepCopy(config.params?.params || {});
1265
- const userInputParams = variablesToObject(agent.agentInfo.userInput || []);
1266
- Object.assign(extraParams, userInputParams, message3 ? {} : { ...references?.params, params });
1195
+ Object.assign(extraParams, message2 ? {} : { ...references?.params }, params);
1267
1196
  sendParams.params = extraParams;
1268
- if (!message3) {
1197
+ if (!message2) {
1269
1198
  setContent("");
1270
1199
  setContentParams();
1271
1200
  setFileList([]);
@@ -1328,7 +1257,7 @@ function createChatStore() {
1328
1257
  /** 设置智能体 */
1329
1258
  setAgent,
1330
1259
  /** 设置智能体用户输入 */
1331
- setUserInput,
1260
+ // setUserInput,
1332
1261
  /** 设置会话配置 */
1333
1262
  setConversationSpec,
1334
1263
  /** 历史会话状态 */
@@ -1362,7 +1291,7 @@ function createChatStore() {
1362
1291
  /** 接收消息 */
1363
1292
  acceptMessage,
1364
1293
  /** 获取智能体用户输入 */
1365
- getUserInput,
1294
+ // getUserInput,
1366
1295
  /** 消息反馈 */
1367
1296
  feedback
1368
1297
  };
@@ -1382,7 +1311,6 @@ var styles_module_default2 = {
1382
1311
  bubbleList: "styles_module_bubbleList",
1383
1312
  resourceBtn: "styles_module_resourceBtn",
1384
1313
  resourceBtnActive: "styles_module_resourceBtnActive",
1385
- userInputCollapse: "styles_module_userInputCollapse",
1386
1314
  logoArea: "styles_module_logoArea",
1387
1315
  logoContainer: "styles_module_logoContainer",
1388
1316
  staticHalo: "styles_module_staticHalo",
@@ -2088,12 +2016,12 @@ var DocDrawer_default = ({ title, open, onClose, paramsStr }) => {
2088
2016
  }, [paramsStr]);
2089
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" }) }) });
2090
2018
  };
2091
- var IndexQuote_default = ({ data, loading, message: message3 }) => {
2019
+ var IndexQuote_default = ({ data, loading, message: message2 }) => {
2092
2020
  const [open, setOpen] = useState(false);
2093
2021
  const citation = useMemo(() => {
2094
- const citations = message3.content?.find((item) => item.type === "citation")?.citations ?? [];
2022
+ const citations = message2.content?.find((item) => item.type === "citation")?.citations ?? [];
2095
2023
  return citations?.find((item) => String(item.citationId) === String(data.citationId));
2096
- }, [data.citationId, message3.content]);
2024
+ }, [data.citationId, message2.content]);
2097
2025
  const onClick = () => {
2098
2026
  if (!citation?.citationUrl) return;
2099
2027
  if (isExternal(citation.citationUrl)) {
@@ -2238,16 +2166,16 @@ function preprocessCustomTagPayloads(content = "", payloadTagPattern) {
2238
2166
  payloadMap
2239
2167
  };
2240
2168
  }
2241
- var adaptMarkdownComponent = (Component, payloadMap = /* @__PURE__ */ new Map(), message3) => {
2169
+ var adaptMarkdownComponent = (Component, payloadMap = /* @__PURE__ */ new Map(), message2) => {
2242
2170
  const WrappedComponent = ({ children, streamStatus, ...rest }) => {
2243
2171
  const rawData = resolveMappedMarkdownPayload(children, payloadMap);
2244
- 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" });
2245
2173
  };
2246
2174
  WrappedComponent.displayName = `AdaptedMarkdownComponent(${Component.displayName || Component.name || "Anonymous"})`;
2247
2175
  return WrappedComponent;
2248
2176
  };
2249
- var adaptMarkdownComponents = (components, payloadMap = /* @__PURE__ */ new Map(), message3) => Object.fromEntries(Object.entries(components ?? {}).map(([key, Component]) => [key, adaptMarkdownComponent(Component, payloadMap, message3)]));
2250
- 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 }) => {
2251
2179
  const config = useMemo(() => getMarkdownConfig(), []);
2252
2180
  const formattedContent = useMemo(() => formatMixedContent(content), [content]);
2253
2181
  const newComponents = useMemo(
@@ -2272,7 +2200,7 @@ var XMarkdown_default = ({ message: message3, components = {}, content = "", ...
2272
2200
  () => preprocessCustomTagPayloads(formattedContent, payloadTagPattern),
2273
2201
  [formattedContent, payloadTagPattern]
2274
2202
  );
2275
- const markdownComponents = useMemo(() => adaptMarkdownComponents(newComponents, payloadMap, message3), [componentKeys, message3, payloadMap]);
2203
+ const markdownComponents = useMemo(() => adaptMarkdownComponents(newComponents, payloadMap, message2), [componentKeys, message2, payloadMap]);
2276
2204
  return /* @__PURE__ */ jsx(
2277
2205
  XMarkdown,
2278
2206
  {
@@ -3167,9 +3095,9 @@ function diffConversationMessages(messages, prevCursors) {
3167
3095
  const nextCursors = [];
3168
3096
  const pendingItems = [];
3169
3097
  for (let messageIndex = 0; messageIndex < messages.length; messageIndex += 1) {
3170
- const message3 = messages[messageIndex];
3171
- const messageId = String(message3?.messageId ?? messageIndex);
3172
- 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 : [];
3173
3101
  const prevCursor = prevCursors[messageIndex];
3174
3102
  const startIndex = prevCursor ? prevCursor.contentLength : 0;
3175
3103
  if (prevCursor && (prevCursor.messageId !== messageId || items.length < prevCursor.contentLength)) {
@@ -3200,9 +3128,9 @@ function initializeWizardSurface(state, surfaceId, effects, nextWizardSteps) {
3200
3128
  }
3201
3129
  function reduceA2uiRuntimeMessages(state, messages) {
3202
3130
  const { shouldReplayAll, pendingItems, nextCursors } = diffConversationMessages(messages || [], state.processedMessageCursors);
3203
- const itemsToProcess = shouldReplayAll ? messages.flatMap((message3, messageIndex) => {
3204
- const messageId = String(message3?.messageId ?? messageIndex);
3205
- 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 : [];
3206
3134
  return items.map((item) => ({ messageIndex, messageId, item }));
3207
3135
  }) : pendingItems;
3208
3136
  if (!shouldReplayAll && itemsToProcess.length === 0) {
@@ -3252,9 +3180,9 @@ function reduceA2uiRuntimeMessages(state, messages) {
3252
3180
  delete nextState.modelPathBySurface[surfaceId];
3253
3181
  }
3254
3182
  });
3255
- nextState.processedMessageCursors = shouldReplayAll ? messages.map((message3, messageIndex) => ({
3256
- messageId: String(message3?.messageId ?? messageIndex),
3257
- 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
3258
3186
  })) : nextCursors;
3259
3187
  nextState.wizardStepBySurface = { ...nextState.wizardStepBySurface, ...nextWizardSteps };
3260
3188
  if (deletedSurfaceIds.size) {
@@ -3591,9 +3519,9 @@ function diffMessages(messages, prevCursors) {
3591
3519
  const nextCursors = [];
3592
3520
  const pendingItems = [];
3593
3521
  for (let messageIndex = 0; messageIndex < messages.length; messageIndex += 1) {
3594
- const message3 = messages[messageIndex];
3595
- const messageId = String(message3?.messageId ?? messageIndex);
3596
- 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 : [];
3597
3525
  const prevCursor = prevCursors[messageIndex];
3598
3526
  const startIndex = prevCursor ? prevCursor.contentLength : 0;
3599
3527
  if (prevCursor && (prevCursor.messageId !== messageId || items.length < prevCursor.contentLength)) {
@@ -3624,8 +3552,8 @@ function A2uiRuntimeProvider({ messages, children }) {
3624
3552
  }, [conversationId]);
3625
3553
  React6.useEffect(() => {
3626
3554
  const { shouldReplayAll, nextCursors, pendingItems } = diffMessages(messages, processedMessageCursorsRef.current);
3627
- const itemsToProcess = shouldReplayAll ? messages.flatMap((message3) => {
3628
- const items = Array.isArray(message3?.content) ? message3.content : [];
3555
+ const itemsToProcess = shouldReplayAll ? messages.flatMap((message2) => {
3556
+ const items = Array.isArray(message2?.content) ? message2.content : [];
3629
3557
  return items.map((item) => ({ item }));
3630
3558
  }) : pendingItems;
3631
3559
  if (!shouldReplayAll && itemsToProcess.length === 0) return;
@@ -3637,9 +3565,9 @@ function A2uiRuntimeProvider({ messages, children }) {
3637
3565
  const surfaceId = extractSurfaceId3(item.command);
3638
3566
  if (surfaceId) nextLatestCommandIndexBySurface[surfaceId] = nextCommandIndex;
3639
3567
  });
3640
- processedMessageCursorsRef.current = shouldReplayAll ? messages.map((message3, messageIndex) => ({
3641
- messageId: String(message3?.messageId ?? messageIndex),
3642
- 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
3643
3571
  })) : nextCursors;
3644
3572
  latestCommandIndexBySurfaceRef.current = nextLatestCommandIndexBySurface;
3645
3573
  commandIndexRef.current = nextCommandIndex;
@@ -3924,21 +3852,21 @@ var ToolCallNode = React6.memo(({ item }) => {
3924
3852
  return /* @__PURE__ */ jsx(tool_call_item_default, { item });
3925
3853
  });
3926
3854
  var TextNode = React6.memo(
3927
- ({ item, role, customComponents, message: message3 }) => {
3855
+ ({ item, role, customComponents, message: message2 }) => {
3928
3856
  const content = toA2uiDisplayText(role, item?.messageContent);
3929
3857
  if (typeof content === "string" && content.startsWith("Question:")) {
3930
3858
  return /* @__PURE__ */ jsx(QuestionSummary, { content });
3931
3859
  }
3932
3860
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3933
3861
  !!item.reasoningContent && /* @__PURE__ */ jsx(Think, { title: "\u6DF1\u5EA6\u601D\u8003", children: item.reasoningContent }),
3934
- !!content && /* @__PURE__ */ jsx(XMarkdown_default, { message: message3, components: customComponents, content })
3862
+ !!content && /* @__PURE__ */ jsx(XMarkdown_default, { message: message2, components: customComponents, content })
3935
3863
  ] });
3936
3864
  }
3937
3865
  );
3938
3866
  var StepErrorNode = React6.memo(
3939
- ({ item, customComponents, message: message3 }) => {
3867
+ ({ item, customComponents, message: message2 }) => {
3940
3868
  if (!item.errorMessage) return null;
3941
- 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 });
3942
3870
  }
3943
3871
  );
3944
3872
  var FilesNode = React6.memo(({ item }) => {
@@ -3968,9 +3896,9 @@ var FilesNode = React6.memo(({ item }) => {
3968
3896
  }, [item.files]);
3969
3897
  return /* @__PURE__ */ jsx(FileCard.List, { items: fileItems });
3970
3898
  });
3971
- 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 }) => {
3972
3900
  const content = useMemo(() => {
3973
- return (message3.content || []).filter((item) => {
3901
+ return (message2.content || []).filter((item) => {
3974
3902
  if (!RENDERABLE_MESSAGE_TYPES.includes(item.type)) {
3975
3903
  return false;
3976
3904
  }
@@ -3982,12 +3910,12 @@ var MessageRender_default = React6.memo(({ role, message: message3, messageIndex
3982
3910
  }
3983
3911
  return true;
3984
3912
  });
3985
- }, [loading, message3.content]);
3913
+ }, [loading, message2.content]);
3986
3914
  const quoteMsg = useMemo(() => {
3987
3915
  const quoteMsg2 = {};
3988
- if (message3.params) {
3916
+ if (message2.params) {
3989
3917
  try {
3990
- const citation = JSON.parse(message3.params).citation;
3918
+ const citation = JSON.parse(message2.params).citation;
3991
3919
  if (citation) {
3992
3920
  quoteMsg2.messageContent = citation;
3993
3921
  }
@@ -3995,7 +3923,7 @@ var MessageRender_default = React6.memo(({ role, message: message3, messageIndex
3995
3923
  }
3996
3924
  }
3997
3925
  return isEmptyObj(quoteMsg2) ? null : quoteMsg2;
3998
- }, [message3.params, message3.quoteMsg]);
3926
+ }, [message2.params, message2.quoteMsg]);
3999
3927
  if (content.length === 0) return null;
4000
3928
  return /* @__PURE__ */ jsxs(Flex, { ref: containerRef, vertical: true, gap: 8, children: [
4001
3929
  content.map((item, index) => {
@@ -4009,8 +3937,8 @@ var MessageRender_default = React6.memo(({ role, message: message3, messageIndex
4009
3937
  content: /* @__PURE__ */ jsxs(Fragment, { children: [
4010
3938
  item.type === "runStarted" && /* @__PURE__ */ jsx(RunStartedNode, { loading }, `flow-start-${index}`),
4011
3939
  (item.type === "toolCall" || item.type === "toolResult") && /* @__PURE__ */ jsx(ToolCallNode, { item }, `tool-call-${item.toolCallId || index}`),
4012
- item.type === "text" && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(TextNode, { item, role: message3.role, customComponents, message: message3 }, `message-${index}`) }),
4013
- 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}`),
4014
3942
  item.type === "files" && /* @__PURE__ */ jsx(FilesNode, { item }, `files-${index}`),
4015
3943
  item.type === "plan" && /* @__PURE__ */ jsx(A2uiPlanNode, { item }, `plan-${index}`)
4016
3944
  ] })
@@ -4138,14 +4066,14 @@ var BubbleListItems_default = ({
4138
4066
  const messageRefs = useRef({});
4139
4067
  const chatRecords = useMemo(() => {
4140
4068
  const chatRecords2 = [];
4141
- conversationMessages.forEach((message3, messageIndex) => {
4142
- const role = getRole(message3.role);
4069
+ conversationMessages.forEach((message2, messageIndex) => {
4070
+ const role = getRole(message2.role);
4143
4071
  const isLeftBubble = role.user === "agent";
4144
- const isMessageLoading = !!message3.generating;
4072
+ const isMessageLoading = !!message2.generating;
4145
4073
  const showLogButton = isDebug && isLeftBubble && !isMessageLoading && isWorkFlow;
4146
- const baseKey = `${message3.executionId}-${messageIndex}`;
4074
+ const baseKey = `${message2.executionId}-${messageIndex}`;
4147
4075
  const footerNode = !isMessageLoading ? /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 8, children: [
4148
- 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" }),
4149
4077
  /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 4, children: [
4150
4078
  showLogButton && /* @__PURE__ */ jsx(
4151
4079
  Button,
@@ -4155,7 +4083,7 @@ var BubbleListItems_default = ({
4155
4083
  size: "small",
4156
4084
  icon: /* @__PURE__ */ jsx(FileTextOutlined, {}),
4157
4085
  onClick: () => {
4158
- setLogPanelOpen(true, message3.executionId);
4086
+ setLogPanelOpen(true, message2.executionId);
4159
4087
  }
4160
4088
  }
4161
4089
  ),
@@ -4178,21 +4106,21 @@ var BubbleListItems_default = ({
4178
4106
  /* @__PURE__ */ jsx(
4179
4107
  Button,
4180
4108
  {
4181
- color: message3.feedback === 1 ? "primary" : "default",
4109
+ color: message2.feedback === 1 ? "primary" : "default",
4182
4110
  size: "small",
4183
4111
  variant: "text",
4184
4112
  icon: /* @__PURE__ */ jsx(LikeOutlined, {}),
4185
- onClick: () => chatStore.feedback(message3.executionId, 1, messageIndex)
4113
+ onClick: () => chatStore.feedback(message2.executionId, 1, messageIndex)
4186
4114
  }
4187
4115
  ),
4188
4116
  /* @__PURE__ */ jsx(
4189
4117
  Button,
4190
4118
  {
4191
- color: message3.feedback === 2 ? "primary" : "default",
4119
+ color: message2.feedback === 2 ? "primary" : "default",
4192
4120
  size: "small",
4193
4121
  variant: "text",
4194
4122
  icon: /* @__PURE__ */ jsx(DislikeOutlined, {}),
4195
- onClick: () => chatStore.feedback(message3.executionId, 2, messageIndex)
4123
+ onClick: () => chatStore.feedback(message2.executionId, 2, messageIndex)
4196
4124
  }
4197
4125
  ),
4198
4126
  /* @__PURE__ */ jsx(
@@ -4200,7 +4128,7 @@ var BubbleListItems_default = ({
4200
4128
  {
4201
4129
  control: agentActions,
4202
4130
  ctx: {
4203
- message: message3,
4131
+ message: message2,
4204
4132
  get dom() {
4205
4133
  return messageRefs.current[baseKey];
4206
4134
  }
@@ -4219,7 +4147,7 @@ var BubbleListItems_default = ({
4219
4147
  MessageRender_default,
4220
4148
  {
4221
4149
  role,
4222
- message: message3,
4150
+ message: message2,
4223
4151
  messageIndex,
4224
4152
  customComponents,
4225
4153
  loading: isMessageLoading,
@@ -4503,326 +4431,6 @@ var ChatSenderHeader = () => {
4503
4431
  ] });
4504
4432
  };
4505
4433
  var ChatSenderHeader_default = ChatSenderHeader;
4506
- var MonacoEditor = ({ value = "", onChange, placeholder, height = 200, readOnly = false, style }) => {
4507
- const handleKeyDownCapture = useCallback((e) => {
4508
- if (e.key === " " || e.code === "Space") {
4509
- e.stopPropagation();
4510
- }
4511
- }, []);
4512
- const handleKeyUpCapture = useCallback((e) => {
4513
- if (e.key === " " || e.code === "Space") {
4514
- e.stopPropagation();
4515
- }
4516
- }, []);
4517
- const handleScriptChange = useCallback(
4518
- (event) => {
4519
- onChange?.(event.target.value || "");
4520
- },
4521
- [onChange]
4522
- );
4523
- return /* @__PURE__ */ jsx("div", { style, onKeyDownCapture: handleKeyDownCapture, onKeyUpCapture: handleKeyUpCapture, children: /* @__PURE__ */ jsx(
4524
- Input.TextArea,
4525
- {
4526
- value,
4527
- onChange: handleScriptChange,
4528
- readOnly,
4529
- placeholder,
4530
- autoSize: false,
4531
- style: {
4532
- height,
4533
- resize: "vertical",
4534
- fontFamily: 'Monaco, Menlo, Consolas, "Courier New", monospace',
4535
- ...style
4536
- }
4537
- }
4538
- ) });
4539
- };
4540
- var MonacoEditor_default = MonacoEditor;
4541
- var { Text: Text5 } = Typography;
4542
- var START_NODE_TYPE = "start";
4543
- var FormFileUpload = ({ value, onChange, multiple = false }) => {
4544
- const { token } = theme.useToken();
4545
- const fileList = Array.isArray(value) ? value : value ? [value] : [];
4546
- const chatStore = useChatStore();
4547
- const configState = useSnapshot(chatStore.config);
4548
- const conversationState = useSnapshot(chatStore.conversation);
4549
- const customRequest = async (options) => {
4550
- const { file, onSuccess, onError } = options;
4551
- try {
4552
- const formData = new FormData();
4553
- formData.append("file", file);
4554
- const res = await configState.services.request.chatUpload(chatStore.agent.agentInfo.id, formData, conversationState.active.id);
4555
- if (res.code === 200 && res.data?.length) {
4556
- const uploadedFile = res.data[0];
4557
- onSuccess(uploadedFile);
4558
- if (multiple) {
4559
- onChange?.([...fileList, uploadedFile]);
4560
- } else {
4561
- onChange?.([uploadedFile]);
4562
- }
4563
- } else {
4564
- message.error(res.message || "\u4E0A\u4F20\u5931\u8D25");
4565
- onError(new Error(res.message));
4566
- }
4567
- } catch (error) {
4568
- onError(error);
4569
- }
4570
- };
4571
- const handleRemove = (fileToRemove) => {
4572
- const newList = fileList.filter((f) => f.id !== fileToRemove.id);
4573
- onChange?.(newList.length > 0 ? newList : void 0);
4574
- };
4575
- return /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 12, style: { width: "100%" }, children: [
4576
- !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" }) }),
4577
- fileList.length > 0 && /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 8, children: fileList.map((file) => /* @__PURE__ */ jsxs(
4578
- Flex,
4579
- {
4580
- align: "center",
4581
- justify: "space-between",
4582
- style: {
4583
- padding: "8px 12px",
4584
- backgroundColor: token.colorFillAlter,
4585
- borderRadius: token.borderRadiusLG || 8,
4586
- border: `1px solid ${token.colorBorderSecondary}`
4587
- },
4588
- children: [
4589
- /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 12, style: { overflow: "hidden", flex: 1 }, children: [
4590
- /* @__PURE__ */ jsx(
4591
- "div",
4592
- {
4593
- style: {
4594
- width: 40,
4595
- height: 40,
4596
- backgroundColor: "#000",
4597
- borderRadius: token.borderRadiusSM || 4,
4598
- display: "flex",
4599
- alignItems: "center",
4600
- justifyContent: "center",
4601
- flexShrink: 0
4602
- },
4603
- children: /* @__PURE__ */ jsx(FileIcon, { suffix: file.extension || getFileSuffixName(file.name), fontSize: 20 })
4604
- }
4605
- ),
4606
- /* @__PURE__ */ jsxs("div", { style: { overflow: "hidden", display: "flex", flexDirection: "column", flex: 1 }, children: [
4607
- /* @__PURE__ */ jsx(Text5, { ellipsis: true, style: { width: "100%", fontSize: 14, fontWeight: 500 }, children: file.name }),
4608
- /* @__PURE__ */ jsxs(Text5, { type: "secondary", style: { fontSize: 12 }, children: [
4609
- (file.extension || getFileSuffixName(file.name)).toUpperCase(),
4610
- " \u2022 ",
4611
- formatSize(file.size, { from: "B" })
4612
- ] })
4613
- ] })
4614
- ] }),
4615
- /* @__PURE__ */ jsx(Button, { type: "text", icon: /* @__PURE__ */ jsx(DeleteOutlined, {}), onClick: () => handleRemove(file), style: { color: token.colorTextSecondary } })
4616
- ]
4617
- },
4618
- file.id || file.uid
4619
- )) })
4620
- ] });
4621
- };
4622
- var FormMonacoEditor = ({ value, onChange }) => {
4623
- const { token } = theme.useToken();
4624
- 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 }) });
4625
- };
4626
- var UserInputPanel = () => {
4627
- const chatStore = useChatStore();
4628
- const agentSnap = useSnapshot(chatStore.agent);
4629
- const flowSpecSnap = useSnapshot(flowSpecState);
4630
- const [form] = Form.useForm();
4631
- const [activeKey, setActiveKey] = useState(["1"]);
4632
- const { layout } = useSnapshot(chatStore.config);
4633
- const startNode = useMemo(() => {
4634
- return flowSpecSnap.nodes.find((n) => String(n.type || "").toLowerCase() === START_NODE_TYPE);
4635
- }, [flowSpecSnap.nodes]);
4636
- const inputs = useMemo(() => {
4637
- if (agentSnap.agentInfo.userInput?.length > 0) {
4638
- return agentSnap.agentInfo.userInput.filter((i) => i.enableEdit);
4639
- }
4640
- return (startNode?.data.input || []).filter((i) => i.enableEdit);
4641
- }, [startNode, agentSnap.agentInfo.userInput]);
4642
- useEffect(() => {
4643
- if (inputs.length > 0) {
4644
- const initialValues = inputs.reduce((acc, cur) => {
4645
- const value = cur.value;
4646
- acc[cur.name] = value;
4647
- return acc;
4648
- }, {});
4649
- form.setFieldsValue(initialValues);
4650
- }
4651
- }, [inputs, form]);
4652
- const handleValuesChange = (changedValues) => {
4653
- if (agentSnap.agentInfo.userInput?.length > 0) {
4654
- const newInput = agentSnap.agentInfo.userInput.map((v) => {
4655
- if (v.name in changedValues) {
4656
- const newValue = changedValues[v.name];
4657
- return { ...v, value: newValue };
4658
- }
4659
- return v;
4660
- });
4661
- chatStore.setAgent({ ...agentSnap.agentInfo, userInput: newInput });
4662
- return;
4663
- }
4664
- const nodeIndex = flowSpecState.nodes.findIndex((n) => n.id === startNode?.id);
4665
- if (nodeIndex > -1) {
4666
- const currentInput = flowSpecState.nodes[nodeIndex].data.input;
4667
- const newInput = currentInput.map((v) => {
4668
- if (v.name in changedValues) {
4669
- const newValue = changedValues[v.name];
4670
- return { ...v, value: newValue };
4671
- }
4672
- return v;
4673
- });
4674
- flowSpecState.nodes[nodeIndex].data.input = newInput;
4675
- }
4676
- };
4677
- const handleStartChat = () => {
4678
- form.validateFields().then(() => {
4679
- setActiveKey([]);
4680
- }).catch(() => {
4681
- message.error("\u8BF7\u68C0\u67E5\u8F93\u5165\u53C2\u6570");
4682
- });
4683
- };
4684
- const renderFormItem = (item) => {
4685
- const itemStyle = { marginBottom: 0 };
4686
- const commonProps = {
4687
- label: item.name,
4688
- name: item.name,
4689
- style: itemStyle,
4690
- rules: item.rules?.map((r) => {
4691
- const valStr = String(r.value || "");
4692
- if (r.type === "required") return { required: true, message: r.message };
4693
- if (r.type === "email") return { type: "email", message: r.message };
4694
- if (r.type === "pattern") return { pattern: new RegExp(valStr), message: r.message };
4695
- if (r.type === "max" || r.type === "min") {
4696
- return {
4697
- validator: (_, val) => {
4698
- if (val === void 0 || val === null || val === "") return Promise.resolve();
4699
- const numVal = Number(val);
4700
- if (isNaN(numVal)) return Promise.resolve();
4701
- if (r.type === "max" && numVal > Number(valStr)) return Promise.reject(new Error(r.message));
4702
- if (r.type === "min" && numVal < Number(valStr)) return Promise.reject(new Error(r.message));
4703
- return Promise.resolve();
4704
- }
4705
- };
4706
- }
4707
- if (r.type === "length") {
4708
- const [min, max] = valStr.split(",").map((v) => v ? Number(v) : void 0);
4709
- return {
4710
- validator: (_, val) => {
4711
- if (val === void 0 || val === null || val === "") return Promise.resolve();
4712
- const strVal = String(val);
4713
- if (min !== void 0 && strVal.length < min) return Promise.reject(new Error(r.message));
4714
- if (max !== void 0 && strVal.length > max) return Promise.reject(new Error(r.message));
4715
- return Promise.resolve();
4716
- }
4717
- };
4718
- }
4719
- if (r.type === "size") {
4720
- const [min, max] = valStr.split(",").map((v) => v ? Number(v) : void 0);
4721
- return {
4722
- validator: (_, val) => {
4723
- if (val === void 0 || val === null || val === "") return Promise.resolve();
4724
- let len = 0;
4725
- if (Array.isArray(val)) {
4726
- len = val.length;
4727
- } else if (typeof val === "string") {
4728
- try {
4729
- const parsed = JSON.parse(val);
4730
- if (Array.isArray(parsed)) len = parsed.length;
4731
- else return Promise.resolve();
4732
- } catch (e) {
4733
- return Promise.resolve();
4734
- }
4735
- } else {
4736
- return Promise.resolve();
4737
- }
4738
- if (min !== void 0 && len < min) return Promise.reject(new Error(r.message));
4739
- if (max !== void 0 && len > max) return Promise.reject(new Error(r.message));
4740
- return Promise.resolve();
4741
- }
4742
- };
4743
- }
4744
- if (r.type === "enum") {
4745
- const options = valStr.split(",").map((s) => s.trim());
4746
- return {
4747
- validator: (_, val) => {
4748
- if (val === void 0 || val === null || val === "") return Promise.resolve();
4749
- if (options.includes(String(val))) return Promise.resolve();
4750
- return Promise.reject(new Error(r.message));
4751
- }
4752
- };
4753
- }
4754
- return {};
4755
- })
4756
- };
4757
- if (["STRING", "LONG"].includes(item.type)) {
4758
- return /* @__PURE__ */ jsx(Form.Item, { ...commonProps, children: /* @__PURE__ */ jsx(Input, { placeholder: "\u8BF7\u8F93\u5165\u503C" }) });
4759
- }
4760
- if (["NUMBER"].includes(item.type)) {
4761
- return /* @__PURE__ */ jsx(Form.Item, { ...commonProps, children: /* @__PURE__ */ jsx(InputNumber, { style: { width: "100%" }, placeholder: "\u8BF7\u8F93\u5165\u6570\u503C" }) });
4762
- }
4763
- if (item.type === "BOOLEAN") {
4764
- return /* @__PURE__ */ jsx(Form.Item, { style: itemStyle, name: item.name, valuePropName: "checked", children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", children: [
4765
- /* @__PURE__ */ jsx("span", { children: item.name }),
4766
- /* @__PURE__ */ jsx(Switch$1, { size: "small" })
4767
- ] }) });
4768
- }
4769
- if (item.type === "FILE") {
4770
- return /* @__PURE__ */ jsx(Form.Item, { ...commonProps, children: /* @__PURE__ */ jsx(FormFileUpload, { multiple: false }) });
4771
- }
4772
- if (item.type === "ARRAY_FILE") {
4773
- return /* @__PURE__ */ jsx(Form.Item, { ...commonProps, children: /* @__PURE__ */ jsx(FormFileUpload, { multiple: true }) });
4774
- }
4775
- if (["OBJECT", "ARRAY", "ARRAY_STRING", "ARRAY_NUMBER", "ARRAY_DECIMAL", "ARRAY_BOOLEAN", "ARRAY_OBJECT"].includes(item.type)) {
4776
- return /* @__PURE__ */ jsx(Form.Item, { ...commonProps, children: /* @__PURE__ */ jsx(FormMonacoEditor, {}) });
4777
- }
4778
- return /* @__PURE__ */ jsx(Form.Item, { ...commonProps, children: /* @__PURE__ */ jsx(Input, { placeholder: "\u8BF7\u8F93\u5165\u503C" }) });
4779
- };
4780
- const genExtra = () => {
4781
- if (activeKey.includes("1")) return null;
4782
- return /* @__PURE__ */ jsx(
4783
- Button,
4784
- {
4785
- type: "text",
4786
- size: "small",
4787
- onClick: (e) => {
4788
- e.stopPropagation();
4789
- setActiveKey(["1"]);
4790
- },
4791
- children: "\u7F16\u8F91"
4792
- }
4793
- );
4794
- };
4795
- const items = [
4796
- {
4797
- key: "1",
4798
- label: "\u53C2\u6570\u8BBE\u7F6E",
4799
- extra: genExtra(),
4800
- children: /* @__PURE__ */ jsxs(Fragment, { children: [
4801
- /* @__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" }) }),
4802
- /* @__PURE__ */ jsx(Flex, { align: "center", justify: "center", className: "m-t-16", children: /* @__PURE__ */ jsx(Button, { type: "primary", onClick: handleStartChat, children: "\u5F00\u59CB\u4F1A\u8BDD" }) })
4803
- ] })
4804
- }
4805
- ];
4806
- return /* @__PURE__ */ jsx("div", { className: styles_module_default2.userInputCollapse, children: /* @__PURE__ */ jsx(
4807
- Collapse,
4808
- {
4809
- activeKey,
4810
- onChange: (keys) => {
4811
- const newKeys = typeof keys === "string" ? [keys] : keys;
4812
- setActiveKey(newKeys);
4813
- },
4814
- items,
4815
- className: "m-16",
4816
- styles: {
4817
- body: {
4818
- paddingRight: 0,
4819
- paddingBottom: 10
4820
- }
4821
- }
4822
- }
4823
- ) });
4824
- };
4825
- var UserInputPanel_default = UserInputPanel;
4826
4434
 
4827
4435
  // src/ui/layouts/components/styles.module.less
4828
4436
  var styles_module_default5 = {
@@ -4847,11 +4455,10 @@ var ChatMainPanel = memo(
4847
4455
  []
4848
4456
  );
4849
4457
  const configState = useSnapshot(chatStore.config);
4850
- const agentState = useSnapshot(chatStore.agent);
4458
+ useSnapshot(chatStore.agent);
4851
4459
  return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames2("height-full"), children: [
4852
4460
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
4853
4461
  /* @__PURE__ */ jsxs(Flex, { justify: "center", align: "center", vertical: true, gap: 24, className: classNames2("height-full", styles_module_default5.bodyWidth), children: [
4854
- shouldRender(agentState.agentInfo.userInput && agentState.agentInfo.userInput.length > 0) && /* @__PURE__ */ jsx(RenderWrapper, { DefaultComponent: UserInputPanel_default }),
4855
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 }) }),
4856
4463
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.senderHeader, DefaultComponent: /* @__PURE__ */ jsx(ChatSenderHeader_default, {}) }),
4857
4464
  /* @__PURE__ */ jsxs(Flex, { className: styles_module_default5.inputContainer, vertical: true, gap: 8, children: [
@@ -4921,7 +4528,7 @@ var index_module_default2 = {
4921
4528
  animatedSplitter: "index_module_animatedSplitter",
4922
4529
  hideSplitterBar: "index_module_hideSplitterBar"
4923
4530
  };
4924
- 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) => {
4925
4532
  const chatStore = useMemo(() => createChatStore(), []);
4926
4533
  const senderRef = useRef(null);
4927
4534
  useImperativeHandle(
@@ -4970,11 +4577,6 @@ var layouts_default = forwardRef(({ theme: theme4, params, hooks, layout, config
4970
4577
  chatStore.setAgent({ ...agentState.agentInfo, config: config.agent.config || {} });
4971
4578
  }
4972
4579
  }, [agentState.agentInfo.id, config.agent?.config]);
4973
- useDeepEffect(() => {
4974
- if (agentState.agentInfo.id) {
4975
- chatStore.setUserInput(config.agent.userInput);
4976
- }
4977
- }, [agentState.agentInfo.id, config.agent?.userInput]);
4978
4580
  useDeepEffect(() => {
4979
4581
  if (config?.agent?.id) {
4980
4582
  chatStore.getAgentInfo(config.agent.id);
@@ -5001,20 +4603,20 @@ var layouts_default = forwardRef(({ theme: theme4, params, hooks, layout, config
5001
4603
  }, [hasPreView]);
5002
4604
  useWebSocket({
5003
4605
  url: configState.services.websocketUrls?.[0],
5004
- onMessage: (message3) => chatStore.acceptMessage(message3.payload),
4606
+ onMessage: (message2) => chatStore.acceptMessage(message2.payload),
5005
4607
  clientHeartbeat: false,
5006
4608
  reconnectInterval: 1e4
5007
4609
  });
5008
4610
  useWebSocket({
5009
4611
  url: configState.services.websocketUrls?.[1],
5010
- onMessage: (message3) => chatStore.acceptMessage(message3.payload),
4612
+ onMessage: (message2) => chatStore.acceptMessage(message2.payload),
5011
4613
  clientHeartbeat: false,
5012
4614
  reconnectInterval: 1e4
5013
4615
  });
5014
4616
  useEffect(() => {
5015
4617
  hooks?.onBeforeInit?.();
5016
4618
  }, []);
5017
- 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: [
5018
4620
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
5019
4621
  /* @__PURE__ */ jsxs(Flex, { ref: containerRef, className: "full-scroll", children: [
5020
4622
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.leftPanel }),