Fix: align go provider apis with python apis (#16867)

### Summary

As title.

---------

Co-authored-by: Jin Hai <haijin.chn@gmail.com>
Co-authored-by: Wang Qi <wangq8@outlook.com>
This commit is contained in:
Lynn
2026-07-14 21:06:11 +08:00
committed by GitHub
parent 55d5879622
commit bd7a3bb878
18 changed files with 790 additions and 577 deletions

View File

@@ -199,46 +199,6 @@ func TestSplitCompositeLLMID(t *testing.T) {
}
}
func TestCategorize_ResolvesTenantLLMCredentials(t *testing.T) {
db := setupComponentTestDB(t)
pushComponentDB(t, db)
apiKey := "tenant-llm-key"
apiBase := "https://tenant-llm.example"
modelName := "Qwen/Qwen3-8B"
if err := db.Create(&entity.TenantLLM{
TenantID: "tenant-1",
LLMFactory: "SILICONFLOW",
LLMName: &modelName,
APIKey: &apiKey,
APIBase: &apiBase,
Status: "1",
}).Error; err != nil {
t.Fatalf("create tenant_llm: %v", err)
}
stub := &stubInvoker{resp: &ChatInvokeResponse{Content: "support", Model: "stub"}}
withStubInvoker(t, stub)
c := NewCategorizeComponent(CategorizeParam{
ModelID: "Qwen/Qwen3-8B@default@SILICONFLOW",
Categories: []string{"sales", "support"},
DefaultCategory: "support",
})
_, err := c.Invoke(stateWithTenant("tenant-1"), map[string]any{})
if err != nil {
t.Fatalf("Invoke: %v", err)
}
if stub.captured == nil {
t.Fatal("invoker not called")
}
if stub.captured.APIKey != apiKey {
t.Fatalf("APIKey=%q, want %q", stub.captured.APIKey, apiKey)
}
if stub.captured.BaseURL != apiBase {
t.Fatalf("BaseURL=%q, want %q", stub.captured.BaseURL, apiBase)
}
}
func TestCategorize_ResolvesTenantModelInstanceCredentials(t *testing.T) {
db := setupComponentTestDB(t)
pushComponentDB(t, db)
@@ -387,7 +347,6 @@ func setupComponentTestDB(t *testing.T) *gorm.DB {
t.Fatalf("open sqlite: %v", err)
}
if err := db.AutoMigrate(
&entity.TenantLLM{},
&entity.TenantModelProvider{},
&entity.TenantModelInstance{},
&entity.TenantModel{},