forked from ElricLiu/AutoGPT-Next-Web
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstart.ts
More file actions
43 lines (37 loc) · 1.05 KB
/
start.ts
File metadata and controls
43 lines (37 loc) · 1.05 KB
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
35
36
37
38
39
40
41
42
43
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
import type { RequestBody } from "../../../utils/interfaces";
import AgentService from "../../../services/agent-service";
import { serverError } from "../responses";
export const config = {
runtime: "edge",
};
const handler = async (request: NextRequest) => {
try {
const { modelSettings, goal, customLanguage, agentType } =
(await request.json()) as RequestBody;
let newTasks;
if (agentType === "codyChat") {
newTasks = await AgentService.codyChatAgent(
modelSettings,
goal,
customLanguage
);
} else if (agentType === "deepSeekCoderV3") {
newTasks = await AgentService.deepSeekCoderV3Agent(
modelSettings,
goal,
customLanguage
);
} else {
newTasks = await AgentService.startGoalAgent(
modelSettings,
goal,
customLanguage
);
}
return NextResponse.json({ newTasks });
} catch (e) {}
return serverError();
};
export default handler;