From 287a666e1b2bb155e86aa88ebace201d1e8a51f6 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期四, 19 三月 2026 13:26:02 +0800
Subject: [PATCH] #AI.国际化

---
 rsf-admin/src/page/system/aiParam/AiParamForm.jsx |   56 +++++++++++++++++++++++++++++++-------------------------
 1 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/rsf-admin/src/page/system/aiParam/AiParamForm.jsx b/rsf-admin/src/page/system/aiParam/AiParamForm.jsx
index 09eface..eabd8dd 100644
--- a/rsf-admin/src/page/system/aiParam/AiParamForm.jsx
+++ b/rsf-admin/src/page/system/aiParam/AiParamForm.jsx
@@ -6,6 +6,7 @@
     SelectInput,
     TextInput,
     useNotify,
+    useTranslate,
 } from "react-admin";
 import { Alert, Button, Grid, Stack, Typography } from "@mui/material";
 import StatusSelectInput from "@/page/components/StatusSelectInput";
@@ -17,6 +18,7 @@
 
 const AiParamValidateSection = ({ formData, readOnly }) => {
     const notify = useNotify();
+    const translate = useTranslate();
     const [loading, setLoading] = useState(false);
     const [result, setResult] = useState(null);
 
@@ -25,11 +27,11 @@
         try {
             const data = await validateAiParamDraft(formData);
             setResult(data);
-            notify(data?.message || "AI 鍙傛暟楠岃瘉鎴愬姛");
+            notify(data?.message || translate("ai.param.validate.success"));
         } catch (error) {
             const nextResult = {
                 status: "INVALID",
-                message: error?.message || "AI 鍙傛暟楠岃瘉澶辫触",
+                message: error?.message || translate("ai.param.validate.failed"),
             };
             setResult(nextResult);
             notify(nextResult.message, { type: "error" });
@@ -44,10 +46,10 @@
                 <Grid item xs={12}>
                     <Stack direction="row" spacing={1} alignItems="center">
                         <Button variant="outlined" onClick={handleValidate} disabled={loading}>
-                            {loading ? "楠岃瘉涓�..." : "淇濆瓨鍓嶉獙璇�"}
+                            {loading ? translate("ai.param.validate.loading") : translate("ai.param.validate.beforeSave")}
                         </Button>
                         <Typography variant="body2" color="text.secondary">
-                            浼氱洿鎺ユ牎楠屽綋鍓� Base URL銆丄PI Key 涓庢ā鍨嬫槸鍚﹀彲璋冪敤銆�
+                            {translate("ai.param.validate.description")}
                         </Typography>
                     </Stack>
                 </Grid>
@@ -65,72 +67,76 @@
     );
 };
 
