fix: 常问话题英文翻译(contract review等)
CI / 后端测试 (push) Has been cancelled
CI / 前端构建 (push) Has been cancelled

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
selfrelease
2026-08-31 15:09:10 +08:00
co-authored by Devin
parent ddf0fa57ee
commit cde32d2dc7
+40 -2
View File
@@ -341,6 +341,44 @@ const SOURCE_LABELS: Record<string, string> = {
manual: '用户确认', manual: '用户确认',
} }
/** 常问话题中文映射 */
const TOPIC_LABELS: Record<string, string> = {
'contract review': '合同审查',
'work-life balance': '工作生活平衡',
'tax': '税务',
'expansion': '扩张',
'financing': '融资',
'labor': '劳动用工',
'employment': '劳动用工',
'litigation': '诉讼',
'contract': '合同',
'shareholder': '股东',
'debt': '债务',
'salary': '薪资',
'social security': '社保',
'work injury': '工伤',
'termination': '辞退',
'decision': '决策',
'pricing': '定价',
'hiring': '招聘',
'layoff': '裁员',
'partnership': '合伙',
'investment': '投资',
'family': '家庭',
'health': '健康',
'stress': '压力',
'sleep': '睡眠',
'parenting': '亲子',
'education': '教育',
'marriage': '婚姻',
}
/** 翻译常问话题 */
function translateTopic(topic: string): string {
const lower = topic.toLowerCase().trim()
return TOPIC_LABELS[lower] || topic
}
/** 格式化字段值 */ /** 格式化字段值 */
function formatValue(key: string, value: string): string { function formatValue(key: string, value: string): string {
if (key === 'company_size') return SIZE_LABELS[value] || value if (key === 'company_size') return SIZE_LABELS[value] || value
@@ -427,7 +465,7 @@ export function MyProfile() {
<p className="mb-1 text-xs text-muted-foreground">常问话题</p> <p className="mb-1 text-xs text-muted-foreground">常问话题</p>
<div className="flex flex-wrap gap-1"> <div className="flex flex-wrap gap-1">
{(hp.common_topics as string[]).map((t, i) => ( {(hp.common_topics as string[]).map((t, i) => (
<Badge key={i} variant="secondary" className="text-[10px] px-1 py-0">{String(t)}</Badge> <Badge key={i} variant="secondary" className="text-[10px] px-1 py-0">{translateTopic(String(t))}</Badge>
))} ))}
</div> </div>
</div> </div>
@@ -501,7 +539,7 @@ export function MyProfile() {
<p className="mb-1 text-xs text-muted-foreground">常问话题</p> <p className="mb-1 text-xs text-muted-foreground">常问话题</p>
<div className="flex flex-wrap gap-1"> <div className="flex flex-wrap gap-1">
{profile.common_topics.map((t, i) => ( {profile.common_topics.map((t, i) => (
<Badge key={i} variant="secondary" className="text-[10px] px-1 py-0">{t}</Badge> <Badge key={i} variant="secondary" className="text-[10px] px-1 py-0">{translateTopic(t)}</Badge>
))} ))}
</div> </div>
</div> </div>