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] != "" {