44406b72db
Moteva-style AI design workbench replica. Home prompt creates a project; the project page provides an infinite canvas with node drag, zoom/pan, a design chat panel, history replay, image asset upload, and project save/regenerate. - Backend: go-zero, DDD layering, sqlc/pgx, optional PostgreSQL; memory or Redis cache; asynq job queue; MinIO/S3/R2/OSS object storage; sky-valley/pi agent runtime adapter. - Frontend: Next.js App Router + Vite artifact build, TypeScript, i18n, shadcn/ui components, auth (OTP/Turnstile/Google/WeChat). - Deploy: Docker Compose and k3s manifests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package piagent
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
"unicode/utf8"
|
|
|
|
"img_infinite_canvas/internal/domain/design"
|
|
)
|
|
|
|
func TestNewCreativeAgentDefaultsToGPT55(t *testing.T) {
|
|
agent := NewCreativeAgent(CreativeAgentOptions{
|
|
BaseURL: "http://example.com",
|
|
APIKey: "test-key",
|
|
})
|
|
if agent == nil {
|
|
t.Fatal("expected creative agent")
|
|
}
|
|
if agent.model != "gpt-5.5" {
|
|
t.Fatalf("expected gpt-5.5 default model, got %s", agent.model)
|
|
}
|
|
}
|
|
|
|
func TestAgentMessageContentSummaryDoesNotLeakImageURLs(t *testing.T) {
|
|
summary := agentMessageContentSummary([]design.AgentChatMessage{
|
|
{
|
|
Contents: []design.AgentContent{
|
|
{Type: "text", Text: strings.Repeat("视觉方向", 200)},
|
|
{Type: "image", ImageURL: "https://storage.example.com/private/raw.png", ImageWidth: 100, ImageHeight: 200},
|
|
},
|
|
},
|
|
})
|
|
if strings.Contains(summary, "storage.example.com") || strings.Contains(summary, "raw.png") {
|
|
t.Fatalf("expected compact image reference without raw URL, got %s", summary)
|
|
}
|
|
if utf8.RuneCountInString(summary) > 360 {
|
|
t.Fatalf("expected compact inline text summary, got %d runes", utf8.RuneCountInString(summary))
|
|
}
|
|
}
|