From 9267c5f12e3a324181e26371bd76a5b2c9d3fd7f Mon Sep 17 00:00:00 2001 From: haochun <759869747@qq.com> Date: Wed, 9 Oct 2024 14:46:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=81=E5=BC=8F=E7=9A=84?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=EF=BC=8C=E6=8C=89=E7=85=A7=E6=B5=81=E5=BC=8F?= =?UTF-8?q?=E7=9A=84=E6=A0=BC=E5=BC=8F=E5=8E=BB=E8=BE=93=E5=87=BA=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E7=9B=B4=E6=8E=A5return?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 6 +++--- relay/adaptor/ali/main.go | 12 ++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index ade561e4..60ef0302 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,15 +5,15 @@ COPY ./VERSION . COPY ./web . WORKDIR /web/default -RUN npm install +RUN npm config set registry https://mirrors.huaweicloud.com/repository/npm/ && npm install RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build WORKDIR /web/berry -RUN npm install +RUN npm config set registry https://mirrors.huaweicloud.com/repository/npm/ && npm install RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build WORKDIR /web/air -RUN npm install +RUN npm config set registry https://mirrors.huaweicloud.com/repository/npm/ && npm install RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat VERSION) npm run build FROM golang:alpine AS builder2 diff --git a/relay/adaptor/ali/main.go b/relay/adaptor/ali/main.go index bd0d3344..a77da8c7 100644 --- a/relay/adaptor/ali/main.go +++ b/relay/adaptor/ali/main.go @@ -202,7 +202,8 @@ func StreamHandler(c *gin.Context, resp *http.Response) (*model.ErrorWithStatusC // Check for known error codes and handle accordingly if aliResponse.Code != "" { - return &model.ErrorWithStatusCode{ + + errorResponse := &model.ErrorWithStatusCode{ Error: model.Error{ Message: aliResponse.Message, Type: aliResponse.Code, @@ -210,7 +211,14 @@ func StreamHandler(c *gin.Context, resp *http.Response) (*model.ErrorWithStatusC Code: aliResponse.Code, }, StatusCode: resp.StatusCode, - }, nil + } + + err = render.ObjectData(c, errorResponse) + if err != nil { + logger.SysError(err.Error()) + } + render.Done(c) + return nil, nil } if aliResponse.Usage.OutputTokens != 0 {