Initial commit of Descrybe v2 without local scratch artifacts.

Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
2026-08-09 22:47:43 +02:00
commit 8580c996c3
1285 changed files with 325780 additions and 0 deletions
@@ -0,0 +1,63 @@
package aiprovider
import (
"context"
"testing"
"github.com/descrybe/descrybe-v2/apps/api/internal/platformsettings"
)
func TestResolvePlatformOpenAI_envOnly(t *testing.T) {
svc := &Service{
Env: EnvConfig{
OpenAIAPIKey: "sk-env-fallback",
OpenAIBaseURL: "https://api.openai.com/v1",
OpenAIModel: "gpt-4o-mini",
},
}
oi, err := svc.resolvePlatformOpenAI(context.Background())
if err != nil {
t.Fatal(err)
}
if oi.APIKey != "sk-env-fallback" || oi.Source != platformsettings.SourceEnv {
t.Fatalf("got key=%q source=%q", oi.APIKey, oi.Source)
}
ok, err := svc.platformConfigured(context.Background())
if err != nil || !ok {
t.Fatalf("configured=%v err=%v", ok, err)
}
}
func TestResolvePlatformOpenAI_unset(t *testing.T) {
svc := &Service{Env: EnvConfig{}}
oi, err := svc.resolvePlatformOpenAI(context.Background())
if err != nil {
t.Fatal(err)
}
if oi.APIKey != "" || oi.Source != platformsettings.SourceNone {
t.Fatalf("got key=%q source=%q", oi.APIKey, oi.Source)
}
ok, err := svc.platformConfigured(context.Background())
if err != nil || ok {
t.Fatalf("configured=%v err=%v", ok, err)
}
}
func TestResolvePlatformOpenAI_viaPlatformService(t *testing.T) {
plat := platformsettings.NewService(nil, platformsettings.EnvConfig{
OpenAIAPIKey: "sk-from-plat-env",
OpenAIBaseURL: "http://127.0.0.1:8767/v1",
OpenAIModel: "local-model",
})
svc := &Service{Platform: plat, Env: EnvConfig{OpenAIAPIKey: "sk-should-not-win"}}
oi, err := svc.resolvePlatformOpenAI(context.Background())
if err != nil {
t.Fatal(err)
}
if oi.APIKey != "sk-from-plat-env" {
t.Fatalf("key=%q", oi.APIKey)
}
if oi.Source != platformsettings.SourceEnv {
t.Fatalf("source=%q", oi.Source)
}
}