Files
xinmi/internal/application/service/image_multimodal_prompt_test.go
T

30 lines
834 B
Go
Raw Normal View History

package service
import (
"context"
"strings"
"testing"
"github.com/Tencent/WeKnora/internal/types"
)
func TestBuildVLMCaptionPrompt(t *testing.T) {
t.Run("uses configured language and custom instructions", func(t *testing.T) {
got := buildVLMCaptionPrompt(context.Background(), types.VLMConfig{
DescriptionLanguage: "English",
CustomInstructions: "Focus on alarm codes.",
})
if !strings.Contains(got, "in English") || !strings.Contains(got, "Focus on alarm codes.") {
t.Fatalf("unexpected prompt: %s", got)
}
})
t.Run("defaults to context language", func(t *testing.T) {
ctx := context.WithValue(context.Background(), types.LanguageContextKey, "ko-KR")
got := buildVLMCaptionPrompt(ctx, types.VLMConfig{})
if !strings.Contains(got, "in Korean") {
t.Fatalf("unexpected prompt: %s", got)
}
})
}