File size: 1,142 Bytes
e85fa50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import React from 'react';
import { useNavigate } from 'react-router-dom';
import Layout from '../components/Layout/Layout';
import Card, { CardHeader, CardContent } from '../components/common/Card';
import PromptGroupForm from '../components/PromptGroup/PromptGroupForm';
import { useApp } from '../contexts/AppContext';

const CreatePromptGroupPage: React.FC = () => {
  const navigate = useNavigate();
  const { addPromptGroup } = useApp();

  const handleSubmit = (promptGroupData: { name: string; description: string; category: string }) => {
    // Simply pass the form data directly to addPromptGroup
    // The function itself will handle adding the additional properties
    addPromptGroup(promptGroupData);
    navigate('/');
  };

  return (
    <Layout title="创建提示词组" showBackButton>

      <Card>

        <CardHeader title="新建提示词组" />

        <CardContent>

          <PromptGroupForm

            onSubmit={handleSubmit}

            onCancel={() => navigate('/')}

          />

        </CardContent>

      </Card>

    </Layout>
  );
};

export default CreatePromptGroupPage;