完美呈現 AI 成果
This commit is contained in:
@@ -338,8 +338,19 @@ export async function POST(request: NextRequest) {
|
|||||||
|
|
||||||
// 為每個 criteria 添加 strengths 和 improvements
|
// 為每個 criteria 添加 strengths 和 improvements
|
||||||
for (const criteriaData of fullData.criteria) {
|
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
|
// 添加 strengths
|
||||||
if (criteriaData.strengths && criteriaData.strengths.length > 0) {
|
if (criteriaData.strengths && criteriaData.strengths.length > 0) {
|
||||||
|
@@ -52,7 +52,7 @@ const criteriaNameToId: Record<string, number> = {
|
|||||||
"創新性": 53,
|
"創新性": 53,
|
||||||
"成效與效益": 54,
|
"成效與效益": 54,
|
||||||
"擴散與可複用性": 55,
|
"擴散與可複用性": 55,
|
||||||
"簡報與表達": 56
|
"簡報與表達": 56 // 注意:資料庫中的名稱末尾有零寬度空格,但這裡使用清理後的名稱
|
||||||
};
|
};
|
||||||
|
|
||||||
export class EvaluationUploadService {
|
export class EvaluationUploadService {
|
||||||
@@ -178,8 +178,16 @@ export class EvaluationUploadService {
|
|||||||
|
|
||||||
// 2. 各項標準的反饋
|
// 2. 各項標準的反饋
|
||||||
for (const criteria of aiResult.criteria) {
|
for (const criteria of aiResult.criteria) {
|
||||||
const criteriaItemId = criteriaNameToId[criteria.name];
|
// 清理名稱中的特殊字符,包括零寬度空格
|
||||||
if (!criteriaItemId) continue;
|
const cleanName = criteria.name.replace(/[\u200B-\u200D\uFEFF]/g, '').trim();
|
||||||
|
const criteriaItemId = criteriaNameToId[cleanName];
|
||||||
|
|
||||||
|
console.log(`🔍 處理 criteria: "${criteria.name}" -> 清理後: "${cleanName}" -> ID: ${criteriaItemId}`);
|
||||||
|
|
||||||
|
if (!criteriaItemId) {
|
||||||
|
console.warn(`⚠️ 找不到 criteria_item_id for: "${cleanName}"`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// 標準反饋
|
// 標準反饋
|
||||||
await query(sql, [
|
await query(sql, [
|
||||||
|
BIN
uploads/projects/25/1758640239292_xue04wm9w.pptx
Normal file
BIN
uploads/projects/25/1758640239292_xue04wm9w.pptx
Normal file
Binary file not shown.
BIN
uploads/projects/26/1758640840561_g35s5avq9.pptx
Normal file
BIN
uploads/projects/26/1758640840561_g35s5avq9.pptx
Normal file
Binary file not shown.
BIN
uploads/projects/27/1758640969869_zwgnqodtb.pptx
Normal file
BIN
uploads/projects/27/1758640969869_zwgnqodtb.pptx
Normal file
Binary file not shown.
BIN
uploads/projects/28/1758641041760_2bbp7o2tl.pptx
Normal file
BIN
uploads/projects/28/1758641041760_2bbp7o2tl.pptx
Normal file
Binary file not shown.
Reference in New Issue
Block a user