feat: 支持工作流断点续跑并拆分错误信息存储

- 新增同会话+同工作流最近执行失败且参数一致时断点续跑逻辑
- exec_workflow/exec_chat 新增 error 字段存储原始错误,error_message 仅存友好提示
- 新增 UpdateExecChatReq 与 exec_chat_dao Update 方法
- 新增 GetLatestBySessionAndFlow 查询最近执行记录
- 修正 ListDates 分组与排序 SQL 表达式
- 新增 pipeline 配置结构,删除旧设计文档
This commit is contained in:
2026-08-21 09:54:06 +08:00
parent a939c45508
commit cef837a35c
34 changed files with 1519 additions and 515 deletions
@@ -35,8 +35,9 @@ const defaultScriptTranscribeSystemPrompt = `你是短剧分镜脚本师。请
时间码需前后衔接、覆盖整个内容时长。直接输出 JSON 数组,不要输出其他文字。`
// ScriptTranscribeLambda 脚本转写节点:
// 把节点输入(文案/视频分析结果,经 valueSource 解析)通过大模型转写为固定结构的 []domain.Shot
// 产出为 [{"shots": [...]}],供视频生成节点的 ModelRequestParams.shots 引用。
// 把节点输入(文案/视频分析结果,经 valueSource 解析)通过大模型转写为 []pipeline.Shot
// 再经 split_shots_pipeline 前置处理器拆成各段扁平请求参数列表([{"prompt","duration","seed",...},...]),
// 供下游视频生成节点逐段引用聚合。
func ScriptTranscribeLambda(ctx context.Context, input any) (any, error) {
nodeInput, ok := input.(*flowDto.NodeExecutionInput)
if !ok {
@@ -53,14 +54,31 @@ func ScriptTranscribeLambda(ctx context.Context, input any) (any, error) {
for _, item := range *n {
switch item.Field {
case "totalDuration":
totalDuration = gconv.Int(item.Value)
if !g.IsEmpty(item.Value) {
totalDuration = gconv.Int(item.Value)
} else {
if !g.IsEmpty(item.ValueSource) {
for _, k := range item.ValueSource {
nodeConfig := nodeInput.Global.ConfigMap[k.NodeId]
if nodeConfig != nil {
for _, output := range nodeConfig.OutputResult {
if !g.IsEmpty(output[k.Field]) {
totalDuration = gconv.Int(output[k.Field])
}
}
}
}
}
}
case "modelId":
modelId = gconv.Int64(item.Value)
}
}
// 1. 解析 valueSource 引用,填充节点输入
ProcessValueSourceRecursive(nodeInput.Config.ModelConfig.ModelRequestParams, nodeInput.Global)
modelParams, err := BuildModelRequestBody(nodeInput.Config.ModelConfig.ModelRequestParamsPath, nodeInput.Global)
if err != nil {
return nil, err
}
// 2. 构建系统提示词 + 用户输入
systemPrompt := nodeInput.Config.Prompt
@@ -104,7 +122,7 @@ func ScriptTranscribeLambda(ctx context.Context, input any) (any, error) {
if err != nil {
return "", fmt.Errorf("获取模型配置失败: %w", err)
}
result, err := gateway.ModelCallResult(ctx, nodeInput.Config.ModelConfig.ModelId, modelInfo.ModelManage.ResponseType, nodeInput.Global.SessionId, nodeInput.Config.ModelConfig.ModelRequestParams, params)
result, err := gateway.ModelCallResult(ctx, nodeInput.Config.ModelConfig.ModelId, modelInfo.ModelManage.ResponseType, nodeInput.Global.SessionId, modelParams, params)
if err != nil {
return nil, err
}