style(web): translate the comments in the src/views directory into English

This commit is contained in:
zhaoying
2026-02-03 18:38:04 +08:00
parent a191e32f71
commit 9e195ea63b
155 changed files with 4169 additions and 586 deletions

View File

@@ -1,3 +1,14 @@
/*
* @Author: ZhaoYing
* @Date: 2026-02-03 17:33:22
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-03 17:33:22
*/
/**
* Memory Form Component
* Modal form for creating and editing memory configurations
*/
import { forwardRef, useImperativeHandle, useState } from 'react';
import { Form, Input, App } from 'antd';
import { useTranslation } from 'react-i18next';
@@ -10,6 +21,9 @@ import CustomSelect from '@/components/CustomSelect';
const FormItem = Form.Item;
/**
* Component props
*/
interface MemoryFormProps {
refresh: () => void;
}
@@ -26,7 +40,7 @@ const MemoryForm = forwardRef<MemoryFormRef, MemoryFormProps>(({
const values = Form.useWatch([], form);
// 封装取消方法,添加关闭弹窗逻辑
/** Close modal and reset form */
const handleClose = () => {
setVisible(false);
setEditingMemory(null);
@@ -34,10 +48,11 @@ const MemoryForm = forwardRef<MemoryFormRef, MemoryFormProps>(({
setLoading(false);
};
/** Open modal with optional data */
const handleOpen = (memory?: Memory | null) => {
if (memory) {
setEditingMemory(memory);
// 设置表单值
/** Set form values */
form.setFieldsValue({
config_name: memory.config_name,
config_desc: memory.config_desc,
@@ -48,7 +63,7 @@ const MemoryForm = forwardRef<MemoryFormRef, MemoryFormProps>(({
}
setVisible(true);
};
// 封装保存方法,添加提交逻辑
/** Save configuration */
const handleSave = () => {
form
.validateFields()
@@ -73,7 +88,7 @@ const MemoryForm = forwardRef<MemoryFormRef, MemoryFormProps>(({
});
}
// 暴露给父组件的方法
/** Expose methods to parent component */
useImperativeHandle(ref, () => ({
handleOpen,
handleClose

View File

@@ -1,15 +1,27 @@
/*
* @Author: ZhaoYing
* @Date: 2026-02-03 17:33:15
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-03 17:33:15
*/
/**
* Memory Management Page
* Manages memory configurations with extraction, forgetting, emotion, and reflection engines
* Displays configuration cards with navigation to engine settings
*/
import React, { useState, useEffect, useRef } from 'react';
import { List, Button, Space, App, Tooltip } from 'antd';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import clsx from 'clsx'
import MemoryForm from './components/MemoryForm';
import type { Memory, MemoryFormRef } from '@/views/MemoryManagement/types'
import RbCard from '@/components/RbCard/Card'
// import StatusTag from '@/components/StatusTag'
import { getMemoryConfigList, deleteMemoryConfig } from '@/api/memory'
import BodyWrapper from '@/components/Empty/BodyWrapper'
import { formatDateTime } from '@/utils/format';
import clsx from 'clsx'
import RbAlert from '@/components/RbAlert'
const MemoryManagement: React.FC = () => {
@@ -25,6 +37,7 @@ const MemoryManagement: React.FC = () => {
loadMoreData()
}, []);
/** Load configuration list */
const loadMoreData = () => {
setLoading(true);
getMemoryConfigList()
@@ -41,10 +54,11 @@ const MemoryManagement: React.FC = () => {
});
};
// 打开新增标签弹窗
/** Open create/edit modal */
const handleEdit = (config?: Memory) => {
memoryFormRef.current?.handleOpen(config);
}
/** Delete configuration */
const handleDelete = (item: Memory) => {
modal.confirm({
title: t('common.confirmDeleteDesc', { name: item.config_name }),
@@ -61,6 +75,7 @@ const MemoryManagement: React.FC = () => {
})
};
/** Navigate to engine configuration page */
const handleClick = (id: number, type: string) => {
switch (type) {
case 'memoryExtractionEngine':

View File

@@ -1,4 +1,12 @@
// 内存管理表单数据类型
/*
* @Author: ZhaoYing
* @Date: 2026-02-03 17:33:01
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-03 17:33:24
*/
/**
* Memory management form data type
*/
export interface MemoryFormData {
config_id?: number;
config_name: string;
@@ -6,7 +14,9 @@ export interface MemoryFormData {
scene_id?: string;
}
// 内存数据类型
/**
* Memory configuration data type
*/
export interface Memory {
config_id: number;
config_name: string;
@@ -34,7 +44,9 @@ export interface Memory {
scene_name: string;
[key: string]: string | number | boolean;
}
// 定义组件暴露的方法接口
/**
* Component exposed methods interface
*/
export interface MemoryFormRef {
handleOpen: (memory?: Memory | null) => void;
}