Добавил логи

This commit is contained in:
2026-06-14 19:37:09 +03:00
parent d4bf8a8cad
commit 81ed58ecff
28 changed files with 379 additions and 121 deletions
+6 -6
View File
@@ -20,7 +20,7 @@ func newTestProvider(t *testing.T, baseURL, apiKey string) *openAICompat {
BaseURL: baseURL,
APIKey: apiKey,
Model: "test-model",
})
}, nil)
if err != nil {
t.Fatalf("newOpenAICompat: %v", err)
}
@@ -215,22 +215,22 @@ func TestComplete_EmptyMessages(t *testing.T) {
}
func TestNew_UnknownType(t *testing.T) {
if _, err := New(Config{Type: "anthropic", Model: "x", BaseURL: "http://x"}); err == nil {
if _, err := New(Config{Type: "anthropic", Model: "x", BaseURL: "http://x"}, nil); err == nil {
t.Fatal("want error for unknown type")
}
if _, err := New(Config{Type: ""}); err == nil {
if _, err := New(Config{Type: ""}, nil); err == nil {
t.Fatal("want error for empty type")
}
}
func TestNew_OpenAICompatValidation(t *testing.T) {
if _, err := New(Config{Type: "openai-compat", Model: "x"}); err == nil {
if _, err := New(Config{Type: "openai-compat", Model: "x"}, nil); err == nil {
t.Fatal("want error for empty base_url")
}
if _, err := New(Config{Type: "openai-compat", BaseURL: "http://x"}); err == nil {
if _, err := New(Config{Type: "openai-compat", BaseURL: "http://x"}, nil); err == nil {
t.Fatal("want error for empty model")
}
if _, err := New(Config{Type: "openai-compat", BaseURL: "http://x", Model: "m"}); err != nil {
if _, err := New(Config{Type: "openai-compat", BaseURL: "http://x", Model: "m"}, nil); err != nil {
t.Fatalf("unexpected error: %v", err)
}
}