From 00a44859a673b388e1dca5f54c4ecaffc5fee30e Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期四, 19 三月 2026 10:21:08 +0800
Subject: [PATCH] lsh#0:新增、更新、解禁(只要调用了更新,就代表非禁用了)  1:禁用

---
 rsf-admin/src/page/system/aiPrompt/AiPromptCreate.jsx |   92 ++++-----------------------------------------
 1 files changed, 9 insertions(+), 83 deletions(-)

diff --git a/rsf-admin/src/page/system/aiPrompt/AiPromptCreate.jsx b/rsf-admin/src/page/system/aiPrompt/AiPromptCreate.jsx
index 1a4d34e..5354b5c 100644
--- a/rsf-admin/src/page/system/aiPrompt/AiPromptCreate.jsx
+++ b/rsf-admin/src/page/system/aiPrompt/AiPromptCreate.jsx
@@ -1,87 +1,13 @@
 import React from "react";
-import {
-    CreateBase,
-    useTranslate,
-    TextInput,
-    NumberInput,
-    SaveButton,
-    SelectInput,
-    Toolbar,
-    useNotify,
-    Form,
-} from 'react-admin';
-import {
-    Dialog,
-    DialogActions,
-    DialogContent,
-    DialogTitle,
-    Stack,
-    Grid,
-    Box,
-} from '@mui/material';
-import DialogCloseButton from "@/page/components/DialogCloseButton";
-import StatusSelectInput from "@/page/components/StatusSelectInput";
-import MemoInput from "@/page/components/MemoInput";
+import { Create, SimpleForm } from "react-admin";
+import AiPromptForm from "./AiPromptForm";
 
-const sceneChoices = [
-    { id: 'general_chat', name: '閫氱敤瀵硅瘽' },
-    { id: 'system_diagnose', name: '绯荤粺璇婃柇' },
-];
-
-const AiPromptCreate = (props) => {
-    const { open, setOpen } = props;
-    const translate = useTranslate();
-    const notify = useNotify();
-
-    const handleClose = (event, reason) => {
-        if (reason !== "backdropClick") {
-            setOpen(false);
-        }
-    };
-
-    const handleSuccess = async () => {
-        setOpen(false);
-        notify('common.response.success');
-    };
-
-    const handleError = async (error) => {
-        notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } });
-    };
-
-    return (
-        <CreateBase
-            record={{ sceneCode: 'system_diagnose', status: 1, publishedFlag: 0 }}
-            mutationOptions={{ onSuccess: handleSuccess, onError: handleError }}
-        >
-            <Dialog open={open} onClose={handleClose} fullWidth disableRestoreFocus maxWidth="md">
-                <Form>
-                    <DialogTitle sx={{ position: 'sticky', top: 0, backgroundColor: 'background.paper', zIndex: 1000 }}>
-                        {translate('create.title')}
-                        <Box sx={{ position: 'absolute', top: 8, right: 8, zIndex: 1001 }}>
-                            <DialogCloseButton onClose={handleClose} />
-                        </Box>
-                    </DialogTitle>
-                    <DialogContent sx={{ mt: 2 }}>
-                        <Grid container rowSpacing={2} columnSpacing={2}>
-                            <Grid item xs={6}><SelectInput source="sceneCode" label="鍦烘櫙" choices={sceneChoices} fullWidth /></Grid>
-                            <Grid item xs={6}><TextInput source="templateName" label="妯℃澘鍚嶇О" fullWidth /></Grid>
-                            <Grid item xs={12}><TextInput source="basePrompt" label="鍩虹鎻愮ず璇�" fullWidth multiline minRows={4} /></Grid>
-                            <Grid item xs={12}><TextInput source="toolPrompt" label="宸ュ叿鎻愮ず璇�" fullWidth multiline minRows={4} /></Grid>
-                            <Grid item xs={12}><TextInput source="outputPrompt" label="杈撳嚭鎻愮ず璇�" fullWidth multiline minRows={4} /></Grid>
-                            <Grid item xs={6}><NumberInput source="versionNo" label="鐗堟湰鍙�" fullWidth /></Grid>
-                            <Grid item xs={6}><StatusSelectInput fullWidth /></Grid>
-                            <Grid item xs={12}><Stack direction="column" spacing={1} width={'100%'}><MemoInput /></Stack></Grid>
-                        </Grid>
-                    </DialogContent>
-                    <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}>
-                        <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }}>
-                            <SaveButton />
-                        </Toolbar>
-                    </DialogActions>
-                </Form>
-            </Dialog>
-        </CreateBase>
-    )
-}
+const AiPromptCreate = () => (
+    <Create redirect="list">
+        <SimpleForm defaultValues={{ code: "home.default", scene: "home", status: 1 }}>
+            <AiPromptForm />
+        </SimpleForm>
+    </Create>
+);
 
 export default AiPromptCreate;

--
Gitblit v1.9.1