fix: sync legacy model EnableBase64Url config and handle not found er… (#2366)

This commit is contained in:
Ryo
2025-10-22 11:43:00 +08:00
committed by GitHub
parent 496daf8684
commit d80f8ecebd
2 changed files with 18 additions and 3 deletions

View File

@ -282,6 +282,10 @@ func toNewModel(old *OldModel) (*Model, error) {
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",
conv.DebugJsonToStr(old), conv.DebugJsonToStr(m))
@ -360,6 +364,7 @@ type OldConfig struct {
TopK *int `json:"top_k,omitempty" yaml:"top_k"`
Stop []string `json:"stop,omitempty" yaml:"stop"`
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"`
Claude *ClaudeConfig `json:"claude,omitempty" yaml:"claude"`

View File

@ -18,12 +18,14 @@ package singleagent
import (
"context"
"errors"
"sort"
"time"
"github.com/coze-dev/coze-studio/backend/api/model/app/developer_api"
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/pkg/kvstore"
"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/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) {
pubInfo, err := s.PublishInfoRepo.Get(ctx, consts.PublishInfoKeyPrefix, conv.Int64ToStr(agentID))
pubInfo, err := s.GetPublishedInfo(ctx, agentID)
if err != nil {
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 {
now := time.Now().UnixMilli()
pubInfo, err := s.PublishInfoRepo.Get(ctx, consts.PublishInfoKeyPrefix, conv.Int64ToStr(agentID))
pubInfo, err := s.GetPublishedInfo(ctx, agentID)
if err != nil {
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) {
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) {