feat: user openai account

This commit is contained in:
archer
2023-07-28 13:29:06 +08:00
parent dfda5285bd
commit fb8635a951
9 changed files with 75 additions and 39 deletions

View File

@@ -42,13 +42,14 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
await connectToDatabase();
/* user auth */
const { userId } = await authUser({ req });
const { userId, user } = await authUser({ req, authBalance: true });
/* start process */
const { responseData } = await dispatchModules({
res,
modules: modules,
variables,
user,
params: {
history: gptMessage2ChatType(history),
userChatInput: prompt