added -model
This commit is contained in:
+16
-4
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func TestHunyuanServiceEndpoint(t *testing.T) {
|
||||
svc := NewHunyuanService("https://example.com/gradio/")
|
||||
svc := NewHunyuanService("https://example.com/gradio/", "")
|
||||
if svc.endpoint != "https://example.com/gradio" {
|
||||
t.Errorf("expected trailing slash stripped, got %q", svc.endpoint)
|
||||
}
|
||||
@@ -21,6 +21,18 @@ func TestHunyuanServiceEndpoint(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCustomModelNameConfiguration(t *testing.T) {
|
||||
svc := NewHunyuanService("https://example.com/gradio", "hunyuan-custom-v1")
|
||||
if svc.modelName != "hunyuan-custom-v1" {
|
||||
t.Errorf("expected modelName 'hunyuan-custom-v1', got %q", svc.modelName)
|
||||
}
|
||||
|
||||
models := svc.ListModels()
|
||||
if len(models) != 1 || models[0].ID != "hunyuan-custom-v1" {
|
||||
t.Fatalf("expected model ID 'hunyuan-custom-v1', got %v", models)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseGradioStreamData(t *testing.T) {
|
||||
sampleJSON := `[["Hello world", "Thinking process...", null]]`
|
||||
c, r, tc, ok := parseGradioStreamData(sampleJSON)
|
||||
@@ -60,7 +72,7 @@ func TestHunyuanMockedCompletion(t *testing.T) {
|
||||
server := httptest.NewServer(handler)
|
||||
defer server.Close()
|
||||
|
||||
svc := NewHunyuanService(server.URL)
|
||||
svc := NewHunyuanService(server.URL, "hy3")
|
||||
|
||||
rec := httptest.NewRecorder()
|
||||
req, _ := http.NewRequest("POST", "/v1/chat/completions", nil)
|
||||
@@ -146,7 +158,7 @@ func TestHunyuanToolCallingNonStreaming(t *testing.T) {
|
||||
server := httptest.NewServer(handler)
|
||||
defer server.Close()
|
||||
|
||||
svc := NewHunyuanService(server.URL)
|
||||
svc := NewHunyuanService(server.URL, "hy3")
|
||||
rec := httptest.NewRecorder()
|
||||
req, _ := http.NewRequest("POST", "/v1/chat/completions", nil)
|
||||
|
||||
@@ -230,7 +242,7 @@ func TestHunyuanReasoningAndToolCallingStreaming(t *testing.T) {
|
||||
server := httptest.NewServer(handler)
|
||||
defer server.Close()
|
||||
|
||||
svc := NewHunyuanService(server.URL)
|
||||
svc := NewHunyuanService(server.URL, "hy3")
|
||||
rec := httptest.NewRecorder()
|
||||
req, _ := http.NewRequest("POST", "/v1/chat/completions", nil)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user