diff --git a/packages/components/nodes/chains/ApiChain/OpenAPIChain.ts b/packages/components/nodes/chains/ApiChain/OpenAPIChain.ts index 2e54d2375..a7e8441a8 100644 --- a/packages/components/nodes/chains/ApiChain/OpenAPIChain.ts +++ b/packages/components/nodes/chains/ApiChain/OpenAPIChain.ts @@ -45,7 +45,7 @@ class OpenApiChain_Chains implements INode { async init(nodeData: INodeData): Promise { const model = nodeData.inputs?.model as ChatOpenAI - const headers = nodeData.inputs?.headers as Record + const headers = nodeData.inputs?.headers as string const yamlFileBase64 = nodeData.inputs?.yamlFile as string const splitDataURI = yamlFileBase64.split(',') splitDataURI.pop() @@ -53,7 +53,7 @@ class OpenApiChain_Chains implements INode { const utf8String = bf.toString('utf-8') const chain = await createOpenAPIChain(utf8String, { llm: model, - headers + headers: typeof headers === 'object' ? headers : headers ? JSON.parse(headers) : {} }) return chain }