-const AiParamForm = ({ readOnly = false }) => (
+const AiParamForm = ({ readOnly = false }) => {
+    const translate = useTranslate();
+
+    return (
     <Grid container spacing={2} width={{ xs: "100%", xl: "80%" }}>
         <Grid item xs={12}>
-            <Typography variant="h6">涓昏閰嶇疆</Typography>
+            <Typography variant="h6">{translate("ai.param.form.sections.main")}</Typography>
         </Grid>
         <Grid item xs={12} md={6}>
-            <TextInput source="name" label="鍚嶇О" fullWidth disabled={readOnly} />
+            <TextInput source="name" label="common.field.name" fullWidth disabled={readOnly} />
         </Grid>
         <Grid item xs={12} md={6}>
-            <SelectInput source="providerType" label="鎻愪緵鏂圭被鍨�" choices={providerChoices} fullWidth disabled={readOnly} />
+            <SelectInput source="providerType" label="ai.param.fields.providerType" choices={providerChoices} fullWidth disabled={readOnly} />
         </Grid>
         <Grid item xs={12}>
-            <TextInput source="baseUrl" label="Base URL" fullWidth disabled={readOnly} />
+            <TextInput source="baseUrl" label="ai.param.fields.baseUrl" fullWidth disabled={readOnly} />
         </Grid>
         <Grid item xs={12} md={6}>
-            <TextInput source="apiKey" label="API Key" fullWidth disabled={readOnly} />
+            <TextInput source="apiKey" label="ai.param.fields.apiKey" fullWidth disabled={readOnly} />
         </Grid>
         <Grid item xs={12} md={6}>
-            <TextInput source="model" label="妯″瀷" fullWidth disabled={readOnly} />
+            <TextInput source="model" label="ai.param.fields.model" fullWidth disabled={readOnly} />
         </Grid>
         <Grid item xs={12} md={3}>
-            <NumberInput source="temperature" label="Temperature" fullWidth disabled={readOnly} />
+            <NumberInput source="temperature" label="ai.param.fields.temperature" fullWidth disabled={readOnly} />
         </Grid>
         <Grid item xs={12} md={3}>
-            <NumberInput source="topP" label="Top P" fullWidth disabled={readOnly} />
+            <NumberInput source="topP" label="ai.param.fields.topP" fullWidth disabled={readOnly} />
         </Grid>
         <Grid item xs={12} md={3}>
-            <NumberInput source="maxTokens" label="Max Tokens" fullWidth disabled={readOnly} />
+            <NumberInput source="maxTokens" label="ai.param.fields.maxTokens" fullWidth disabled={readOnly} />
         </Grid>
         <Grid item xs={12} md={3}>
-            <NumberInput source="timeoutMs" label="Timeout(ms)" fullWidth disabled={readOnly} />
+            <NumberInput source="timeoutMs" label="ai.param.fields.timeoutMs" fullWidth disabled={readOnly} />
         </Grid>
         <Grid item xs={12} md={6}>
-            <BooleanInput source="streamingEnabled" label="鍚敤娴佸紡鍝嶅簲" disabled={readOnly} />
+            <BooleanInput source="streamingEnabled" label="ai.param.fields.streamingEnabled" disabled={readOnly} />
         </Grid>
         <Grid item xs={12} md={6}>
             <StatusSelectInput disabled={readOnly} />
         </Grid>
         <Grid item xs={12}>
-            <TextInput source="memo" label="澶囨敞" fullWidth multiline minRows={3} disabled={readOnly} />
+            <TextInput source="memo" label="common.field.memo" fullWidth multiline minRows={3} disabled={readOnly} />
         </Grid>
         <FormDataConsumer>
             {({ formData }) => <AiParamValidateSection formData={formData} readOnly={readOnly} />}
         </FormDataConsumer>
         <Grid item xs={12}>
-            <Typography variant="h6">杩愯涓庡璁′俊鎭�</Typography>
+            <Typography variant="h6">{translate("ai.param.form.sections.runtime")}</Typography>
         </Grid>
         <Grid item xs={12} md={3}>
-            <TextInput source="validateStatus" label="鏈�杩戞牎楠岀姸鎬�" fullWidth disabled />
+            <TextInput source="validateStatus" label="ai.param.fields.validateStatus" fullWidth disabled />
         </Grid>
         <Grid item xs={12} md={3}>
-            <TextInput source="lastValidateElapsedMs" label="鏈�杩戞牎楠岃�楁椂(ms)" fullWidth disabled />
+            <TextInput source="lastValidateElapsedMs" label="ai.param.fields.lastValidateElapsedMs" fullWidth disabled />
         </Grid>
         <Grid item xs={12} md={3}>
-            <TextInput source="lastValidateTime$" label="鏈�杩戞牎楠屾椂闂�" fullWidth disabled />
+            <TextInput source="lastValidateTime$" label="ai.param.fields.lastValidateTime" fullWidth disabled />
         </Grid>
         <Grid item xs={12} md={3}>
-            <TextInput source="updateBy" label="鏈�杩戞洿鏂颁汉" fullWidth disabled />
+            <TextInput source="updateBy" label="ai.common.lastUpdatedBy" fullWidth disabled />
         </Grid>
         <Grid item xs={12}>
-            <TextInput source="lastValidateMessage" label="鏈�杩戞牎楠岀粨鏋�" fullWidth multiline minRows={3} disabled />
+            <TextInput source="lastValidateMessage" label="ai.param.fields.lastValidateMessage" fullWidth multiline minRows={3} disabled />
         </Grid>
         <Grid item xs={12}>
-            <TextInput source="updateTime$" label="鏈�杩戞洿鏂版椂闂�" fullWidth disabled />
+            <TextInput source="updateTime$" label="ai.common.lastUpdatedAt" fullWidth disabled />
         </Grid>
     </Grid>
-);
+    );
+};
 
 export default AiParamForm;

--
Gitblit v1.9.1