"use client"; import { Loading } from "@/components/dashboard/loading"; // import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogFooter, DialogTitle, DialogTrigger } from "@/components/ui/dialog"; // import { // Form, // FormControl, // FormDescription, // FormField, // FormItem, // FormLabel, // FormMessage, // } from "@/components/ui/form"; // import { Input } from "@/components/ui/input"; import { toast } from "@/components/ui/toaster"; // import { trpc } from "@/lib/trpc/client"; // import { zodResolver } from "@hookform/resolvers/zod"; import { Plus } from "lucide-react"; import { useRouter } from "next/navigation"; import React, { useEffect, useState } from "react"; // import { useForm } from "react-hook-form"; import { z } from "zod"; import { Button, Form, Select, type FormItemProps, Input } from 'antd'; import { createContext, useContext, useMemo } from "react"; import service from "@/lib/http/service"; const formSchema = z.object({ name: z.string().min(2).max(50), }); // export const CreateApiButton = ({ ...rest }: React.ButtonHTMLAttributes) => { // const form = useForm>({ // resolver: zodResolver(formSchema), // }); // const create = trpc.api.create.useMutation({ // onSuccess(res) { // toast.success("Your API has been created"); // router.refresh(); // router.push(`/app/apis/${res.id}`); // }, // onError(err) { // console.error(err); // toast.error(err.message); // }, // }); export interface AttributeListItem { id: number; type: number; name: string; inputList: string; selectType: number; inputType: number; } export interface CreateFormProps { onCancel: () => void; onSubmit: (values: AttributeListItem) => void; createModalVisible: boolean; } const FormItem = Form.Item; const formLayout = { labelCol: { span: 7 }, wrapperCol: { span: 13 }, }; export const CreateApiButton: React.FC = (props) => { const [form] = Form.useForm(); const [inputType, setInputType] = useState(1); const { onSubmit, onCancel, createModalVisible } = props; useEffect(() => { if (form && !createModalVisible) { form.resetFields(); } else { // queryCategoryAttribute({ pageSize: 100, current: 1 }).then((res) => { // setCategoryListItems(res.data) // }); } }, [props.createModalVisible]); // async function onSubmit(values: z.infer) { // // create.mutate(values); // } const router = useRouter(); const [initLoading, setInitLoading] = useState(false); const onFinish = async (value: object) => { console.log("onFinish ---", value); await service.post('/api/v1/customer/create/staff', { // "name":"我的AI员工1号", //员工名称(必填) // "org_name":"主板销售部", //组织名称(必填) // "tone":"亲切且专业", //语气 // "output_length":"简短", //回复长度 // "description":"销冠的潜质", //员工描述 // "avatar_url":"https://www.pic.com/avatar001.jpg" //头像URL }, { headers: { // 'Authorization': token } }).then(function (result: any) { console.log("result:", result) if (result && result.header.code != 0) { toast.error(result.header.message) return } // setInitLoading(false); // categoriesRef.current.values const tags = result.data.list // getNewListFunc(1) }).catch((err) => { // setInitLoading(false); }); }; return ( <> {/* */} 创建新员工 {/*
( Name This is just a human readable name for you and not visible to anyone else )} /> */}
{/* */} {/* communication tones(交流语气):友好且真诚friendly and sincere, 专业且稳重professional and cautious, 清晰且直接clear and direct */} {/* */} {/* // "name":"我的AI员工1号", //员工名称(必填) // "org_name":"主板销售部", //组织名称(必填) // "tone":"亲切且专业", //语气 // "output_length":"简短", //回复长度 // "description":"销冠的潜质", //员工描述 // "avatar_url":"https://www.pic.com/avatar001.jpg" //头像URL */} {/* */} {/* */}
); };