+12
-15
@@ -275,24 +275,21 @@ func titleFromFilename(name string) string {
|
|||||||
// definition the start-up validation uses, not a second string match here (#52).
|
// 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
|
// 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
|
// "<base> + <alt>, reconciled by <model>". Every word of it that is not that format's own
|
||||||
// composite of local models is local and one naming a cloud alias names that provider.
|
// 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) {
|
func cloudProvider(endpoint string) (string, bool) {
|
||||||
if strings.TrimSpace(endpoint) == "" {
|
|
||||||
return "", false
|
|
||||||
}
|
|
||||||
aliases := []string{}
|
|
||||||
for _, tok := range strings.Fields(endpoint) {
|
for _, tok := range strings.Fields(endpoint) {
|
||||||
if tok = strings.Trim(tok, ","); strings.Contains(tok, "/") {
|
tok = strings.Trim(tok, ",")
|
||||||
aliases = append(aliases, tok)
|
switch tok {
|
||||||
|
case "", "+", "reconciled", "by":
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
}
|
if !config.IsLocalModel(tok) {
|
||||||
if len(aliases) == 0 {
|
provider, _, _ := strings.Cut(tok, "/")
|
||||||
aliases = append(aliases, strings.TrimSpace(endpoint))
|
if provider == "" {
|
||||||
}
|
provider = tok
|
||||||
for _, a := range aliases {
|
}
|
||||||
if !config.IsLocalModel(a) {
|
|
||||||
provider, _, _ := strings.Cut(a, "/")
|
|
||||||
return provider, true
|
return provider, true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,3 +82,24 @@ func TestUploadStatus_AReconciledEndpointNamingACloudEngineStillNamesTheCloudPro
|
|||||||
|
|
||||||
assert.Contains(t, b, "cloud service (berget)")
|
assert.Contains(t, b, "cloud service (berget)")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// An alias without a provider prefix is not a local model, wherever it sits in the
|
||||||
|
// composite: it must never be dropped from the judgement (PR #58 re-review).
|
||||||
|
func TestUploadStatus_AReconciledEndpointWithAnUnprefixedAliasIsNotCalledLocal(t *testing.T) {
|
||||||
|
for _, endpoint := range []string{
|
||||||
|
"iguana/kb-whisper + whisper-1, reconciled by iguana/gemma4-26b",
|
||||||
|
"iguana/kb-whisper + whisper 1, reconciled by iguana/gemma4-26b",
|
||||||
|
"iguana/kb-whisper + berget / x, reconciled by iguana/gemma4-26b",
|
||||||
|
} {
|
||||||
|
t.Run(endpoint, func(t *testing.T) {
|
||||||
|
app, _ := newUploadApp(t, audioOK, 200<<20)
|
||||||
|
id := seedUpload(t, userID, "m", "done", "Synthetic transcript text.")
|
||||||
|
setEndpoint(t, id, endpoint)
|
||||||
|
|
||||||
|
b := body(t, do(t, app, get("/uploads/"+id+"/status")))
|
||||||
|
|
||||||
|
assert.Contains(t, b, "left the homelab")
|
||||||
|
assert.NotContains(t, b, "cloud service ()", "the note names a provider")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user