This commit is contained in:
2026-08-16 16:57:36 +02:00
parent 96f8c1115c
commit 532d439c41
106 changed files with 10147 additions and 494 deletions
+15 -2
View File
@@ -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 {