diff --git a/frontend/scene-generator/llm-client.js b/frontend/scene-generator/llm-client.js index aaf7a27..14d473f 100644 --- a/frontend/scene-generator/llm-client.js +++ b/frontend/scene-generator/llm-client.js @@ -70,7 +70,8 @@ function buildAnalyzePrompt(sourceDir, dirContents) { parts.push(`\n=== 脚本文件 ===`); for (const [name, content] of Object.entries(dirContents.scripts)) { parts.push(`\n--- ${name} ---`); - parts.push(content.substring(0, 2000)); + const contentStr = typeof content === 'string' ? content : String(content || ''); + parts.push(contentStr.substring(0, 2000)); } } @@ -99,7 +100,7 @@ function buildDeepAnalyzePrompt(sourceDir, dirContents, indexHtmlContent) { } // Include index.html content (key addition) - if (indexHtmlContent) { + if (indexHtmlContent && typeof indexHtmlContent === 'string') { parts.push(`\n=== index.html ===`); // Limit to first 15000 chars to avoid token limits parts.push(indexHtmlContent.substring(0, 15000)); @@ -109,7 +110,8 @@ function buildDeepAnalyzePrompt(sourceDir, dirContents, indexHtmlContent) { parts.push(`\n=== 脚本文件 ===`); for (const [name, content] of Object.entries(dirContents.scripts)) { parts.push(`\n--- ${name} ---`); - parts.push(content.substring(0, 3000)); + const contentStr = typeof content === 'string' ? content : String(content || ''); + parts.push(contentStr.substring(0, 3000)); } } diff --git a/frontend/scene-generator/sg_scene_generator.html b/frontend/scene-generator/sg_scene_generator.html index 279d333..68f8496 100644 --- a/frontend/scene-generator/sg_scene_generator.html +++ b/frontend/scene-generator/sg_scene_generator.html @@ -493,9 +493,12 @@ const apiCount = document.getElementById("previewApiCount"); if (data.apiEndpoints && data.apiEndpoints.length > 0) { apiCount.textContent = data.apiEndpoints.length; - apiList.innerHTML = data.apiEndpoints.map(ep => - `
${field} → ${label}