feat: filter meaningful conversations with local model
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package contentmodel
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestValidateInputAllowsComposeOllamaEndpoint(t *testing.T) {
|
||||
input := CreateInput{
|
||||
TenantID: "10000000-0000-0000-0000-000000000001", DisplayName: "本地 Qwen",
|
||||
Provider: "openai_compatible", BaseURL: "http://ollama:11434/v1", ModelID: "qwen2.5:7b",
|
||||
APIKey: "ollama-local-key", Temperature: 0.1, MaxTokens: 1200,
|
||||
}
|
||||
if err := validateInput(input); err != nil {
|
||||
t.Fatalf("compose Ollama endpoint was rejected: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateInputRejectsUnapprovedPlainHTTPEndpoint(t *testing.T) {
|
||||
input := CreateInput{
|
||||
TenantID: "10000000-0000-0000-0000-000000000001", DisplayName: "不安全端点",
|
||||
Provider: "openai_compatible", BaseURL: "http://metadata.internal/v1", ModelID: "model",
|
||||
APIKey: "test-api-key", Temperature: 0.1, MaxTokens: 1200,
|
||||
}
|
||||
if err := validateInput(input); err == nil {
|
||||
t.Fatal("unapproved plaintext endpoint was accepted")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user