fix(web): agent's variables init update

This commit is contained in:
zhaoying
2026-03-03 11:15:14 +08:00
parent f39c77ac70
commit 45a64dbbac

View File

@@ -2,7 +2,7 @@
* @Author: ZhaoYing * @Author: ZhaoYing
* @Date: 2026-02-03 16:29:21 * @Date: 2026-02-03 16:29:21
* @Last Modified by: ZhaoYing * @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-25 18:11:49 * @Last Modified time: 2026-03-03 11:14:30
*/ */
import { type FC, type ReactNode, useEffect, useRef, useState, forwardRef, useImperativeHandle } from 'react'; import { type FC, type ReactNode, useEffect, useRef, useState, forwardRef, useImperativeHandle } from 'react';
import clsx from 'clsx' import clsx from 'clsx'
@@ -175,6 +175,10 @@ const Agent = forwardRef<AgentRef>((_props, ref) => {
const parsedMemoryContent = memoryContent === null || memoryContent === '' const parsedMemoryContent = memoryContent === null || memoryContent === ''
? undefined ? undefined
: !isNaN(Number(memoryContent)) ? Number(memoryContent) : memoryContent : !isNaN(Number(memoryContent)) ? Number(memoryContent) : memoryContent
const variableList = variables?.map((item, index) => ({
...item,
index
})) || []
form.setFieldsValue({ form.setFieldsValue({
...response, ...response,
tools: allTools, tools: allTools,
@@ -185,9 +189,10 @@ const Agent = forwardRef<AgentRef>((_props, ref) => {
skills: { skills: {
...skills, ...skills,
skill_ids: allSkills skill_ids: allSkills
} },
variables: [...variableList]
}) })
updateVariableList([...variables]) updateVariableList([...variableList])
setData({ setData({
...response, ...response,
tools: allTools tools: allTools