From d38d4d2d26b1e97ecf919710d8468f7acfd21c39 Mon Sep 17 00:00:00 2001 From: DBT Date: Thu, 26 Feb 2026 14:15:44 +0000 Subject: [PATCH] agent: add non-empty fallback when model returns empty final content --- pkg/agent/loop.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index 612b828..f29b2ae 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -690,8 +690,12 @@ func (al *AgentLoop) processMessage(ctx context.Context, msg bus.InboundMessage) } } - if finalContent == "" { - finalContent = "" + if strings.TrimSpace(finalContent) == "" { + fallback := strings.TrimSpace(al.noResponseFallback) + if fallback == "" { + fallback = "在的,我刚刚这条回复丢了。请再说一次,我马上处理。" + } + finalContent = fallback } // Filter out ... content from user-facing response