feat: filter meaningful conversations with local model

This commit is contained in:
Codex Local
2026-08-30 15:20:08 +08:00
parent 89f6641331
commit 522785eda8
18 changed files with 451 additions and 45 deletions
+25
View File
@@ -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")
}
}