fix: sync legacy model EnableBase64Url config and handle not found er… (#2366)
This commit is contained in:
@ -282,6 +282,10 @@ func toNewModel(old *OldModel) (*Model, error) {
|
|||||||
m.Connection.Claude = modelMeta.Connection.Claude
|
m.Connection.Claude = modelMeta.Connection.Claude
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if old.Meta.ConnConfig.EnableBase64Url != nil {
|
||||||
|
m.EnableBase64URL = *old.Meta.ConnConfig.EnableBase64Url
|
||||||
|
}
|
||||||
|
|
||||||
logs.Debugf("to new model, old: %v \n new %v",
|
logs.Debugf("to new model, old: %v \n new %v",
|
||||||
conv.DebugJsonToStr(old), conv.DebugJsonToStr(m))
|
conv.DebugJsonToStr(old), conv.DebugJsonToStr(m))
|
||||||
|
|
||||||
@ -360,6 +364,7 @@ type OldConfig struct {
|
|||||||
TopK *int `json:"top_k,omitempty" yaml:"top_k"`
|
TopK *int `json:"top_k,omitempty" yaml:"top_k"`
|
||||||
Stop []string `json:"stop,omitempty" yaml:"stop"`
|
Stop []string `json:"stop,omitempty" yaml:"stop"`
|
||||||
EnableThinking *bool `json:"enable_thinking,omitempty" yaml:"enable_thinking,omitempty"`
|
EnableThinking *bool `json:"enable_thinking,omitempty" yaml:"enable_thinking,omitempty"`
|
||||||
|
EnableBase64Url *bool `json:"enable_base64_url,omitempty" yaml:"enable_base64_url,omitempty"`
|
||||||
|
|
||||||
OpenAI *OpenAIConfig `json:"open_ai,omitempty" yaml:"openai"`
|
OpenAI *OpenAIConfig `json:"open_ai,omitempty" yaml:"openai"`
|
||||||
Claude *ClaudeConfig `json:"claude,omitempty" yaml:"claude"`
|
Claude *ClaudeConfig `json:"claude,omitempty" yaml:"claude"`
|
||||||
|
|||||||
@ -18,12 +18,14 @@ package singleagent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"sort"
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/coze-dev/coze-studio/backend/api/model/app/developer_api"
|
"github.com/coze-dev/coze-studio/backend/api/model/app/developer_api"
|
||||||
crossconnector "github.com/coze-dev/coze-studio/backend/crossdomain/contract/connector"
|
crossconnector "github.com/coze-dev/coze-studio/backend/crossdomain/contract/connector"
|
||||||
"github.com/coze-dev/coze-studio/backend/domain/agent/singleagent/entity"
|
"github.com/coze-dev/coze-studio/backend/domain/agent/singleagent/entity"
|
||||||
|
"github.com/coze-dev/coze-studio/backend/pkg/kvstore"
|
||||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/conv"
|
"github.com/coze-dev/coze-studio/backend/pkg/lang/conv"
|
||||||
"github.com/coze-dev/coze-studio/backend/pkg/logs"
|
"github.com/coze-dev/coze-studio/backend/pkg/logs"
|
||||||
"github.com/coze-dev/coze-studio/backend/types/consts"
|
"github.com/coze-dev/coze-studio/backend/types/consts"
|
||||||
@ -44,7 +46,7 @@ func (s *singleAgentImpl) SavePublishRecord(ctx context.Context, p *entity.Singl
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *singleAgentImpl) GetPublishedTime(ctx context.Context, agentID int64) (int64, error) {
|
func (s *singleAgentImpl) GetPublishedTime(ctx context.Context, agentID int64) (int64, error) {
|
||||||
pubInfo, err := s.PublishInfoRepo.Get(ctx, consts.PublishInfoKeyPrefix, conv.Int64ToStr(agentID))
|
pubInfo, err := s.GetPublishedInfo(ctx, agentID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
@ -54,7 +56,7 @@ func (s *singleAgentImpl) GetPublishedTime(ctx context.Context, agentID int64) (
|
|||||||
|
|
||||||
func (s *singleAgentImpl) UpdatePublishInfo(ctx context.Context, agentID int64, connectorIDs []int64) error {
|
func (s *singleAgentImpl) UpdatePublishInfo(ctx context.Context, agentID int64, connectorIDs []int64) error {
|
||||||
now := time.Now().UnixMilli()
|
now := time.Now().UnixMilli()
|
||||||
pubInfo, err := s.PublishInfoRepo.Get(ctx, consts.PublishInfoKeyPrefix, conv.Int64ToStr(agentID))
|
pubInfo, err := s.GetPublishedInfo(ctx, agentID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -83,7 +85,15 @@ func (s *singleAgentImpl) UpdatePublishInfo(ctx context.Context, agentID int64,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *singleAgentImpl) GetPublishedInfo(ctx context.Context, agentID int64) (*entity.PublishInfo, error) {
|
func (s *singleAgentImpl) GetPublishedInfo(ctx context.Context, agentID int64) (*entity.PublishInfo, error) {
|
||||||
return s.PublishInfoRepo.Get(ctx, consts.PublishInfoKeyPrefix, conv.Int64ToStr(agentID))
|
pubInfo, err := s.PublishInfoRepo.Get(ctx, consts.PublishInfoKeyPrefix, conv.Int64ToStr(agentID))
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, kvstore.ErrKeyNotFound) {
|
||||||
|
return &entity.PublishInfo{}, nil
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return pubInfo, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *singleAgentImpl) GetPublishConnectorList(ctx context.Context, agentID int64) (*entity.PublishConnectorData, error) {
|
func (s *singleAgentImpl) GetPublishConnectorList(ctx context.Context, agentID int64) (*entity.PublishConnectorData, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user