From c22d578e1ae363e5ef89e1db9e3272151b81b9a3 Mon Sep 17 00:00:00 2001 From: WangLiZhao <1838393649@qq.com> Date: Thu, 11 Jun 2026 11:27:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(task):=20=E4=BF=AE=E5=A4=8D=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E7=8A=B6=E6=80=81=E6=9B=B4=E6=96=B0=E5=92=8C=E8=B6=85?= =?UTF-8?q?=E6=97=B6=E5=A4=84=E7=90=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/prompt/prompt_build_service.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/service/prompt/prompt_build_service.go b/service/prompt/prompt_build_service.go index f84dfd4..4fb896e 100644 --- a/service/prompt/prompt_build_service.go +++ b/service/prompt/prompt_build_service.go @@ -47,8 +47,11 @@ func buildStructTypeRequest(ctx context.Context, req *dto.ComposeMessagesReq, ch // compileToProviderRequest 编译为 Provider 请求 func compileToProviderRequest(ctx context.Context, ir *IR, chatModel *gateway.AsynchModel, req *dto.ComposeMessagesReq, customPrompt ...string) (map[string]any, error) { protocol, err := GetProtocolByProvider(ctx, chatModel.OperatorName) - if err != nil || protocol == nil { - return nil, fmt.Errorf("协议配置不存在或获取失败: %w", err) + if err != nil { + return nil, err + } + if protocol == nil { + return nil, fmt.Errorf("协议配置不存在或获取失败") } // 如果传了自定义提示词,替换掉协议模板 if len(customPrompt) > 0 && customPrompt[0] != "" {