This commit is contained in:
shaoyongjun 2024-02-21 12:37:24 +08:00
parent 73c5062c45
commit bc6978ef77
3 changed files with 5 additions and 5 deletions

View File

@ -28,8 +28,8 @@ func InitAiGroup(g *echo.Group) {
key := utils.ToString(corpId) + "_" + utils.ToString(bizId) + "_" + utils.ToString(uid)
groupId := utils.GetCache(key)
result, err := remote_http.AiApi.Completions(ctx, req.Prompt, groupId)
if err != nil {
return c.JSON(500, err)
if err != nil || result == nil {
return c.JSON(http.StatusOK, utils.Failed(err.Error()))
}
//缓存

View File

@ -4,6 +4,7 @@ import (
"ai-gateway/common/dto"
"ai-gateway/common/utils"
"context"
"errors"
"fmt"
)
@ -25,14 +26,13 @@ func (aiApiImpl) Completions(ctx context.Context, prompt, groupId string) (*dto.
SetSuccessResult(&aiResult).
Post(url)
if err != nil {
logger.Error(fmt.Sprintf("remote_http_wx_SendMsg error: %s", err.Error()))
return nil, err
}
if !resp.IsSuccessState() {
logger.Error(fmt.Sprintf("remote_http_wx_SendMsg resp:%+v", resp))
return nil, err
return nil, errors.New("接口异常")
}
return &aiResult.Data, nil

View File

@ -32,7 +32,7 @@ job "${APP_NAME}-${CI_COMMIT_BRANCH}-job" {
network_mode = "djLay"
# No port map required.
volumes = ["/opt/settings/server.properties:/opt/settings/server.properties"]
# volumes = ["/opt/settings/server.properties:/opt/settings/server.properties"]
auth {
server_address = "${CI_REGISTRY}"