Merge pull request #376 from SuanmoSuanyangTechnology/fix/release_web_zy
feat(web): memory-write add messages config
This commit is contained in:
@@ -2105,7 +2105,7 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re
|
||||
search_switch: 'Search Mode',
|
||||
},
|
||||
'memory-write': {
|
||||
message: 'Message',
|
||||
messages: 'Message',
|
||||
config_id: 'Memory Configuration',
|
||||
search_switch: 'Search Mode',
|
||||
},
|
||||
|
||||
@@ -2200,7 +2200,7 @@ export const zh = {
|
||||
search_switch: '检索模式',
|
||||
},
|
||||
'memory-write': {
|
||||
message: '消息',
|
||||
messages: '消息',
|
||||
config_id: '记忆配置',
|
||||
search_switch: '检索模式',
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @Author: ZhaoYing
|
||||
* @Date: 2026-02-03 15:39:59
|
||||
* @Last Modified by: ZhaoYing
|
||||
* @Last Modified time: 2026-02-05 14:21:45
|
||||
* @Last Modified time: 2026-02-09 19:56:42
|
||||
*/
|
||||
import { type FC, useEffect, useState, useMemo } from "react";
|
||||
import clsx from 'clsx'
|
||||
@@ -491,7 +491,7 @@ const Properties: FC<PropertiesProps> = ({
|
||||
|
||||
if (config.type === 'messageEditor') {
|
||||
return (
|
||||
<Form.Item key={key} name={key}>
|
||||
<Form.Item key={key} name={key} label={selectedNode?.data?.type === 'memory-write' ? t(`workflow.config.${selectedNode?.data?.type}.${key}`) : undefined }>
|
||||
<MessageEditor
|
||||
title={t(`workflow.config.${selectedNode?.data?.type}.${key}`)}
|
||||
isArray={!!config.isArray}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @Author: ZhaoYing
|
||||
* @Date: 2026-02-03 15:06:18
|
||||
* @Last Modified by: ZhaoYing
|
||||
* @Last Modified time: 2026-02-05 14:15:13
|
||||
* @Last Modified time: 2026-02-09 20:08:03
|
||||
*/
|
||||
import LoopNode from './components/Nodes/LoopNode';
|
||||
import NormalNode from './components/Nodes/NormalNode';
|
||||
@@ -242,6 +242,12 @@ export const nodeLibrary: NodeLibrary[] = [
|
||||
type: 'editor',
|
||||
isArray: false
|
||||
},
|
||||
messages: {
|
||||
type: 'messageEditor',
|
||||
defaultValue: [],
|
||||
placeholder: 'workflow.config.llm.messagesPlaceholder',
|
||||
isArray: true
|
||||
},
|
||||
config_id: {
|
||||
type: 'customSelect',
|
||||
url: memoryConfigListUrl,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* @Author: ZhaoYing
|
||||
* @Date: 2026-02-03 15:17:48
|
||||
* @Last Modified by: ZhaoYing
|
||||
* @Last Modified time: 2026-02-03 15:17:48
|
||||
* @Last Modified by: ZhaoYing
|
||||
* @Last Modified time: 2026-02-09 20:05:04
|
||||
*/
|
||||
import { useRef, useEffect, useState } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
@@ -135,7 +135,10 @@ export const useWorkflowGraph = ({
|
||||
|
||||
if (nodeLibraryConfig?.config) {
|
||||
Object.keys(nodeLibraryConfig.config).forEach(key => {
|
||||
if (key === 'memory' && nodeLibraryConfig.config && nodeLibraryConfig.config[key]) {
|
||||
if (type === 'memory-write' && key === 'message' && nodeLibraryConfig.config) {
|
||||
nodeLibraryConfig.config['messages'].defaultValue = [{ role: 'USER', content: config[key] }]
|
||||
delete nodeLibraryConfig.config[key]
|
||||
} else if (key === 'memory' && nodeLibraryConfig.config && nodeLibraryConfig.config[key]) {
|
||||
const { memory, messages } = config as any;
|
||||
if (memory?.enable && messages && messages.length > 0) {
|
||||
const lastMessage = messages[messages.length - 1]
|
||||
|
||||
Reference in New Issue
Block a user