OpenAI-compatible AI gateway with Vue admin UI, multi-provider egress, ingress key governance, monitoring, and security controls. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/rose_cat707/luminary/internal/provider"
|
||||
)
|
||||
|
||||
func TestExtractAPIErrorMessage_OpenAI(t *testing.T) {
|
||||
body := []byte(`{"error":{"message":"Invalid API key","type":"invalid_request_error"}}`)
|
||||
got := extractAPIErrorMessage(body)
|
||||
if got != "invalid_request_error: Invalid API key" {
|
||||
t.Fatalf("got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDescribeForwardError_WithBody(t *testing.T) {
|
||||
got := describeForwardError(nil, &provider.ChatResponse{
|
||||
StatusCode: 400,
|
||||
Body: []byte(`{"error":{"message":"model not found"}}`),
|
||||
})
|
||||
if got != "status 400: model not found" {
|
||||
t.Fatalf("got %q", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user