fix(web): judge every word of a reconciled endpoint that is not a connector, so an unprefixed alias is not called local (#52)
CI / Lint / Test / Vet (pull_request) Successful in 33s
CI / Build & Import (pull_request) Skipped
CI / Deploy via GitOps (pull_request) Skipped

The previous version kept only words containing '/' and dropped the rest, so a bare
TAPIR_TRANSCRIBE_MODEL alias in the composite produced a false 'all local' result. Found
by the PR #58 re-review; red tests for a bare alias, an alias with a space and a split
'berget / x' first.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-04 00:22:41 +02:00
co-authored by Claude Sonnet 5.5
parent c24573bd9f
commit 67bd0350a3
2 changed files with 33 additions and 15 deletions
+12 -15
View File
@@ -275,24 +275,21 @@ func titleFromFilename(name string) string {
// definition the start-up validation uses, not a second string match here (#52).
//
// The endpoint is one alias, except for the two-engine path (ADR-034), which writes
// "<base> + <alt>, reconciled by <model>". Every alias in it is judged on its own, so a
// composite of local models is local and one naming a cloud alias names that provider.
// "<base> + <alt>, reconciled by <model>". Every word of it that is not that format's own
// connector is judged as an alias, so a composite of local models is local, and anything
// else (a cloud alias, one with no provider prefix, one with a space in it) is not.
func cloudProvider(endpoint string) (string, bool) {
if strings.TrimSpace(endpoint) == "" {
return "", false
}
aliases := []string{}
for _, tok := range strings.Fields(endpoint) {
if tok = strings.Trim(tok, ","); strings.Contains(tok, "/") {
aliases = append(aliases, tok)
tok = strings.Trim(tok, ",")
switch tok {
case "", "+", "reconciled", "by":
continue
}
}
if len(aliases) == 0 {
aliases = append(aliases, strings.TrimSpace(endpoint))
}
for _, a := range aliases {
if !config.IsLocalModel(a) {
provider, _, _ := strings.Cut(a, "/")
if !config.IsLocalModel(tok) {
provider, _, _ := strings.Cut(tok, "/")
if provider == "" {
provider = tok
}
return provider, true
}
}