app template
This commit is contained in:
28
client/src/pages/api/admin/initv4.ts
Normal file
28
client/src/pages/api/admin/initv4.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { jsonRes } from '@/service/response';
|
||||
import { authUser } from '@/service/utils/auth';
|
||||
import { connectToDatabase, TrainingData, User, promotionRecord } from '@/service/mongo';
|
||||
import { TrainingModeEnum } from '@/constants/plugin';
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
try {
|
||||
await authUser({ req, authRoot: true });
|
||||
const { amount, userId, type } = req.body as {
|
||||
amount: number;
|
||||
userId: number;
|
||||
type: 'withdraw';
|
||||
};
|
||||
await connectToDatabase();
|
||||
|
||||
jsonRes(res, {
|
||||
data: ''
|
||||
});
|
||||
} catch (error) {
|
||||
jsonRes(res, {
|
||||
code: 500,
|
||||
error
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ export type Props = {
|
||||
};
|
||||
export type Response = { history: ChatItemType[] };
|
||||
|
||||
const agentModel = 'gpt-3.5-turbo';
|
||||
const agentModel = 'gpt-3.5-turbo-16k';
|
||||
const agentFunName = 'agent_user_question';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
@@ -75,13 +75,13 @@ export async function classifyQuestion({
|
||||
// function body
|
||||
const agentFunction = {
|
||||
name: agentFunName,
|
||||
description: '严格判断用户问题的类型',
|
||||
description: '判断用户问题的类型,并返回不同的值',
|
||||
parameters: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
type: {
|
||||
type: 'string',
|
||||
description: agents.map((item) => `${item.value},返回: '${item.key}'`).join('; '),
|
||||
description: agents.map((item) => `${item.value},返回: '${item.key}'`).join('\n'),
|
||||
enum: agents.map((item) => item.key)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -73,11 +73,11 @@ const Settings = ({ appId }: { appId: string }) => {
|
||||
概览
|
||||
</Box>
|
||||
<Box
|
||||
border={theme.borders.sm}
|
||||
border={theme.borders.base}
|
||||
borderRadius={'lg'}
|
||||
px={5}
|
||||
py={4}
|
||||
bg={'rgba(235,245,255,0.4)'}
|
||||
bg={'myBlue.100'}
|
||||
position={'relative'}
|
||||
>
|
||||
<Flex alignItems={'center'} py={2}>
|
||||
|
||||
@@ -227,6 +227,8 @@ const AppEdit = ({ app, fullScreen, onFullScreen }: Props) => {
|
||||
|
||||
const { mutate: onclickSave, isLoading } = useRequest({
|
||||
mutationFn: () => {
|
||||
console.log(flow2Modules());
|
||||
|
||||
return putAppById(app._id, {
|
||||
modules: flow2Modules()
|
||||
});
|
||||
@@ -240,8 +242,6 @@ const AppEdit = ({ app, fullScreen, onFullScreen }: Props) => {
|
||||
|
||||
const initData = useCallback(
|
||||
(app: AppSchema) => {
|
||||
console.log('init');
|
||||
|
||||
const edges = appModule2FlowEdge({
|
||||
modules: app.modules,
|
||||
onDelete: onDelConnect
|
||||
|
||||
@@ -105,7 +105,9 @@ const CreateModal = ({ onClose, onSuccess }: { onClose: () => void; onSuccess: (
|
||||
<ModalContent w={'700px'} maxW={'90vw'}>
|
||||
<ModalHeader fontSize={'2xl'}>开始创建你的 AI 应用</ModalHeader>
|
||||
<ModalBody>
|
||||
<Box color={'myGray.800'}>取个响亮的名字</Box>
|
||||
<Box color={'myGray.800'} fontWeight={'bold'}>
|
||||
取个响亮的名字
|
||||
</Box>
|
||||
<Flex mt={3} alignItems={'center'}>
|
||||
<Avatar
|
||||
src={getValues('avatar')}
|
||||
@@ -124,7 +126,7 @@ const CreateModal = ({ onClose, onSuccess }: { onClose: () => void; onSuccess: (
|
||||
})}
|
||||
/>
|
||||
</Flex>
|
||||
<Box mt={7} mb={3} color={'myGray.800'}>
|
||||
<Box mt={7} mb={3} color={'myGray.800'} fontWeight={'bold'}>
|
||||
从模板中选择
|
||||
</Box>
|
||||
<Grid
|
||||
|
||||
Reference in New Issue
Block a user