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:
@@ -3,9 +3,9 @@
|
||||
* TypeScript interfaces for all tool result types
|
||||
*/
|
||||
|
||||
// Relevance levels — values match the backend API response (Chinese literals).
|
||||
// Relevance levels — values match the backend API response.
|
||||
// Display labels are resolved via i18n in SearchResults.vue and GraphQueryResults.vue.
|
||||
export type RelevanceLevel = '高相关' | '中相关' | '低相关' | '弱相关';
|
||||
export type RelevanceLevel = 'High Relevance' | 'Medium Relevance' | 'Low Relevance' | 'Weak Relevance';
|
||||
|
||||
// Display types
|
||||
export type DisplayType =
|
||||
|
||||
@@ -31,15 +31,15 @@ const matchTypeIconKeys: Record<string, string> = {
|
||||
graph: '🕸️',
|
||||
};
|
||||
|
||||
// Match type to icon mapping (Chinese keys preserved for API compatibility)
|
||||
// Match type to icon mapping (keys match backend API response)
|
||||
export const matchTypeIcons: Record<string, string> = {
|
||||
'向量匹配': '🎯',
|
||||
'关键词匹配': '🔤',
|
||||
'相邻块匹配': '📌',
|
||||
'历史匹配': '📜',
|
||||
'父块匹配': '⬆️',
|
||||
'关系块匹配': '🔗',
|
||||
'图谱匹配': '🕸️',
|
||||
'Vector Match': '🎯',
|
||||
'Keyword Match': '🔤',
|
||||
'Adjacent Chunk Match': '📌',
|
||||
'History Match': '📜',
|
||||
'Parent Chunk Match': '⬆️',
|
||||
'Relation Chunk Match': '🔗',
|
||||
'Graph Match': '🕸️',
|
||||
};
|
||||
|
||||
// Get icon for a tool name
|
||||
|
||||
@@ -76,20 +76,20 @@ const toggleResult = (chunkId: string) => {
|
||||
|
||||
const getRelevanceClass = (level: RelevanceLevel): string => {
|
||||
const classMap: Record<RelevanceLevel, string> = {
|
||||
'高相关': 'high',
|
||||
'中相关': 'medium',
|
||||
'低相关': 'low',
|
||||
'弱相关': 'weak',
|
||||
'High Relevance': 'high',
|
||||
'Medium Relevance': 'medium',
|
||||
'Low Relevance': 'low',
|
||||
'Weak Relevance': 'weak',
|
||||
};
|
||||
return classMap[level] || 'weak';
|
||||
};
|
||||
|
||||
const getRelevanceLabel = (level: RelevanceLevel): string => {
|
||||
const labelMap: Record<RelevanceLevel, string> = {
|
||||
'高相关': t('chat.relevanceHigh'),
|
||||
'中相关': t('chat.relevanceMedium'),
|
||||
'低相关': t('chat.relevanceLow'),
|
||||
'弱相关': t('chat.relevanceWeak'),
|
||||
'High Relevance': t('chat.relevanceHigh'),
|
||||
'Medium Relevance': t('chat.relevanceMedium'),
|
||||
'Low Relevance': t('chat.relevanceLow'),
|
||||
'Weak Relevance': t('chat.relevanceWeak'),
|
||||
};
|
||||
return labelMap[level] || level;
|
||||
};
|
||||
|
||||
@@ -98,20 +98,20 @@ const hasOtherParams = computed(() => {
|
||||
|
||||
const getRelevanceClass = (level: RelevanceLevel): string => {
|
||||
const classMap: Record<RelevanceLevel, string> = {
|
||||
'高相关': 'high',
|
||||
'中相关': 'medium',
|
||||
'低相关': 'low',
|
||||
'弱相关': 'weak',
|
||||
'High Relevance': 'high',
|
||||
'Medium Relevance': 'medium',
|
||||
'Low Relevance': 'low',
|
||||
'Weak Relevance': 'weak',
|
||||
};
|
||||
return classMap[level] || 'weak';
|
||||
};
|
||||
|
||||
const getRelevanceLabel = (level: RelevanceLevel): string => {
|
||||
const labelMap: Record<RelevanceLevel, string> = {
|
||||
'高相关': t('chat.relevanceHigh'),
|
||||
'中相关': t('chat.relevanceMedium'),
|
||||
'低相关': t('chat.relevanceLow'),
|
||||
'弱相关': t('chat.relevanceWeak'),
|
||||
'High Relevance': t('chat.relevanceHigh'),
|
||||
'Medium Relevance': t('chat.relevanceMedium'),
|
||||
'Low Relevance': t('chat.relevanceLow'),
|
||||
'Weak Relevance': t('chat.relevanceWeak'),
|
||||
};
|
||||
return labelMap[level] || level;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user