name: 测试工作流
description: |
这是一个测试工作流,用于测试工作流的执行流程。
on_error:
use_llm: false
output_format: |
**当前工作流{{ flow.name }}执行发生错误!**
错误信息:{{ error.message }}
steps:
start:
node: none
name: 开始
description: 开始工作流
pos:
x: 100
y: 100
query_data:
node: api
name: 查询数据
description: 从API中查询测试数据
pos:
x: 100
y: 100
params:
endpoint: GET /api/test
check_data:
node: choice
name: 判断数据
description: 判断工具的返回值是否包含有效数据
pos:
x: 200
y: 100
params:
propose: 上一步返回值是否包含有效数据?
choices:
- branch: valid
description: 返回值存在有效数据
- branch: invalid
description: 返回值不存在有效数据
gen_reply:
node: llm
name: 生成回复
description: 使用大模型生成回复
pos:
x: 300
y: 100
depends:
- format_output
params:
system: 你是一个擅长Linux系统性能优化,且能够根据具体情况撰写分析报告的智能助手。
user: |
上下文:
{{ context }}
当前时间:
{{ time }}
主机信息:
{{ start.output.result.machines[0] }}
测试数据:{{ storage[-1].output.result.machines[0].data }}
使用自然语言解释这一信息,并展示为Markdown列表。
format_output:
node: convert
name: 格式化输出
description: 按照特定格式输出
pos:
x: 400
y: 100
params:
message: |
声明: 这是一份由AI生成的报告,仅供参考。
时间: {{ time }}
机器ID: {{ start.output.result.machines[0].id }}
{% if storage[-1].output.result.machines[0].data %}
......
{% endif %}
output: |
{
"id": storage[-1].id,
"time": extras.time,
"machines": [x for x.id in storage[-1].output.result.machines]
}
gen_suggest:
node: suggest
name: 问题推荐
description: 推荐问题
pos:
x: 500
y: 100
params:
num: 3
configs:
- flow_id: flow_01
question: 这是固定的推荐问题
- flow_id: flow_02
end:
node: none
name: 结束
description: 结束工作流
pos:
x: 600
y: 100
edges:
- id: edge_00
from: start
to: query_data
type: normal
- id: edge_01
from: query_data
to: check_data
- id: edge_02
from: check_data.valid
to: gen_reply
- id: edge_03
from: check_data.invalid
to: format_output
- id: edge_04
from: gen_reply
to: end
- id: edge_05
from: format_output
to: end