From a9f2a9d96390d51e74adf76b4b833d74cdc3cf91 Mon Sep 17 00:00:00 2001 From: Hk-Gosuto Date: Fri, 1 Dec 2023 17:47:58 +0800 Subject: [PATCH] fix(73): fix bug --- app/api/langchain/tool/agent/agentapi.ts | 20 +++++--------------- app/api/langchain/tool/agent/edge/route.ts | 1 - 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/app/api/langchain/tool/agent/agentapi.ts b/app/api/langchain/tool/agent/agentapi.ts index c5a61e0d8..e4e590f2e 100644 --- a/app/api/langchain/tool/agent/agentapi.ts +++ b/app/api/langchain/tool/agent/agentapi.ts @@ -116,7 +116,7 @@ export class AgentApi { }, async handleAgentAction(action) { try { - console.log("[handleAgentAction]", action.tool); + // console.log("[handleAgentAction]", action.tool); if (!reqBody.returnIntermediateSteps) return; var response = new ResponseBody(); response.isToolMessage = true; @@ -139,13 +139,13 @@ export class AgentApi { } }, handleToolStart(tool, input) { - console.log("[handleToolStart]", { tool }); + // console.log("[handleToolStart]", { tool }); }, async handleToolEnd(output, runId, parentRunId, tags) { - console.log("[handleToolEnd]", { output, runId, parentRunId, tags }); + // console.log("[handleToolEnd]", { output, runId, parentRunId, tags }); }, handleAgentEnd(action, runId, parentRunId, tags) { - console.log("[handleAgentEnd]"); + // console.log("[handleAgentEnd]"); }, }); } @@ -178,17 +178,7 @@ export class AgentApi { reqBody: RequestBody, customTools: any[], ) { - if (req.method === "OPTIONS") { - return NextResponse.json({ body: "OK" }, { status: 200 }); - } try { - const authResult = auth(req); - if (authResult.error) { - return NextResponse.json(authResult, { - status: 401, - }); - } - const serverConfig = getServerSideConfig(); // const reqBody: RequestBody = await req.json(); @@ -249,7 +239,7 @@ export class AgentApi { const tools = []; if (useTools.includes("web-search")) tools.push(searchTool); - console.log(customTools); + // console.log(customTools); customTools.forEach((customTool) => { if (customTool) { diff --git a/app/api/langchain/tool/agent/edge/route.ts b/app/api/langchain/tool/agent/edge/route.ts index 7e9c8f06f..f48099e79 100644 --- a/app/api/langchain/tool/agent/edge/route.ts +++ b/app/api/langchain/tool/agent/edge/route.ts @@ -2,7 +2,6 @@ import { NextRequest, NextResponse } from "next/server"; import { AgentApi, RequestBody, ResponseBody } from "../agentapi"; import { auth } from "@/app/api/auth"; import { EdgeTool } from "../../../../langchain-tools/edge_tools"; -import { getServerSideConfig } from "@/app/config/server"; import { OpenAI } from "langchain/llms/openai"; import { OpenAIEmbeddings } from "langchain/embeddings/openai";