feat(定时任务): 模板数据转换器对话页加「页面模板+渲染预览」调试入口
- 后端 POST /api/scheduled-tasks/template-fill/render:不调模型,抽取回复里的 JSON → 校验 → 填充,返回完整 HTML + 校验错误/缺失字段(非法也照样填充便于看效果), 只展示模板原样返回 - 前端仅 template-json-builder 智能体的 AgentChatPage:顶部加页面模板下拉 +「渲染预览」 按钮,取最近一条 AI 回复填进所选模板,弹窗用 sandbox=allow-scripts iframe 预览 + 校验状态;严格按 agent id 门控,不影响其他智能体对话页 - 文档同步 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f551c7af9b
commit
ae3788a87d
5 files changed
+216
-2
No files matched your search
@@ -42,6 +42,26 @@ export async function listHtmlTemplates() {
|
||||
return data.templates ?? [];
|
||||
}
|
||||
|
||||
/** 「模板数据转换器」对话页「渲染预览」结果。 */
|
||||
export type TemplateRenderResult = {
|
||||
ok: boolean;
|
||||
display_only?: boolean;
|
||||
errors: string[];
|
||||
gaps: string[];
|
||||
html: string | null;
|
||||
};
|
||||
|
||||
/** 调试用:把一段(智能体回复的)文本里的 JSON 填进所选 HTML 模板,返回完整 HTML 与校验信息。 */
|
||||
export async function renderTemplateFill(templateId: string, text: string) {
|
||||
return parseResponse<TemplateRenderResult>(
|
||||
await apiFetch(`${baseUrl()}/template-fill/render`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ template_id: templateId, text }),
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
export interface ListScheduledTasksParams {
|
||||
search?: string;
|
||||
tagIds?: string[];
|
||||
|
||||
Reference in new issue
Block a user