fixes
This commit is contained in:
@@ -277,6 +277,7 @@ func (s *Service) Resolve(ctx context.Context, companyID uuid.UUID) (Resolved, e
|
||||
if strings.TrimSpace(platform.APIKey) == "" {
|
||||
return Resolved{ModeLabel: ModeInternalLabel, UsingBYOK: false}, nil
|
||||
}
|
||||
modeLabel := platformModeLabel(platform.Source, platform.BaseURL)
|
||||
client := processing.NewOpenAIClient(
|
||||
platform.APIKey,
|
||||
platform.BaseURL,
|
||||
@@ -284,17 +285,29 @@ func (s *Service) Resolve(ctx context.Context, companyID uuid.UUID) (Resolved, e
|
||||
rpm,
|
||||
retries,
|
||||
)
|
||||
client.ModeLabel = ModeInternalLabel
|
||||
client.ModeLabel = modeLabel
|
||||
if s.HTTPClient != nil {
|
||||
client.HTTPClient = s.HTTPClient
|
||||
}
|
||||
return Resolved{
|
||||
Completer: client,
|
||||
ModeLabel: ModeInternalLabel,
|
||||
ModeLabel: modeLabel,
|
||||
UsingBYOK: false,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// platformModeLabel maps platform OpenAI source/base to analytics ModeLabel.
|
||||
// DB-backed admin settings → internal; env bootstrap or mock/loopback → custom.
|
||||
func platformModeLabel(source, baseURL string) string {
|
||||
if processing.IsMockOrLoopbackBaseURL(baseURL) {
|
||||
return ModeCustomLabel
|
||||
}
|
||||
if strings.TrimSpace(source) == platformsettings.SourceEnv {
|
||||
return ModeCustomLabel
|
||||
}
|
||||
return ModeInternalLabel
|
||||
}
|
||||
|
||||
func (s *Service) platformConfigured(ctx context.Context) (bool, error) {
|
||||
oi, err := s.resolvePlatformOpenAI(ctx)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user