完美呈現 AI 成果
This commit is contained in:
@@ -338,8 +338,19 @@ export async function POST(request: NextRequest) {
|
||||
|
||||
// 為每個 criteria 添加 strengths 和 improvements
|
||||
for (const criteriaData of fullData.criteria) {
|
||||
const criteriaItem = criteria.find(c => c.name === criteriaData.name);
|
||||
if (!criteriaItem) continue;
|
||||
// 使用清理後的名稱進行匹配
|
||||
const cleanCriteriaDataName = criteriaData.name.trim().replace(/[\u200B-\u200D\uFEFF]/g, '');
|
||||
const criteriaItem = criteria.find(c => {
|
||||
const cleanCriteriaName = c.name.trim().replace(/[\u200B-\u200D\uFEFF]/g, '');
|
||||
return cleanCriteriaName === cleanCriteriaDataName;
|
||||
});
|
||||
|
||||
if (!criteriaItem) {
|
||||
console.warn(`⚠️ 找不到對應的評分標準: "${criteriaData.name}" (清理後: "${cleanCriteriaDataName}")`);
|
||||
continue;
|
||||
}
|
||||
|
||||
console.log(`🔍 處理 criteria: "${criteriaData.name}" -> 匹配到: "${criteriaItem.name}" (ID: ${criteriaItem.id})`);
|
||||
|
||||
// 添加 strengths
|
||||
if (criteriaData.strengths && criteriaData.strengths.length > 0) {
|
||||
|
Reference in New Issue
Block a user