mirror of
https://github.com/aljazceru/AgentGPT.git
synced 2025-12-17 22:14:23 +01:00
20 lines
548 B
TypeScript
20 lines
548 B
TypeScript
import type { NextApiRequest, NextApiResponse } from 'next'
|
|
import { startGoalAgent } from "../../utils/chain";
|
|
|
|
export interface ChainAPIRequest extends NextApiRequest {
|
|
body: {
|
|
prompt: string;
|
|
};
|
|
}
|
|
|
|
export interface ChainAPIResponse extends NextApiResponse {
|
|
body: {
|
|
tasks: string[]
|
|
};
|
|
}
|
|
|
|
export default async function handler(req: ChainAPIRequest, res: ChainAPIResponse) {
|
|
const completion = await startGoalAgent(req.body.prompt);
|
|
console.log(completion.text);
|
|
res.status(200).json({ tasks: completion.text as string[] })
|
|
} |