fix: handle apiEndpoints/columnDefs objects in preview, add string type checks
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user