feat: 支持全局配置插件

This commit is contained in:
Hk-Gosuto
2023-08-16 13:38:15 +08:00
parent dd0b451a7c
commit 76eb2afd06
11 changed files with 147 additions and 8 deletions

View File

@@ -35,6 +35,8 @@ interface RequestBody {
presence_penalty?: number;
frequency_penalty?: number;
top_p?: number;
maxIterations: number;
returnIntermediateSteps: boolean;
}
class ResponseBody {
@@ -120,6 +122,7 @@ async function handle(req: NextRequest) {
`tool: ${action.tool} toolInput: ${action.toolInput}`,
{ action },
);
if (!reqBody.returnIntermediateSteps) return;
var response = new ResponseBody();
response.isToolMessage = true;
let toolInput = <ToolInput>(<unknown>action.toolInput);
@@ -202,8 +205,8 @@ async function handle(req: NextRequest) {
});
const executor = await initializeAgentExecutorWithOptions(tools, llm, {
agentType: "openai-functions",
returnIntermediateSteps: true,
maxIterations: 3,
returnIntermediateSteps: reqBody.returnIntermediateSteps,
maxIterations: reqBody.maxIterations,
memory: memory,
});