const colors = { blue: ['#1d4ed8', '#dbeafe'], cyan: ['#155e75', '#cffafe'], violet: ['#6d28d9', '#ede9fe'], indigo: ['#3730a3', '#e0e7ff'], orange: ['#9a3412', '#ffedd5'], teal: ['#115e59', '#ccfbf1'], gray: ['#475569', '#f1f5f9'], green: ['#166534', '#dcfce7'], red: ['#991b1b', '#fee2e2'], amber: ['#92400e', '#fef3c7'], } as const const categories: Record = {} const group = (color: keyof typeof colors, labels: string[]) => labels.forEach((label) => { categories[label] = color }) group('blue', ['CR/CRA/H/AP', 'CRV', 'CR配件', '参数']) group('cyan', ['Nova及系列', 'Nova配件', 'MG400', 'MG400配件', 'M1 Pro', '使用配置']) group('violet', ['人形机器人', '四六足机器人', '教育所有产品', 'X-Trainer', '咨询', '检索不到']) group('indigo', ['DobotStudio Pro', '仿真软件', '维护工具', '新示教器', 'VX500', '二次开发', '培训与学习']) group('orange', [ '码垛解决方案', '码垛插件', '焊接解决方案', '焊接插件', '移动复合机器人', '故障', '售后', '知识缺失', '知识过期', ]) group('teal', ['生态插件', '生态合作', '安全皮肤', '资料获取', '案例']) group('green', ['认证']) group('gray', ['未知', '其他', '问题质量差', '非知识范围', '—']) group('red', ['答案生成错误']) group('amber', ['结果不清', '待确认', '部分覆盖']) export const qaTagColumns = new Set(['coverage', 'is_correct', 'product_category', 'problem_type', 'root_cause']) export function qaFieldColors(field: string, label: string): { color: string; backgroundColor: string } { const tone = field === 'coverage' || field === 'is_correct' ? label === '是' ? 'green' : label === '否' ? 'red' : label === '待确认' || label === '部分覆盖' ? 'amber' : 'gray' : categories[label] || 'gray' const [color, backgroundColor] = colors[tone] return { color, backgroundColor } }