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

This commit is contained in:
zhaoying
2026-02-04 10:27:27 +08:00
parent 9e195ea63b
commit 7e650d86a5
24 changed files with 115 additions and 995 deletions

View File

@@ -2153,6 +2153,7 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re
resilience: 'Resilience',
suggestions: 'Personalized Suggestions',
suggestionLoading: 'Your personalized suggestions are being generated',
item: 'item',
},
reflectionEngine: {
reflectionEngineConfig: 'Reflection Engine Configuration',

View File

@@ -2242,6 +2242,7 @@ export const zh = {
resilience: '恢复力',
suggestions: '个性化建议',
suggestionLoading: '您的个性化建议正在生成中',
item: '个',
},
reflectionEngine: {
reflectionEngineConfig: '反思引擎配置',

View File

@@ -2,7 +2,7 @@
* @Author: ZhaoYing
* @Date: 2026-02-03 15:52:44
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-03 15:54:22
* @Last Modified time: 2026-02-04 10:00:02
*/
import { forwardRef, useImperativeHandle, useState } from 'react';
import { Switch, Button, Tooltip } from 'antd';
@@ -106,7 +106,6 @@ const ApiKeyDetailModal = forwardRef<ApiKeyModalRef, { handleCopy: (content: str
</span>
</div>
{/* 高级设置 */}
{data.expires_at && <>
<div className="rb:text-[#5B6167] rb:font-medium rb:leading-5 rb:my-4">{t('apiKey.advancedSettings')}</div>

View File

@@ -1,8 +1,8 @@
/*
* @Author: ZhaoYing
* @Date: 2026-02-03 15:52:47
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-03 15:52:47
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-04 10:00:01
*/
import { forwardRef, useImperativeHandle, useState } from 'react';
import { Form, Input, Switch, App, DatePicker } from 'antd';
@@ -162,7 +162,6 @@ const ApiKeyModal = forwardRef<ApiKeyModalRef, CreateModalProps>(({
<Switch />
</FormItem>
{/* 高级设置 */}
<div className="rb:text-[#5B6167] rb:font-medium rb:leading-5 rb:mb-4">{t('apiKey.advancedSettings')}</div>
<FormItem

View File

@@ -255,7 +255,7 @@ const Agent = forwardRef<AgentRef>((_props, ref) => {
const { memory, knowledge_retrieval, tools, ...rest } = values
const { knowledge_bases = [], ...knowledgeRest } = knowledge_retrieval || {}
const { memory_content } = memory || {}
// 从原数据中获取memory的其他必要属性
// Get other necessary properties of memory from original data
const originalMemory = data.memory || ({} as MemoryConfig)
const params: Config = {
@@ -425,7 +425,7 @@ const Agent = forwardRef<AgentRef>((_props, ref) => {
<Knowledge />
</Form.Item>
{/* 记忆配置 */}
{/* Memory Configuration */}
<Card title={t('application.memoryConfiguration')}>
<Space size={24} direction='vertical' style={{ width: '100%' }}>
<SwitchWrapper title="dialogueHistoricalMemory" desc="dialogueHistoricalMemoryDesc" name={['memory', 'enabled']} />
@@ -442,7 +442,7 @@ const Agent = forwardRef<AgentRef>((_props, ref) => {
<VariableList />
</Form.Item>
{/* 工具配置 */}
{/* Tool Configuration */}
<Form.Item name="tools">
<ToolList />
</Form.Item>

View File

@@ -162,7 +162,7 @@ const Api: FC<{ application: Application | null }> = ({ application }) => {
}
>
<div className="rb:text-[#5B6167] rb:text-[12px] rb:mb-2">{t('application.apiKeySubTitle')}</div>
{/* 总览数据 */}
{/* Overview Data */}
<Row>
<Col span={6}>
<Statistic title={t('application.apiKeyTotal')} value={apiKeyList.length} />
@@ -171,7 +171,7 @@ const Api: FC<{ application: Application | null }> = ({ application }) => {
<Statistic title={t('application.apiKeyRequestTotal')} value={totalRequests} />
</Col>
</Row>
{/* API Key 列表 */}
{/* API Key List */}
{apiKeyList.sort((a, b) => b.created_at - a.created_at).map(item => (
<div key={item.id} className="rb:mt-4 rb:p-[10px_12px] rb:bg-[#F0F3F8] rb:border rb:border-[#DFE4ED] rb:rounded-lg">
<div className="rb:flex rb:items-center rb:justify-between">

View File

@@ -146,7 +146,7 @@ const ReleasePage: FC<{data: Application; refresh: () => void}> = ({data, refres
</div>
</RbCard>
{/* 日志 */}
{/* Logs */}
<RbCard title={t('application.changeLog')} headerType="borderless">
<Space size={16} direction="vertical" style={{ width: '100%' }}>
{selectedVersion && (

View File

@@ -69,7 +69,7 @@ const theme = {
const EditorContent = forwardRef<EditorRef, LexicalEditorProps>(({
className = '',
value,
placeholder = "请输入内容...",
placeholder = "Please enter content...",
onChange,
}, ref) => {
const [editor] = useLexicalComposerContext();

View File

@@ -137,7 +137,7 @@ const VariableEditModal = forwardRef<VariableEditModalRef, VariableEditModalProp
layout="vertical"
scrollToFirstError={{ behavior: 'instant', block: 'end', focus: true }}
>
{/* 变量类型 */}
{/* Variable Type */}
<FormItem
name="type"
label={t('application.variableType')}
@@ -154,7 +154,7 @@ const VariableEditModal = forwardRef<VariableEditModalRef, VariableEditModalProp
optionRender={(props) => <div className="rb:flex rb:justify-between rb:items-center">{props.label} <Tag color="blue">{variableType[props.value as keyof typeof variableType]}</Tag></div>}
/>
</FormItem>
{/* 变量名称 */}
{/* Variable Name */}
<FormItem
name="name"
label={t('application.variableName')}
@@ -172,7 +172,7 @@ const VariableEditModal = forwardRef<VariableEditModalRef, VariableEditModalProp
}}
/>
</FormItem>
{/* 显示名称 */}
{/* Display Name */}
<FormItem
name="display_name"
label={t('application.displayName')}
@@ -180,14 +180,14 @@ const VariableEditModal = forwardRef<VariableEditModalRef, VariableEditModalProp
>
<Input placeholder={t('common.enter')} />
</FormItem>
{/* 描述 */}
{/* Description */}
<FormItem
name="description"
label={t('application.description')}
>
<Input placeholder={t('common.enter')} />
</FormItem>
{/* 最大长度 */}
{/* Max Length */}
{['text', 'paragraph'].includes(values?.type) && (
<FormItem
name="max_length"
@@ -196,7 +196,7 @@ const VariableEditModal = forwardRef<VariableEditModalRef, VariableEditModalProp
<InputNumber placeholder={t('common.enter')} style={{ width: '100%' }} />
</FormItem>
)}
{/* 默认值 */}
{/* Default Value */}
{/* {['text', 'paragraph', 'number', 'checkbox'].includes(values?.type) && (
<FormItem
name="default_value"
@@ -208,7 +208,7 @@ const VariableEditModal = forwardRef<VariableEditModalRef, VariableEditModalProp
{['checkbox'].includes(values.type) && <Select options={[{ value: true, label: t('application.defaultChecked') }, { value: false, label: t('application.notDefaultChecked') }]} />}
</FormItem>
)} */}
{/* 选项 */}
{/* Options */}
{['dropdownOptions'].includes(values?.type) && (
<FormItem
name="options"
@@ -217,7 +217,7 @@ const VariableEditModal = forwardRef<VariableEditModalRef, VariableEditModalProp
<SortableList />
</FormItem>
)}
{/* API 扩展 */}
{/* API Extension */}
{['apiVariable'].includes(values?.type) && (
<FormItem
name="api_extension"
@@ -237,14 +237,14 @@ const VariableEditModal = forwardRef<VariableEditModalRef, VariableEditModalProp
/>
</FormItem>
)}
{/* 是否必填 */}
{/* Required */}
<FormItem
name="required"
valuePropName="checked"
>
<Checkbox>{t('application.required')}</Checkbox>
</FormItem>
{/* 是否隐藏 */}
{/* Hidden */}
{/* <FormItem
name="hidden"
valuePropName="checked"

View File

@@ -1,8 +1,8 @@
/*
* @Author: ZhaoYing
* @Date: 2026-02-03 17:00:20
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-03 17:00:20
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-04 10:03:35
*/
/**
* Line Chart Component
@@ -126,7 +126,6 @@ const LineChart: FC<LineCardProps> = ({ config }) => {
}, [t])
useEffect(() => {
// 语言切换时重新生成数据
if (config) {
getCaculateData(config)
}

View File

@@ -1,8 +1,8 @@
/*
* @Author: ZhaoYing
* @Date: 2026-02-03 16:37:12
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-03 16:37:12
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-04 10:05:39
*/
/**
* Invite Register Page
@@ -211,7 +211,7 @@ const InviteRegister: React.FC = () => {
}
const { error } = validatePasswordStrength(value);
if (error && value.length >= 8) {
return Promise.resolve(); // 强度提示但不阻止提交
return Promise.resolve();
} else if (error) {
return Promise.reject(new Error(error));
}

View File

@@ -1,8 +1,8 @@
/*
* @Author: ZhaoYing
* @Date: 2026-02-03 17:30:11
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-03 17:30:11
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-04 10:08:49
*/
/**
* Result Component
@@ -91,20 +91,20 @@ const Result: FC<ResultProps> = ({ loading, handleSave }) => {
list.forEach((data: AnyObject) => {
switch(data.event) {
case 'text_preprocessing': // 开始预处理文本
case 'text_preprocessing': // Start text preprocessing
setTextPreprocessing(prev => ({
...prev,
status: 'processing',
start_at: data.data.time
}))
break
case 'text_preprocessing_result': // 预处理文本分块中
case 'text_preprocessing_result': // Text preprocessing in progress
setTextPreprocessing(prev => ({
...prev,
data: [...prev.data, data.data?.data]
}))
break
case 'text_preprocessing_complete': // 预处理文本完成
case 'text_preprocessing_complete': // Text preprocessing complete
setTextPreprocessing(prev => ({
...prev,
result: data.data?.data,
@@ -112,20 +112,20 @@ const Result: FC<ResultProps> = ({ loading, handleSave }) => {
end_at: data.data.time
}))
break
case 'knowledge_extraction': // 开始知识抽取
case 'knowledge_extraction': // Start knowledge extraction
setKnowledgeExtraction(prev => ({
...prev,
status: 'processing',
start_at: data.data.time
}))
break
case 'knowledge_extraction_result': // 知识抽取中
case 'knowledge_extraction_result': // Knowledge extraction in progress
setKnowledgeExtraction(prev => ({
...prev,
data: [...prev.data, data.data?.data]
}))
break
case 'knowledge_extraction_complete': // 知识抽取完成
case 'knowledge_extraction_complete': // Knowledge extraction complete
setKnowledgeExtraction(prev => ({
...prev,
result: data.data?.data,
@@ -133,20 +133,20 @@ const Result: FC<ResultProps> = ({ loading, handleSave }) => {
end_at: data.data.time
}))
break
case 'creating_nodes_edges': // 开始创建节点和边
case 'creating_nodes_edges': // Start creating nodes and edges
setCreatingNodesEdges(prev => ({
...prev,
status: 'processing',
start_at: data.data.time
}))
break
case 'creating_nodes_edges_result': // 创建节点和边中
case 'creating_nodes_edges_result': // Creating nodes and edges in progress
setCreatingNodesEdges(prev => ({
...prev,
data: [...prev.data, data.data?.data]
}))
break
case 'creating_nodes_edges_complete': // 创建节点和边完成
case 'creating_nodes_edges_complete': // Creating nodes and edges complete
setCreatingNodesEdges(prev => ({
...prev,
result: data.data?.data,
@@ -154,20 +154,20 @@ const Result: FC<ResultProps> = ({ loading, handleSave }) => {
end_at: data.data.time
}))
break
case 'deduplication': // 开始去重消歧
case 'deduplication': // Start deduplication and disambiguation
setDeduplication(prev => ({
...prev,
status: 'processing',
start_at: data.data.time
}))
break
case 'dedup_disambiguation_result': // 去重消歧中
case 'dedup_disambiguation_result': // Deduplication and disambiguation in progress
setDeduplication(prev => ({
...prev,
data: [...prev.data, data.data.data]
}))
break
case 'dedup_disambiguation_complete': // 去重消歧完成
case 'dedup_disambiguation_complete': // Deduplication and disambiguation complete
setDeduplication(prev => ({
...prev,
result: data.data?.data,
@@ -175,9 +175,9 @@ const Result: FC<ResultProps> = ({ loading, handleSave }) => {
end_at: data.data.time
}))
break
case 'generating_results': // 开始生成结果
case 'generating_results': // Generating results
break
case 'result': // 结果
case 'result': // Result
setTestResult(data.data?.extracted_result)
break
}
@@ -228,7 +228,7 @@ const Result: FC<ResultProps> = ({ loading, handleSave }) => {
<RbAlert color="blue" icon={<ExclamationCircleFilled />} className="rb:mb-3.5">
{t('memoryExtractionEngine.processing')}
</RbAlert>
{/* 整体进度 */}
{/* Overall Progress */}
<div className="rb:mb-2">
<div className="rb:flex rb:items-center rb:justify-between rb:text-[12px] rb:leading-4 rb:font-regular">
{t('memoryExtractionEngine.overallProgress')}
@@ -246,7 +246,7 @@ const Result: FC<ResultProps> = ({ loading, handleSave }) => {
</RbAlert>
}
<Space size={16} direction="vertical" style={{ width: '100%' }}>
{/* 文本预处理 */}
{/* Text Preprocessing */}
<RbCard
title={t(`memoryExtractionEngine.text_preprocessing`)}
extra={formatTag(textPreprocessing.status)}
@@ -266,7 +266,7 @@ const Result: FC<ResultProps> = ({ loading, handleSave }) => {
</RbAlert>
}
</RbCard>
{/* 知识抽取 */}
{/* Knowledge Extraction */}
<RbCard
title={t(`memoryExtractionEngine.knowledge_extraction`)}
extra={formatTag(knowledgeExtraction.status)}
@@ -286,7 +286,7 @@ const Result: FC<ResultProps> = ({ loading, handleSave }) => {
})}
</RbAlert>}
</RbCard>
{/* 创建实体关系 */}
{/* Creating Entity Relationships */}
<RbCard
title={t(`memoryExtractionEngine.creating_nodes_edges`)}
extra={formatTag(creatingNodesEdges.status)}
@@ -306,7 +306,7 @@ const Result: FC<ResultProps> = ({ loading, handleSave }) => {
{t('memoryExtractionEngine.creating_nodes_edges_desc', {num: creatingNodesEdges.result.entity_entity_edges_count})}
</RbAlert>}
</RbCard>
{/* 去重消歧 */}
{/* Deduplication and Disambiguation */}
<RbCard
title={t(`memoryExtractionEngine.deduplication`)}
extra={formatTag(deduplication.status)}

File diff suppressed because it is too large Load Diff

View File

@@ -29,7 +29,6 @@ const OntologyClassExtractModal = forwardRef<OntologyClassExtractModalRef, Ontol
const [targetKeys, setTargetKeys] = useState<TransferProps['targetKeys']>([]);
const [selectedKeys, setSelectedKeys] = useState<TransferProps['selectedKeys']>([]);
// 封装取消方法,添加关闭弹窗逻辑
const handleClose = () => {
setVisible(false);
form.resetFields();
@@ -43,7 +42,6 @@ const OntologyClassExtractModal = forwardRef<OntologyClassExtractModalRef, Ontol
setVisible(true);
setData(vo)
};
// 封装保存方法,添加提交逻辑
const handleSave = () => {
if (!data?.scene_id) return;
form
@@ -104,7 +102,6 @@ const OntologyClassExtractModal = forwardRef<OntologyClassExtractModalRef, Ontol
setSelectedKeys([...sourceSelectedKeys, ...targetSelectedKeys].filter(Boolean));
};
// 暴露给父组件的方法
useImperativeHandle(ref, () => ({
handleOpen,
}));

View File

@@ -22,7 +22,6 @@ const OntologyClassModal = forwardRef<OntologyClassModalRef, OntologyClassModalP
const [loading, setLoading] = useState(false)
const [scene_id, setSceneId] = useState<string | null>(null)
// 封装取消方法,添加关闭弹窗逻辑
const handleClose = () => {
setVisible(false);
form.resetFields();
@@ -34,7 +33,6 @@ const OntologyClassModal = forwardRef<OntologyClassModalRef, OntologyClassModalP
setVisible(true);
setSceneId(scene_id)
};
// 封装保存方法,添加提交逻辑
const handleSave = () => {
if (!scene_id) return;
form
@@ -56,7 +54,6 @@ const OntologyClassModal = forwardRef<OntologyClassModalRef, OntologyClassModalP
});
}
// 暴露给父组件的方法
useImperativeHandle(ref, () => ({
handleOpen,
}));

View File

@@ -22,7 +22,6 @@ const OntologyModal = forwardRef<OntologyModalRef, OntologyModalProps>(({
const [form] = Form.useForm<OntologyModalData>();
const [loading, setLoading] = useState(false)
// 封装取消方法,添加关闭弹窗逻辑
const handleClose = () => {
setVisible(false);
form.resetFields();
@@ -39,7 +38,6 @@ const OntologyModal = forwardRef<OntologyModalRef, OntologyModalProps>(({
}
setVisible(true);
};
// 封装保存方法,添加提交逻辑
const handleSave = () => {
form
.validateFields()
@@ -59,7 +57,6 @@ const OntologyModal = forwardRef<OntologyModalRef, OntologyModalProps>(({
});
}
// 暴露给父组件的方法
useImperativeHandle(ref, () => ({
handleOpen,
}));

View File

@@ -2,7 +2,7 @@
* @Author: ZhaoYing
* @Date: 2026-02-03 17:37:31
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-03 17:37:51
* @Last Modified time: 2026-02-04 10:16:42
*/
/**
* Order Payment Page
@@ -227,7 +227,7 @@ const OrderPayment: React.FC = () => {
return (
<div className="rb:w-full rb:pb-20">
{/* 订单信息 */}
{/* Order Information */}
<div className="rb:mb-6">
<h2 className="rb:text-[16px] rb:text-lg rb:font-semibold rb:mb-4">{t('pricing.orderInformation')}</h2>
@@ -238,9 +238,9 @@ const OrderPayment: React.FC = () => {
</div>
</div>
{/* 订单详情表格 */}
{/* Order Details Table */}
<div className="rb:border rb:border-[#DFE4ED] rb:rounded-2xl rb:overflow-hidden">
{/* 桌面端表头 */}
{/* Desktop Table Header */}
<div className="rb:flex rb:gap-4 rb:p-4 rb:bg-[rgba(255,255,255,0.03)] rb:border-b rb:border-b-[rgba(255,255,255,0.1)]">
<div className="rb:flex-1">{t('pricing.comboName')}</div>
<div className="rb:flex-2">{t('pricing.spAndTa')}</div>
@@ -248,15 +248,15 @@ const OrderPayment: React.FC = () => {
<div className="rb:w-32">{t('pricing.orderCycle')}</div>
<div className="rb:w-32 rb:text-right">{t('pricing.orderAmount')}</div>
</div>
{/* 表格内容 */}
{/* Table Content */}
<div className="rb:flex rb:p-4 rb:flex-row rb:gap-4">
{/* 套餐名称 */}
{/* Package Name */}
<div className="rb:flex-1">
<div className="rb:hidden rb:text-[12px] rb:text-[#5B6167] rb:mb-1">{t('pricing.comboName')}</div>
<div className="rb:text-[18px] rb:text-xl rb:font-bold rb:mb-1">{orderInfo.comboName}</div>
<div className="rb:text-[12px] rb:text-[#5B6167]">{orderInfo.comboEdition}</div>
</div>
{/* 解决方案和目标受众 */}
{/* Solutions and Target Audience */}
<div className="rb:flex-2 rb:text-[12px] ">
<div className="rb:hidden rb:text-[12px] rb:text-[#5B6167] rb:mb-2">{t('pricing.spAndTa')}</div>
<div className="rb:mb-4">
@@ -268,7 +268,7 @@ const OrderPayment: React.FC = () => {
<div className="rb:text-[#5B6167]">{orderInfo.targetAudience}</div>
</div>
</div>
{/* 版本信息 */}
{/* Version Information */}
<div className="rb:flex-2 rb:text-[12px] rb:space-y-2">
<div className="rb:hidden rb:text-[12px] rb:text-[#5B6167] rb:mb-2">{t('pricing.versionInformation')}</div>
<div className="rb:flex rb:items-center rb:gap-2">
@@ -296,7 +296,7 @@ const OrderPayment: React.FC = () => {
</>
)}
</div>
{/* 订购周期和金额 */}
{/* Subscription Period and Amount */}
<div className="rb:w-32 rb:text-[12px] rb:text-[#5B6167]">
{orderInfo.orderingCycle}
</div>
@@ -308,9 +308,9 @@ const OrderPayment: React.FC = () => {
</div>
</div>
{/* 支付方式和支付凭证 */}
{/* Payment Method and Payment Voucher */}
<div className="rb:grid rb:grid-cols-2 rb:gap-6">
{/* 支付方式 */}
{/* Payment Method */}
<div className="rb:border rb:border-[#DFE4ED] rb:rounded-2xl rb:p-4">
<h2 className="rb:text-[16px] rb:text-lg rb:font-semibold rb:mb-4">{t('pricing.paymentMethod')}</h2>
@@ -352,7 +352,7 @@ const OrderPayment: React.FC = () => {
</div>
</div>
{/* 支付凭证 */}
{/* Payment Voucher */}
<div className="rb:border rb:border-[#DFE4ED] rb:rounded-2xl rb:p-4">
<h2 className="rb:text-[16px] rb:text-lg rb:font-semibold rb:mb-4">{t('pricing.paymentVoucher')}</h2>

View File

@@ -110,7 +110,7 @@ const Prompt: FC<{ editVo: HistoryItem | null; refresh: () => void; }> = ({ edit
break;
case 'end':
setLoading(false)
// 流结束时同步表单值
// Sync form values when stream ends
form.setFieldsValue({ current_prompt: currentPromptValueRef.current })
break
}

View File

@@ -27,19 +27,19 @@ import SwitchFormItem from '@/components/FormItem/SwitchFormItem'
/** Configuration list */
const configList = [
// 启用反思引擎
// Enable reflection engine
{
key: 'reflection_enabled',
type: 'switch',
},
// 反思模型
// Reflection model
{
key: 'reflection_model_id',
type: 'customSelect',
url: getModelListUrl,
params: { type: 'chat,llm', page: 1, pagesize: 100, is_active: true }, // chat,llm
},
// 迭代周期
// Iteration period
{
key: 'reflection_period_in_hours',
type: 'select',
@@ -51,7 +51,7 @@ const configList = [
{ label: 'daily', value: '24' },
],
},
// 反思范围
// Reflection scope
{
key: 'reflexion_range',
type: 'select',
@@ -61,7 +61,7 @@ const configList = [
{ label: 'all', value: 'all' },
],
},
// 反思基线
// Reflection baseline
{
key: 'baseline',
type: 'select',
@@ -72,12 +72,12 @@ const configList = [
{ label: 'HYBRID', value: 'HYBRID' },
],
},
// 质量评估
// Quality assessment
{
key: 'quality_assessment',
type: 'switch',
},
// 质量评估
// Quality assessment
{
key: 'memory_verify',
type: 'switch',

View File

@@ -159,13 +159,13 @@ const Rag: FC = () => {
))}
</div>
{/* 记忆总量 */}
{/* Total Memory */}
<div className="rb:font-regular rb:text-[12px] rb:text-[#5B6167] rb:leading-4 rb:mb-6.25">
{t('userMemory.totalNumOfMemories')}
<div className="rb:font-extrabold rb:text-[24px] rb:text-[#212332] rb:leading-7.5 rb:mt-2">{memory || 0}</div>
</div>
{/* 关于我 */}
{/* About Me */}
<>
<Title
type="aboutUs"
@@ -188,7 +188,7 @@ const Rag: FC = () => {
</>
)}
</>
{/* 记忆洞察 */}
{/* Memory Insights */}
<>
<Title
type="memoryInsight"

View File

@@ -134,11 +134,10 @@ const EmotionTags: FC = () => {
<div ref={chartRef} className="rb:mt-6 rb:px-6" style={{ height: '320px', width: '100%' }} />
<div className="rb:flex rb:flex-wrap rb:items-center rb:justify-center rb:gap-10 rb:text-sm rb:mt-3 rb:p-3 rb:bg-[#F0F3F8] rb:rounded-[0_0_8px_8px]">
{Object.entries(emotionStats).map(([type, count]) => {
console.log(type)
return (
<div key={type} className="rb:flex rb:items-center rb:gap-2">
<div className="rb:w-3 rb:h-3 rb:rounded-full" style={{ backgroundColor: getEmotionColor(type) }}></div>
<span className="rb:leading-5">{t(`statementDetail.${type || 'neutral'}`)} ({count})</span>
<span className="rb:leading-5">{t(`statementDetail.${type || 'neutral'}`)} ({count}{t('statementDetail.item')})</span>
</div>
)
})}

View File

@@ -69,7 +69,7 @@ const NodeStatistics: FC = () => {
getNodeStatistics(id).then((res) => {
const response = res as NodeStatisticsItem[]
setData(response)
// 计算count总计
// Calculate total count
const totalCount = response.reduce((sum, item) => sum + (item.count || 0), 0)
setTotal(totalCount)
setLoading(false)

View File

@@ -51,19 +51,19 @@ const RelationshipNetwork:FC = () => {
const curEdges: Edge[] = []
const curNodeTypes = Object.keys(statistics.node_types).filter(vo => vo !== 'Dialogue')
// 计算每个节点的连接数
// Calculate connection count for each node
const connectionCount: Record<string, number> = {}
edges.forEach(edge => {
connectionCount[edge.source] = (connectionCount[edge.source] || 0) + 1
connectionCount[edge.target] = (connectionCount[edge.target] || 0) + 1
})
// 处理节点数据
// Process node data
nodes.filter(vo => vo.label !== 'Dialogue').forEach(node => {
const connections = connectionCount[node.id] || 0
const categoryIndex = curNodeTypes.indexOf(node.label)
// 根据节点类型获取显示名称
// Get display name based on node type
let displayName = ''
switch (node.label) {
// case 'Statement':
@@ -93,16 +93,16 @@ const RelationshipNetwork:FC = () => {
...node,
name: displayName,
category: categoryIndex >= 0 ? categoryIndex : 0,
symbolSize: symbolSize, // 根据连接数调整节点大小
symbolSize: symbolSize, // Adjust node size based on connection count
})
})
// 创建节点ID到标签的映射
// Create mapping from node ID to label
const nodeIdToLabel: Record<string, string> = {}
nodes.forEach(node => {
nodeIdToLabel[node.id] = node.label
})
// 处理边数据
// Process edge data
edges.forEach(edge => {
curEdges.push({
...edge,
@@ -112,7 +112,7 @@ const RelationshipNetwork:FC = () => {
})
})
// 设置分类
// Set categories
const curCategories = curNodeTypes.map(type => ({ name: type }))
setNodes(curNodes)
@@ -160,7 +160,7 @@ const RelationshipNetwork:FC = () => {
return (
<Row gutter={16}>
{/* 关系网络 */}
{/* Relationship Network */}
<Col span={16}>
<RbCard
title={t('userMemory.relationshipNetwork')}
@@ -211,22 +211,22 @@ const RelationshipNetwork:FC = () => {
},
force: {
repulsion: 100,
// 启用类别聚合
// Enable category aggregation
edgeLength: 80,
gravity: 0.3,
// 同类别的节点相互吸引
// Nodes of the same category attract each other
layoutAnimation: true,
// 防止点击时重新计算布局
// Prevent layout recalculation on click
preventOverlap: true,
// 点击节点后保持布局稳定
// Keep layout stable after node click
edgeSymbol: ['none', 'arrow'],
edgeSymbolSize: [4, 10],
// 初始布局完成后关闭力导向
// Disable force-directed after initial layout
initLayout: 'force'
},
selectedMode: 'single',
draggable: true,
// 防止数据更新时重新计算布局
// Prevent layout recalculation on data update
animationDurationUpdate: 0,
select: {
itemStyle: {
@@ -242,12 +242,12 @@ const RelationshipNetwork:FC = () => {
notMerge={false}
lazyUpdate={true}
onEvents={{
// 节点点击事件处理
// Node click event handler
click: (params: { dataType: string; data: Node; name: string }) => {
if (params.dataType === 'node') {
// 处理节点点击事件
// Handle node click event
console.log('Node clicked:', params.data);
// 使用函数式更新避免状态依赖问题
// Use functional update to avoid state dependency issues
setSelectedNode(params.data)
}
}
@@ -257,7 +257,7 @@ const RelationshipNetwork:FC = () => {
</div>
</RbCard>
</Col>
{/* 记忆详情 */}
{/* Memory Details */}
<Col span={8}>
<RbCard
title={t('userMemory.memoryDetails')}

View File

@@ -79,7 +79,7 @@ const WordCloud: FC = () => {
const radarOption = useMemo(() => {
if (!wordCloud?.tags.length) return {}
// avg_intensity转换为1-100范围
// Convert avg_intensity to 1-100 range
const radarData = wordCloud.tags.map(item => ({
name: item.emotion_type,
value: Math.round(item.avg_intensity * 100),