feat: use language-neutral English prompts for multilingual LLM responses
Convert all LLM-facing prompts, templates, and tool output labels to language-neutral English so the model responds in the user's input language. Update frontend relevance/match-type mappings to match. Output language strategy: - User-facing: reply in user's input language - Vector-indexed: match source document language - LLM-internal: fixed English
This commit is contained in:
@@ -1178,7 +1178,7 @@ func (t *KnowledgeSearchTool) formatOutput(
|
||||
}
|
||||
|
||||
// Add statistics and recommendations for each knowledge
|
||||
output += "\n=== 检索统计与建议 ===\n\n"
|
||||
output += "\n=== Retrieval Statistics ===\n\n"
|
||||
for knowledgeID, retrievedChunks := range knowledgeChunkMap {
|
||||
totalChunks := knowledgeTotalMap[knowledgeID]
|
||||
retrievedCount := len(retrievedChunks)
|
||||
@@ -1188,10 +1188,10 @@ func (t *KnowledgeSearchTool) formatOutput(
|
||||
percentage := float64(retrievedCount) / float64(totalChunks) * 100
|
||||
remaining := totalChunks - int64(retrievedCount)
|
||||
|
||||
output += fmt.Sprintf("文档: %s (%s)\n", title, knowledgeID)
|
||||
output += fmt.Sprintf(" 总 Chunk 数: %d\n", totalChunks)
|
||||
output += fmt.Sprintf(" 已召回: %d 个 (%.1f%%)\n", retrievedCount, percentage)
|
||||
output += fmt.Sprintf(" 未召回: %d 个\n", remaining)
|
||||
output += fmt.Sprintf("Document: %s (%s)\n", title, knowledgeID)
|
||||
output += fmt.Sprintf(" Total Chunks: %d\n", totalChunks)
|
||||
output += fmt.Sprintf(" Retrieved: %d (%.1f%%)\n", retrievedCount, percentage)
|
||||
output += fmt.Sprintf(" Remaining: %d\n", remaining)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1255,10 +1255,10 @@ func (t *KnowledgeSearchTool) getEnrichedPassage(ctx context.Context, result *ty
|
||||
var imageTexts []string
|
||||
for _, img := range imageInfos {
|
||||
if img.Caption != "" {
|
||||
imageTexts = append(imageTexts, fmt.Sprintf("图片描述: %s", img.Caption))
|
||||
imageTexts = append(imageTexts, fmt.Sprintf("Image Caption: %s", img.Caption))
|
||||
}
|
||||
if img.OCRText != "" {
|
||||
imageTexts = append(imageTexts, fmt.Sprintf("图片文本: %s", img.OCRText))
|
||||
imageTexts = append(imageTexts, fmt.Sprintf("Image Text: %s", img.OCRText))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user