feat(web): use memory_config_id replace memory_content

This commit is contained in:
zhaoying
2026-02-06 11:28:19 +08:00
parent 0c3960eb0b
commit 623aaf8a0e
3 changed files with 10 additions and 10 deletions

View File

@@ -2,7 +2,7 @@
* @Author: ZhaoYing
* @Date: 2026-02-03 16:29:21
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-04 20:16:45
* @Last Modified time: 2026-02-06 11:20:14
*/
import { type FC, type ReactNode, useEffect, useRef, useState, forwardRef, useImperativeHandle } from 'react';
import clsx from 'clsx'
@@ -38,8 +38,8 @@ import CustomSelect from '@/components/CustomSelect'
import aiPrompt from '@/assets/images/application/aiPrompt.png'
import AiPromptModal from './components/AiPromptModal'
import ToolList from './components/ToolList/ToolList'
import ChatVariableConfigModal from './components/ChatVariableConfigModal';
import SkillList from './components/Skill'
import ChatVariableConfigModal from './components/ChatVariableConfigModal';
import type { Skill } from '@/views/Skills/types'
/**
@@ -169,7 +169,7 @@ const Agent = forwardRef<AgentRef>((_props, ref) => {
const { skills } = response
let allSkills = Array.isArray(skills?.skill_ids) ? skills?.skill_ids.map(vo => ({ id: vo })) : []
let allTools = Array.isArray(response.tools) ? response.tools : []
const memoryContent = response.memory?.memory_content
const memoryContent = response.memory?.memory_config_id
const parsedMemoryContent = memoryContent === null || memoryContent === ''
? undefined
: !isNaN(Number(memoryContent)) ? Number(memoryContent) : memoryContent
@@ -178,7 +178,7 @@ const Agent = forwardRef<AgentRef>((_props, ref) => {
tools: allTools,
memory: {
...response.memory,
memory_content: parsedMemoryContent
memory_config_id: parsedMemoryContent
},
skills: {
...skills,
@@ -262,7 +262,7 @@ const Agent = forwardRef<AgentRef>((_props, ref) => {
if (!isSave || !data) return Promise.resolve()
const { memory, knowledge_retrieval, tools, skills, ...rest } = values
const { knowledge_bases = [], ...knowledgeRest } = knowledge_retrieval || {}
const { memory_content } = memory || {}
const { memory_config_id } = memory || {}
// Get other necessary properties of memory from original data
const originalMemory = data.memory || ({} as MemoryConfig)
@@ -272,7 +272,7 @@ const Agent = forwardRef<AgentRef>((_props, ref) => {
memory: {
...originalMemory,
...memory,
memory_content: memory_content ? String(memory_content) : '',
memory_config_id: memory_config_id ? String(memory_config_id) : '',
},
knowledge_retrieval: knowledge_bases.length > 0 ? {
...data.knowledge_retrieval,
@@ -444,7 +444,7 @@ const Agent = forwardRef<AgentRef>((_props, ref) => {
<SelectWrapper
title="selectMemoryContent"
desc="selectMemoryContentDesc"
name={['memory', 'memory_content']}
name={['memory', 'memory_config_id']}
url={memoryConfigListUrl}
/>
</Space>

View File

@@ -39,7 +39,7 @@ const processObj = [
* @param value - Current skill configuration values
* @param onChange - Callback function when configuration changes
*/
const Skill: FC<{value?: SkillConfigForm; onChange?: (config: SkillConfigForm) => void}> = () => {
const SkillList: FC<{value?: SkillConfigForm; onChange?: (config: SkillConfigForm) => void}> = () => {
const { t } = useTranslation()
const form = Form.useFormInstance()
const skillConfig = Form.useWatch(['skills'], form)
@@ -148,4 +148,4 @@ const Skill: FC<{value?: SkillConfigForm; onChange?: (config: SkillConfigForm) =
</Card>
)
}
export default Skill
export default SkillList

View File

@@ -43,7 +43,7 @@ export interface MemoryConfig {
/** Whether memory is enabled */
enabled: boolean;
/** Memory content */
memory_content?: string;
memory_config_id?: string;
/** Maximum history length */
max_history?: number | string;
}