feat(workflow): enhance AI agent workflow state management and response handling

This commit is contained in:
mlogclub
2026-06-24 17:56:23 +08:00
parent 0b5a24975c
commit a628d103f9
9 changed files with 172 additions and 5 deletions
@@ -125,7 +125,7 @@ func TestPrepareWorkflowAgentRejectsMissingPublishedWorkflow(t *testing.T) {
if err == nil {
t.Fatalf("expected missing workflow version error")
}
if !strings.Contains(err.Error(), "workflow version is required") {
if !strings.Contains(err.Error(), "AI Agent workflow is not published") {
t.Fatalf("unexpected error: %v", err)
}
}
@@ -23,7 +23,7 @@ type resolvedWorkflow struct {
func resolveAgentWorkflow(aiAgent models.AIAgent) (resolvedWorkflow, error) {
if aiAgent.WorkflowVersionID <= 0 {
return resolvedWorkflow{}, errorsx.InvalidParam("workflow version is required")
return resolvedWorkflow{}, errorsx.InvalidParam("AI Agent workflow is not published; publish a workflow version before enabling automatic replies")
}
version := repositories.AIWorkflowVersionRepository.Get(sqls.DB(), aiAgent.WorkflowVersionID)
if version == nil || version.Status != enums.StatusOk {