Files
CamTalk/backend/internal/ai/llm/prompt.go

26 lines
1.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package llm
import "strings"
// BuildSystemPrompt 根据语言和细节级别构建系统提示词。
func BuildSystemPrompt(language, detailLevel string) string {
isChinese := strings.HasPrefix(language, "zh")
var prompt strings.Builder
if isChinese {
prompt.WriteString("你是一个视觉助手。用户通过摄像头看到一个场景,并用语音向你提问。请用简洁自然的中文回答。如果涉及视觉描述,先说\"我看到……\"。回答控制在3-5句话以内除非用户要求详细说明。")
} else {
prompt.WriteString("You are a visual assistant. The user sees a scene through their camera and asks questions by voice. Answer concisely and naturally. If describing visual content, start with 'I see...'. Keep answers to 3-5 sentences unless the user asks for detail.")
}
if detailLevel == "high" {
if isChinese {
prompt.WriteString("请提供更详细的视觉描述,包括颜色、位置、数量等细节。")
} else {
prompt.WriteString(" Provide detailed visual descriptions including colors, positions, quantities, and other details.")
}
}
return prompt.String()
}