feat: support switch nodejs plugin

This commit is contained in:
Hk-Gosuto
2023-11-27 22:53:20 +08:00
parent a810ebea36
commit 35f5dc52e7
5 changed files with 343 additions and 9 deletions

View File

@@ -255,7 +255,9 @@ export class ChatGPTApi implements LLMApi {
options.onController?.(controller);
try {
const path = "/api/langchain/tool/agent";
let path = "/api/langchain/tool/agent/";
const enableNodeJSPlugin = !!process.env.NEXT_PUBLIC_ENABLE_NODEJS_PLUGIN;
path = enableNodeJSPlugin ? path + "nodejs" : path + "edge";
const chatPayload = {
method: "POST",
body: JSON.stringify(requestPayload),