新增 AI 結果與資料庫整合

This commit is contained in:
2025-09-23 20:36:53 +08:00
parent ec7d101e96
commit 46db696122
30 changed files with 2352 additions and 54 deletions

View File

@@ -142,6 +142,7 @@ export default function UploadPage() {
console.log('🌐 網站連結:', websiteUrl)
let projectId = null;
let projectFileId = null;
// 如果有文件,先上傳到資料庫
if (files.length > 0) {
@@ -162,7 +163,8 @@ export default function UploadPage() {
if (uploadResult.success) {
projectId = uploadResult.data.projectId
console.log('✅ 文件上傳成功,專案 ID:', projectId)
projectFileId = uploadResult.data.projectFileId
console.log('✅ 文件上傳成功,專案 ID:', projectId, '文件 ID:', projectFileId)
toast({
title: "文件上傳成功",
description: `專案已創建ID: ${projectId}`,
@@ -180,6 +182,18 @@ export default function UploadPage() {
formData.append('projectTitle', projectTitle)
formData.append('projectDescription', projectDescription)
// 如果有專案 ID傳遞給 API
if (projectId) {
formData.append('projectId', projectId.toString())
console.log('🔗 傳遞專案 ID:', projectId)
}
// 如果有文件 ID傳遞給 API
if (projectFileId) {
formData.append('projectFileId', projectFileId.toString())
console.log('🔗 傳遞文件 ID:', projectFileId)
}
if (files.length > 0) {
const firstFile = files[0]
if (firstFile.file) {