修正 AI 產出結果
This commit is contained in:
@@ -16,6 +16,14 @@ export const metadata: Metadata = {
|
|||||||
title: "AI 評審系統",
|
title: "AI 評審系統",
|
||||||
description: "智能評審平台 - 上傳 PPT、影片和網站連結,獲得專業評分結果",
|
description: "智能評審平台 - 上傳 PPT、影片和網站連結,獲得專業評分結果",
|
||||||
generator: "v0.app",
|
generator: "v0.app",
|
||||||
|
icons: {
|
||||||
|
icon: [
|
||||||
|
{ url: "/artificial-intelligence.png", type: "image/png" },
|
||||||
|
{ url: "/favicon.ico", sizes: "any" }
|
||||||
|
],
|
||||||
|
shortcut: "/artificial-intelligence.png",
|
||||||
|
apple: "/artificial-intelligence.png",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function RootLayout({
|
export default function RootLayout({
|
||||||
|
@@ -27,65 +27,97 @@ import {
|
|||||||
import { Download, Share2, TrendingUp, AlertCircle, CheckCircle, Star } from "lucide-react"
|
import { Download, Share2, TrendingUp, AlertCircle, CheckCircle, Star } from "lucide-react"
|
||||||
import { useToast } from "@/hooks/use-toast"
|
import { useToast } from "@/hooks/use-toast"
|
||||||
|
|
||||||
// 模擬評分結果數據
|
// 模擬評分結果數據 - 使用您提到的例子:8, 7, 6, 8, 4,平均 = 6.6
|
||||||
|
const mockCriteria = [
|
||||||
|
{
|
||||||
|
name: "內容品質",
|
||||||
|
score: 8,
|
||||||
|
maxScore: 10,
|
||||||
|
weight: 25,
|
||||||
|
weightedScore: 20,
|
||||||
|
feedback: "內容結構清晰,資訊豐富且準確。建議增加更多實際案例來支撐論點。",
|
||||||
|
strengths: ["邏輯清晰", "資料準確", "結構完整"],
|
||||||
|
improvements: ["增加案例", "深化分析"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "視覺設計",
|
||||||
|
score: 7,
|
||||||
|
maxScore: 10,
|
||||||
|
weight: 20,
|
||||||
|
weightedScore: 14,
|
||||||
|
feedback: "整體設計風格統一,色彩搭配合理。部分頁面文字密度過高,影響閱讀體驗。",
|
||||||
|
strengths: ["風格統一", "色彩協調", "版面整潔"],
|
||||||
|
improvements: ["減少文字密度", "增加視覺元素"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "邏輯結構",
|
||||||
|
score: 6,
|
||||||
|
maxScore: 10,
|
||||||
|
weight: 20,
|
||||||
|
weightedScore: 12,
|
||||||
|
feedback: "邏輯架構清晰,各章節銜接自然,論述層次分明。",
|
||||||
|
strengths: ["邏輯清晰", "結構完整", "銜接自然"],
|
||||||
|
improvements: ["可增加總結回顧"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "創新性",
|
||||||
|
score: 8,
|
||||||
|
maxScore: 10,
|
||||||
|
weight: 15,
|
||||||
|
weightedScore: 12,
|
||||||
|
feedback: "內容具有一定創新性,但可以更大膽地提出獨特觀點和解決方案。",
|
||||||
|
strengths: ["思路新穎", "角度獨特"],
|
||||||
|
improvements: ["增加創新元素", "提出獨特見解"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "實用性",
|
||||||
|
score: 4,
|
||||||
|
maxScore: 10,
|
||||||
|
weight: 20,
|
||||||
|
weightedScore: 8,
|
||||||
|
feedback: "內容實用性有待提升,提供的解決方案需要更具可操作性。",
|
||||||
|
strengths: ["實用性強", "可操作性好", "價值明確"],
|
||||||
|
improvements: ["增加實施步驟"],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
// 計算 mock 數據的 overview - 基於平均分作為閾值
|
||||||
|
const calculateMockOverview = (criteria: any[]) => {
|
||||||
|
if (!criteria || criteria.length === 0) {
|
||||||
|
return {
|
||||||
|
excellentItems: 0,
|
||||||
|
improvementItems: 0,
|
||||||
|
overallPerformance: 0
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 計算所有項目的平均分數(不考慮權重)
|
||||||
|
const totalScore = criteria.reduce((sum, item) => sum + item.score, 0);
|
||||||
|
const averageScore = totalScore / criteria.length;
|
||||||
|
|
||||||
|
// 以平均分作為閾值
|
||||||
|
// ≥ 平均分 = 優秀項目,< 平均分 = 待改進項目
|
||||||
|
const excellentItems = criteria.filter(item => item.score >= averageScore).length;
|
||||||
|
const improvementItems = criteria.filter(item => item.score < averageScore).length;
|
||||||
|
|
||||||
|
// 整體表現:基於權重的加權平均分數
|
||||||
|
const overallPerformance = Math.round(criteria.reduce((sum, item) => sum + (item.score / item.maxScore) * item.weight, 0));
|
||||||
|
|
||||||
|
return {
|
||||||
|
excellentItems,
|
||||||
|
improvementItems,
|
||||||
|
overallPerformance
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const mockResults = {
|
const mockResults = {
|
||||||
projectTitle: "產品介紹簡報",
|
projectTitle: "產品介紹簡報",
|
||||||
overallScore: 82,
|
overallScore: 82,
|
||||||
totalPossible: 100,
|
totalPossible: 100,
|
||||||
grade: "B+",
|
grade: "B+",
|
||||||
analysisDate: "2024-01-15",
|
analysisDate: "2024-01-15",
|
||||||
criteria: [
|
criteria: mockCriteria,
|
||||||
{
|
overview: calculateMockOverview(mockCriteria),
|
||||||
name: "內容品質",
|
|
||||||
score: 8.5,
|
|
||||||
maxScore: 10,
|
|
||||||
weight: 25,
|
|
||||||
weightedScore: 21.25,
|
|
||||||
feedback: "內容結構清晰,資訊豐富且準確。建議增加更多實際案例來支撐論點。",
|
|
||||||
strengths: ["邏輯清晰", "資料準確", "結構完整"],
|
|
||||||
improvements: ["增加案例", "深化分析"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "視覺設計",
|
|
||||||
score: 7.8,
|
|
||||||
maxScore: 10,
|
|
||||||
weight: 20,
|
|
||||||
weightedScore: 15.6,
|
|
||||||
feedback: "整體設計風格統一,色彩搭配合理。部分頁面文字密度過高,影響閱讀體驗。",
|
|
||||||
strengths: ["風格統一", "色彩協調", "版面整潔"],
|
|
||||||
improvements: ["減少文字密度", "增加視覺元素"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "邏輯結構",
|
|
||||||
score: 8.8,
|
|
||||||
maxScore: 10,
|
|
||||||
weight: 20,
|
|
||||||
weightedScore: 17.6,
|
|
||||||
feedback: "邏輯架構非常清晰,各章節銜接自然,論述層次分明。",
|
|
||||||
strengths: ["邏輯清晰", "結構完整", "銜接自然"],
|
|
||||||
improvements: ["可增加總結回顧"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "創新性",
|
|
||||||
score: 7.2,
|
|
||||||
maxScore: 10,
|
|
||||||
weight: 15,
|
|
||||||
weightedScore: 10.8,
|
|
||||||
feedback: "內容具有一定創新性,但可以更大膽地提出獨特觀點和解決方案。",
|
|
||||||
strengths: ["思路新穎", "角度獨特"],
|
|
||||||
improvements: ["增加創新元素", "提出獨特見解"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "實用性",
|
|
||||||
score: 8.3,
|
|
||||||
maxScore: 10,
|
|
||||||
weight: 20,
|
|
||||||
weightedScore: 16.6,
|
|
||||||
feedback: "內容實用性強,提供的解決方案具有可操作性,對目標受眾有實際價值。",
|
|
||||||
strengths: ["實用性強", "可操作性好", "價值明確"],
|
|
||||||
improvements: ["增加實施步驟"],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 圖表數據將在組件內部動態生成
|
// 圖表數據將在組件內部動態生成
|
||||||
@@ -166,14 +198,39 @@ export default function ResultsPage() {
|
|||||||
// 使用真實數據或回退到模擬數據
|
// 使用真實數據或回退到模擬數據
|
||||||
const results = evaluationData.evaluation?.fullData || mockResults
|
const results = evaluationData.evaluation?.fullData || mockResults
|
||||||
|
|
||||||
|
// 計算統計數據 - 基於 criteria_items 的平均分作為閾值
|
||||||
|
const calculateOverview = (criteria: any[]) => {
|
||||||
|
if (!criteria || criteria.length === 0) {
|
||||||
|
return {
|
||||||
|
excellentItems: 0,
|
||||||
|
improvementItems: 0,
|
||||||
|
overallPerformance: 0
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 計算所有項目的平均分數(不考慮權重)
|
||||||
|
const totalScore = criteria.reduce((sum, item) => sum + item.score, 0);
|
||||||
|
const averageScore = totalScore / criteria.length;
|
||||||
|
|
||||||
|
// 以平均分作為閾值
|
||||||
|
// ≥ 平均分 = 優秀項目,< 平均分 = 待改進項目
|
||||||
|
const excellentItems = criteria.filter(item => item.score >= averageScore).length;
|
||||||
|
const improvementItems = criteria.filter(item => item.score < averageScore).length;
|
||||||
|
|
||||||
|
// 整體表現:基於權重的加權平均分數
|
||||||
|
const overallPerformance = Math.round(criteria.reduce((sum, item) => sum + (item.score / item.maxScore) * item.weight, 0));
|
||||||
|
|
||||||
|
return {
|
||||||
|
excellentItems,
|
||||||
|
improvementItems,
|
||||||
|
overallPerformance
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
// 確保所有必要的數據結構存在
|
// 確保所有必要的數據結構存在
|
||||||
const safeResults = {
|
const safeResults = {
|
||||||
...results,
|
...results,
|
||||||
overview: results.overview || {
|
overview: results.overview || calculateOverview(results.criteria || []),
|
||||||
excellentItems: 0,
|
|
||||||
improvementItems: 0,
|
|
||||||
overallPerformance: 0
|
|
||||||
},
|
|
||||||
chartData: results.chartData || {
|
chartData: results.chartData || {
|
||||||
barChart: [],
|
barChart: [],
|
||||||
pieChart: [],
|
pieChart: [],
|
||||||
|
@@ -226,7 +226,7 @@ export default function UploadPage() {
|
|||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="space-y-4">
|
<CardContent className="space-y-4">
|
||||||
<div>
|
<div>
|
||||||
<Label htmlFor="project-title">專案標題 *</Label>
|
<Label htmlFor="project-title" className="mb-2 block">專案標題 *</Label>
|
||||||
<Input
|
<Input
|
||||||
id="project-title"
|
id="project-title"
|
||||||
value={projectTitle}
|
value={projectTitle}
|
||||||
@@ -235,7 +235,7 @@ export default function UploadPage() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Label htmlFor="project-description">專案描述</Label>
|
<Label htmlFor="project-description" className="mb-2 block">專案描述</Label>
|
||||||
<Textarea
|
<Textarea
|
||||||
id="project-description"
|
id="project-description"
|
||||||
value={projectDescription}
|
value={projectDescription}
|
||||||
|
@@ -11,9 +11,9 @@ import { FileText, Upload, Settings, BarChart3, Home, Menu, X } from "lucide-rea
|
|||||||
const navigation = [
|
const navigation = [
|
||||||
{ name: "首頁", href: "/", icon: Home },
|
{ name: "首頁", href: "/", icon: Home },
|
||||||
{ name: "上傳文件", href: "/upload", icon: Upload },
|
{ name: "上傳文件", href: "/upload", icon: Upload },
|
||||||
{ name: "評分標準", href: "/criteria", icon: Settings },
|
|
||||||
{ name: "評分結果", href: "/results", icon: BarChart3 },
|
{ name: "評分結果", href: "/results", icon: BarChart3 },
|
||||||
{ name: "歷史記錄", href: "/history", icon: FileText },
|
{ name: "歷史記錄", href: "/history", icon: FileText },
|
||||||
|
{ name: "評分標準", href: "/criteria", icon: Settings },
|
||||||
]
|
]
|
||||||
|
|
||||||
export function Sidebar() {
|
export function Sidebar() {
|
||||||
|
@@ -20,8 +20,8 @@ DB_USER=root
|
|||||||
DB_PASSWORD=zh6161168
|
DB_PASSWORD=zh6161168
|
||||||
|
|
||||||
# 應用程式配置
|
# 應用程式配置
|
||||||
NEXT_PUBLIC_APP_URL=http://localhost:3000
|
NEXT_PUBLIC_APP_URL=http://localhost:12024
|
||||||
NEXTAUTH_URL=http://localhost:3000
|
NEXTAUTH_URL=http://localhost:12024
|
||||||
NEXTAUTH_SECRET=your-secret-key-here
|
NEXTAUTH_SECRET=your-secret-key-here
|
||||||
|
|
||||||
# 文件上傳配置
|
# 文件上傳配置
|
||||||
|
@@ -142,15 +142,16 @@ ${pptContent}
|
|||||||
**評分標準:**
|
**評分標準:**
|
||||||
${criteriaList}
|
${criteriaList}
|
||||||
|
|
||||||
**評分要求:**
|
**評分要求:**
|
||||||
1. 請對每個評分項目給出 0 到滿分的分數
|
1. 請對每個評分項目給出 0 到滿分的分數,要敢於給出極高分(9-10分)和極低分(1-3分)
|
||||||
2. 為每個項目提供具體的評分理由、優點和改進建議
|
2. 為每個項目提供具體的評分理由、優點和改進建議
|
||||||
3. 計算總分(各項目分數 × 權重比例)
|
3. 計算總分(各項目分數 × 權重比例)
|
||||||
4. 提供整體評價和建議
|
4. 提供整體評價和建議
|
||||||
5. 分析優秀項目和待改進項目的數量
|
5. 分析優秀項目和待改進項目的數量
|
||||||
6. 給出等級評比 (S、A+、A、A-、B+、B、B-、C、D)
|
6. 給出等級評比 (S、A+、A、A-、B+、B、B-、C、D)
|
||||||
7. 給出表現狀態 (表現極優、表現良好、表現普通、表現有待加強)
|
7. 給出表現狀態 (表現極優、表現良好、表現普通、表現有待加強)
|
||||||
8. 給出推薦星星數量 (1-5顆星)
|
8. 給出推薦星星數量 (1-5顆星)
|
||||||
|
9. **重要:請根據實際內容質量給出真實評分,不要過於保守,優秀的內容應該得到高分,糟糕的內容應該得到低分**
|
||||||
|
|
||||||
**回應格式 (請嚴格按照以下 JSON 格式回應):**
|
**回應格式 (請嚴格按照以下 JSON 格式回應):**
|
||||||
{
|
{
|
||||||
@@ -279,18 +280,41 @@ ${criteriaList}
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 計算總覽統計
|
* 計算總覽統計 - 基於 criteria_items 的平均分作為閾值
|
||||||
*/
|
*/
|
||||||
private static calculateOverview(criteria: any[]): any {
|
private static calculateOverview(criteria: any[]): any {
|
||||||
// 調整判斷標準,使其更合理
|
if (!criteria || criteria.length === 0) {
|
||||||
const excellentItems = criteria.filter(item => (item.score / item.maxScore) >= 0.75).length; // 75%以上為優秀
|
return {
|
||||||
const improvementItems = criteria.filter(item => (item.score / item.maxScore) < 0.6).length; // 60%以下為待改進
|
excellentItems: 0,
|
||||||
const overallPerformance = criteria.reduce((sum, item) => sum + (item.score / item.maxScore) * item.weight, 0);
|
improvementItems: 0,
|
||||||
|
overallPerformance: 0
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 計算所有項目的平均分數(不考慮權重)
|
||||||
|
const totalScore = criteria.reduce((sum, item) => sum + item.score, 0);
|
||||||
|
const averageScore = totalScore / criteria.length;
|
||||||
|
|
||||||
|
console.log('🔍 計算 overview 統計:');
|
||||||
|
console.log(' 評分項目:', criteria.map(item => `${item.name}: ${item.score}/${item.maxScore}`));
|
||||||
|
console.log(' 總分:', totalScore);
|
||||||
|
console.log(' 平均分:', averageScore);
|
||||||
|
|
||||||
|
// 以平均分作為閾值
|
||||||
|
// ≥ 平均分 = 優秀項目,< 平均分 = 待改進項目
|
||||||
|
const excellentItems = criteria.filter(item => item.score >= averageScore).length;
|
||||||
|
const improvementItems = criteria.filter(item => item.score < averageScore).length;
|
||||||
|
|
||||||
|
console.log(' 優秀項目 (≥' + averageScore + '):', excellentItems);
|
||||||
|
console.log(' 待改進項目 (<' + averageScore + '):', improvementItems);
|
||||||
|
|
||||||
|
// 整體表現:基於權重的加權平均分數
|
||||||
|
const overallPerformance = Math.round(criteria.reduce((sum, item) => sum + (item.score / item.maxScore) * item.weight, 0));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
excellentItems,
|
excellentItems,
|
||||||
improvementItems,
|
improvementItems,
|
||||||
overallPerformance: Math.round(overallPerformance)
|
overallPerformance
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,8 +346,12 @@ ${criteriaList}
|
|||||||
* 生成改進建議
|
* 生成改進建議
|
||||||
*/
|
*/
|
||||||
private static generateImprovementSuggestions(criteria: any[]): any {
|
private static generateImprovementSuggestions(criteria: any[]): any {
|
||||||
const excellentItems = criteria.filter(item => (item.score / item.maxScore) >= 0.75); // 75%以上為優秀
|
// 計算平均分作為閾值
|
||||||
const improvementItems = criteria.filter(item => (item.score / item.maxScore) < 0.6); // 60%以下為待改進
|
const totalScore = criteria.reduce((sum, item) => sum + item.score, 0);
|
||||||
|
const averageScore = totalScore / criteria.length;
|
||||||
|
|
||||||
|
const excellentItems = criteria.filter(item => item.score >= averageScore); // ≥ 平均分為優秀
|
||||||
|
const improvementItems = criteria.filter(item => item.score < averageScore); // < 平均分為待改進
|
||||||
|
|
||||||
return {
|
return {
|
||||||
overallSuggestions: '基於 AI 分析結果的具體改進方向',
|
overallSuggestions: '基於 AI 分析結果的具體改進方向',
|
||||||
@@ -396,13 +424,13 @@ ${criteriaList}
|
|||||||
recommendedStars: parsed.recommendedStars || this.calculateRecommendedStars(totalScore),
|
recommendedStars: parsed.recommendedStars || this.calculateRecommendedStars(totalScore),
|
||||||
analysisDate: new Date().toISOString().split('T')[0],
|
analysisDate: new Date().toISOString().split('T')[0],
|
||||||
criteria: parsed.criteria || [],
|
criteria: parsed.criteria || [],
|
||||||
overview: parsed.overview || this.calculateOverview(parsed.criteria || []),
|
overview: this.calculateOverview(parsed.criteria || []),
|
||||||
detailedAnalysis: parsed.detailedAnalysis || {
|
detailedAnalysis: parsed.detailedAnalysis || {
|
||||||
summary: parsed.overallFeedback || '整體分析摘要',
|
summary: parsed.overallFeedback || '整體分析摘要',
|
||||||
keyFindings: ['關鍵發現1', '關鍵發現2', '關鍵發現3']
|
keyFindings: ['關鍵發現1', '關鍵發現2', '關鍵發現3']
|
||||||
},
|
},
|
||||||
chartData: parsed.chartData || this.generateChartData(parsed.criteria || []),
|
chartData: parsed.chartData || this.generateChartData(parsed.criteria || []),
|
||||||
improvementSuggestions: parsed.improvementSuggestions || this.generateImprovementSuggestions(parsed.criteria || [])
|
improvementSuggestions: this.generateImprovementSuggestions(parsed.criteria || [])
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -4,9 +4,9 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"dev": "next dev",
|
"dev": "next dev -p 12024",
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
"start": "next start",
|
"start": "next start -p 12024",
|
||||||
"db:init": "node scripts/init-database-simple.js",
|
"db:init": "node scripts/init-database-simple.js",
|
||||||
"db:test": "node scripts/test-database.js"
|
"db:test": "node scripts/test-database.js"
|
||||||
},
|
},
|
||||||
|
BIN
public/artificial-intelligence.png
Normal file
BIN
public/artificial-intelligence.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
Reference in New Issue
Block a user