fix(workflow): generate runnable drafts — snake_case names, correct output refs

This commit is contained in:
matevip 2026-05-18 17:35:00 +08:00
parent 4cf991851b
commit cda001b818

View File

@ -103,7 +103,16 @@ public class WorkflowDraftGenerator {
# 命名
workflow.name step.name 用英文 kebab-case (collect-sales-data / ask-finance-approval)description 用用户母语
workflow.name 用英文 kebab-case (daily-sales-summary)
step.name outputVar 一律用英文 snake_case (collect_sales_data / sales_summary)它们会作为标识符进入 Pebble 表达式连字符会被解析成减号导致工作流运行期崩溃绝不能在 step.name outputVar 里用连字符
description 用用户母语
# 跨步引用promptTemplate / dispatch content / write_memory content / expression 里引用上游产出
引用上游步骤的产出只能写 {{ outputs.<outputVar> }} <outputVar> 必须是某个更早步骤声明的 outputVar 字段绝对不是 step.name
outputContentType json 时可取子字段{{ outputs.<outputVar>.<field> }} text 时直接 {{ outputs.<outputVar> }}不带子字段
正例上游 step outputVar news_data 下游写 {{ outputs.news_data }}
反例{{ outputs.search-competitor-news.news_data }} 既用了 step.name 又带了连字符必然运行失败
# 占位字段
@ -184,6 +193,10 @@ public class WorkflowDraftGenerator {
.call()
.content();
} catch (Exception e) {
// Log the full cause chain the controller / agent tool only
// surface getMessage(), so without this a provider-side failure
// (auth, NPE in the chat client, ...) leaves no stack trace.
log.error("Workflow draft generator chat call failed", e);
throw new IllegalStateException(
"Workflow draft generator chat call failed: " + e.getMessage(), e);
}