From 2473ce3770296f0661af159a517f213cb8375ed9 Mon Sep 17 00:00:00 2001 From: Dobiichi-Origami <56953648+Dobiichi-Origami@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:05:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E6=B5=8B=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go/qianfan/chat_completion.go | 2 +- go/qianfan/completion.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go/qianfan/chat_completion.go b/go/qianfan/chat_completion.go index 9d9c5c05..0a2b1c68 100644 --- a/go/qianfan/chat_completion.go +++ b/go/qianfan/chat_completion.go @@ -330,7 +330,7 @@ func (c *ChatCompletion) Do(ctx context.Context, request *ChatCompletionRequest) return nil, runErr } - if resp.ModelAPIError.ErrorMsg != "" { + if resp != nil && resp.ModelAPIError.ErrorMsg != "" { return nil, fmt.Errorf( "code: %d, message: %s", resp.ModelAPIError.ErrorCode, diff --git a/go/qianfan/completion.go b/go/qianfan/completion.go index 8e0e45be..2848c01e 100644 --- a/go/qianfan/completion.go +++ b/go/qianfan/completion.go @@ -135,7 +135,7 @@ func (c *Completion) Do(ctx context.Context, request *CompletionRequest) (*Model return nil, runErr } - if resp.ModelAPIError.ErrorMsg != "" { + if resp != nil && resp.ModelAPIError.ErrorMsg != "" { return nil, fmt.Errorf( "code: %d, message: %s", resp.ModelAPIError.ErrorCode,