#
zhou zhou
1 天以前 2ce6327ec49e7fe73cc1cd3bcc2b63b28d89d38f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import React from "react";
import {
    Edit,
    SimpleForm,
    TextInput,
    NumberInput,
    SaveButton,
    SelectInput,
    Toolbar,
    DeleteButton,
} from 'react-admin';
import { Stack, Grid, Typography } from '@mui/material';
import { EDIT_MODE } from '@/config/setting';
import EditBaseAside from "@/page/components/EditBaseAside";
import CustomerTopToolBar from "@/page/components/EditTopToolBar";
import MemoInput from "@/page/components/MemoInput";
import StatusSelectInput from "@/page/components/StatusSelectInput";
 
const sceneChoices = [
    { id: 'general_chat', name: '通用对话' },
    { id: 'system_diagnose', name: '系统诊断' },
];
 
const FormToolbar = () => (
    <Toolbar sx={{ justifyContent: 'space-between' }}>
        <SaveButton />
        <DeleteButton mutationMode="optimistic" />
    </Toolbar>
);
 
const AiPromptEdit = () => (
    <Edit redirect="list" mutationMode={EDIT_MODE} actions={<CustomerTopToolBar />} aside={<EditBaseAside />}>
        <SimpleForm shouldUnregister warnWhenUnsavedChanges toolbar={<FormToolbar />} mode="onTouched">
            <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}>
                <Grid item xs={12} md={8}>
                    <Typography variant="h6" gutterBottom>主要</Typography>
                    <Stack direction='row' gap={2}>
                        <SelectInput source="sceneCode" label="场景" choices={sceneChoices} />
                        <TextInput source="templateName" label="模板名称" />
                    </Stack>
                    <Stack direction='row' gap={2}>
                        <NumberInput source="versionNo" label="版本号" />
                    </Stack>
                    <Stack direction='row' gap={2}>
                        <TextInput source="basePrompt" label="基础提示词" fullWidth multiline minRows={4} />
                    </Stack>
                    <Stack direction='row' gap={2}>
                        <TextInput source="toolPrompt" label="工具提示词" fullWidth multiline minRows={4} />
                    </Stack>
                    <Stack direction='row' gap={2}>
                        <TextInput source="outputPrompt" label="输出提示词" fullWidth multiline minRows={4} />
                    </Stack>
                </Grid>
                <Grid item xs={12} md={4}>
                    <Typography variant="h6" gutterBottom>通用</Typography>
                    <StatusSelectInput />
                    <MemoInput />
                </Grid>
            </Grid>
        </SimpleForm>
    </Edit>
)
 
export default AiPromptEdit;