logoBetterYeah AI 帮助文档

On this page

Code 节点

目前支持 Javascript 和 Python,Code 节点中的代码封装在函数中,返回语句用于输出函数的结果。返回的任何结果都可以在后续步骤中使用。

在代码中使用其它节点输出的变量

Javascript

下面是一个 Javascript 代码,它使用了一个Start 节点 输入变量 和前一个 LLM 节点的输出:

// 获取start节点的 content 变量
let start_content = content;
// 获取之前 LLM 节点的输出结果
let llm_output = llm_1;
// 将输入内容和 LLM 输出结果进行合
let combined_text =
"Content: " + start_content + " | LLM Output: " + llm_output;
// 返回合并的文本
return combined_text;

image-20230920230555882

Python

# 获取start节点的 content 变量
start_content = content
# 获取之前 LLM 节点的输出结果
llm_output = llm_1
# 将输入内容和 LLM 输出结果进行合
combined_text = "Content: " + start_content + " | LLM Output: " + llm_output
# 返回合并的文本
return combined_text

支持的内置库

javascript 支持 axios、dayjs、lodash、uuid

python 支持 requests、rsa

Memory 节点API 节点
Copyright © 2024 | Powered by BetterYeah AI