feat(studio): 新增 Studio 工作流编辑/运行页,优化顶部三栏对齐

- 后端:项目/运行 API、上下文服务与数据模型
- 前端:Studio 列表、编辑页(R1/R2 布局)、运行页与节点图
- 编辑页顶部:CSS Grid 统一标签行与控件行对齐,项目按钮独立第三行
- Docker 开发配置与文档脚本

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-31 21:24:57 +08:00
parent bc130d98f4
commit fa6907fb8d
48 changed files with 8795 additions and 20 deletions

View File

@@ -0,0 +1,37 @@
/**
* Backend workflow variable ref → Chinese display label.
* Mirrors data/agent/workflow_variables.json builtIn entries.
*/
export const BUILTIN_WORKFLOW_VARIABLE_LABELS = {
'workflow.goal': '工作流目标文本',
'workflow.boundWorldbook': '绑定世界书摘要',
'workflow.boundCharacter': '绑定角色卡摘要',
};
/** Build ref → label map from /api/studio/variables response. */
export function buildWorkflowVariableLabelMap(workflowVariables) {
const map = { ...BUILTIN_WORKFLOW_VARIABLE_LABELS };
const builtIn = workflowVariables?.builtIn || [];
const dynamic = workflowVariables?.dynamic || [];
[...builtIn, ...dynamic].forEach((item) => {
if (item?.ref && item?.label) {
map[item.ref] = item.label;
}
});
return map;
}
/**
* Resolve Chinese label for a workflow variable key shown in run preview.
* @param {string} ref - e.g. workflow.goal or nodeId.output
* @param {Record<string, string>} [labelMap] - optional map from buildWorkflowVariableLabelMap
*/
export function getWorkflowVariableLabel(ref, labelMap = BUILTIN_WORKFLOW_VARIABLE_LABELS) {
if (!ref) return '';
if (labelMap[ref]) return labelMap[ref];
const outputMatch = ref.match(/^([^.]+)\.output$/);
if (outputMatch) {
return `${outputMatch[1]} · 世界书条目`;
}
return ref;
}