to:sync
This commit is contained in:
parent
73c5062c45
commit
bc6978ef77
@ -28,8 +28,8 @@ func InitAiGroup(g *echo.Group) {
|
|||||||
key := utils.ToString(corpId) + "_" + utils.ToString(bizId) + "_" + utils.ToString(uid)
|
key := utils.ToString(corpId) + "_" + utils.ToString(bizId) + "_" + utils.ToString(uid)
|
||||||
groupId := utils.GetCache(key)
|
groupId := utils.GetCache(key)
|
||||||
result, err := remote_http.AiApi.Completions(ctx, req.Prompt, groupId)
|
result, err := remote_http.AiApi.Completions(ctx, req.Prompt, groupId)
|
||||||
if err != nil {
|
if err != nil || result == nil {
|
||||||
return c.JSON(500, err)
|
return c.JSON(http.StatusOK, utils.Failed(err.Error()))
|
||||||
}
|
}
|
||||||
|
|
||||||
//缓存
|
//缓存
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"ai-gateway/common/dto"
|
"ai-gateway/common/dto"
|
||||||
"ai-gateway/common/utils"
|
"ai-gateway/common/utils"
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -25,14 +26,13 @@ func (aiApiImpl) Completions(ctx context.Context, prompt, groupId string) (*dto.
|
|||||||
SetSuccessResult(&aiResult).
|
SetSuccessResult(&aiResult).
|
||||||
Post(url)
|
Post(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
||||||
logger.Error(fmt.Sprintf("remote_http_wx_SendMsg error: %s", err.Error()))
|
logger.Error(fmt.Sprintf("remote_http_wx_SendMsg error: %s", err.Error()))
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !resp.IsSuccessState() {
|
if !resp.IsSuccessState() {
|
||||||
logger.Error(fmt.Sprintf("remote_http_wx_SendMsg resp:%+v", resp))
|
logger.Error(fmt.Sprintf("remote_http_wx_SendMsg resp:%+v", resp))
|
||||||
return nil, err
|
return nil, errors.New("接口异常")
|
||||||
}
|
}
|
||||||
|
|
||||||
return &aiResult.Data, nil
|
return &aiResult.Data, nil
|
||||||
|
@ -32,7 +32,7 @@ job "${APP_NAME}-${CI_COMMIT_BRANCH}-job" {
|
|||||||
network_mode = "djLay"
|
network_mode = "djLay"
|
||||||
# No port map required.
|
# No port map required.
|
||||||
|
|
||||||
volumes = ["/opt/settings/server.properties:/opt/settings/server.properties"]
|
# volumes = ["/opt/settings/server.properties:/opt/settings/server.properties"]
|
||||||
|
|
||||||
auth {
|
auth {
|
||||||
server_address = "${CI_REGISTRY}"
|
server_address = "${CI_REGISTRY}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user