feat: add foreman provider type for endpoint overrides
Build & push image / build-and-push (push) Successful in 7s
Build & push image / build-and-push (push) Successful in 7s
Accept "foreman" in both resolveModel (GADFLY_BASE_URL) and endpointProvider (GADFLY_ENDPOINT_*) switches, mapping to majordomo's ollama.Foreman() preset (handles foreman's non-streaming/long-poll quirks). Unlike the HTTPS-only LLM_* foreman:// DSN, the base URL is verbatim, so a plaintext http:// foreman queue works. Tests + README provider table + endpoint-aliases example updated. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
@@ -17,6 +17,21 @@ func TestEndpointProvider(t *testing.T) {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
})
|
||||
t.Run("foreman queue registers under its name", func(t *testing.T) {
|
||||
p, err := endpointProvider("m1", "foreman|http://foreman-m1:8080|tok")
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
// WithName(name) must win over the Foreman preset's default "foreman".
|
||||
if p.Name() != "m1" {
|
||||
t.Errorf("Name() = %q, want %q", p.Name(), "m1")
|
||||
}
|
||||
})
|
||||
t.Run("foreman without token", func(t *testing.T) {
|
||||
if _, err := endpointProvider("m5", "foreman|http://foreman-m5:8080"); err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
})
|
||||
for _, bad := range []string{"", "ollama", "noprovider-no-pipe", "mystery|http://x"} {
|
||||
t.Run("rejects "+bad, func(t *testing.T) {
|
||||
if _, err := endpointProvider("n", bad); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user