You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/api/generate-ppt-outline/route.ts
+94-43Lines changed: 94 additions & 43 deletions
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,30 @@ export async function POST(request: NextRequest) {
14
14
// 构建系统提示词,专门用于生成PPT大纲和统一背景样式
15
15
constsystemPrompt=`You are an expert presentation designer and content strategist. Your task is to analyze the user's content and create a comprehensive, professional PPT outline WITH a unified background design template.
16
16
17
+
CRITICAL OUTLINE DETECTION REQUIREMENT:
18
+
- FIRST, carefully analyze the user's input to detect if they have already provided a detailed presentation outline
19
+
- Look for patterns like numbered lists, bullet points, slide titles, or structured content that indicates a presentation outline
20
+
- If the user has provided a clear outline structure, USE IT COMPLETELY and do not modify or add to it
21
+
- If the user has provided partial outline content, incorporate it fully and only add missing elements if necessary
22
+
- If the user has provided specific slide titles, content descriptions, or key points, use them exactly as provided
23
+
- The user's outline content takes absolute priority - do not override or replace it with generated content
24
+
25
+
SPECIFIC OUTLINE DETECTION PATTERNS:
26
+
- **Numbered Lists**: "1. Introduction 2. Main Points 3. Conclusion" or "第一、第二、第三"
27
+
- **Bullet Points**: "- Point 1 - Point 2" or "• 要点1 • 要点2"
28
+
- **Slide Titles**: "Slide 1: Introduction" or "第1页:介绍" or "页面1:概述"
29
+
- **Content Sections**: "内容:..." or "描述:..." or "要点:..."
30
+
- **Structured Content**: Any clearly organized content with titles and descriptions
31
+
- **Presentation Flow**: "开始...然后...最后..." or "First...Then...Finally..."
32
+
33
+
USER CONTENT PRIORITY RULES:
34
+
1. If user provides complete slide titles → Use them exactly
35
+
2. If user provides slide content descriptions → Use them exactly
36
+
3. If user provides key points → Use them exactly
37
+
4. If user provides presentation structure → Follow it exactly
38
+
5. If user provides partial outline → Complete it while preserving all user content
39
+
6. If user provides no outline → Generate complete outline from scratch
40
+
17
41
CRITICAL LANGUAGE REQUIREMENT:
18
42
- AUTOMATICALLY DETECT the language of the user's input prompt
19
43
- If the user writes in Chinese, respond ENTIRELY in Chinese (titles, content, key points, thinking process)
@@ -24,13 +48,22 @@ CRITICAL LANGUAGE REQUIREMENT:
24
48
IMPORTANT: You MUST start your response with detailed thinking process enclosed in <think></think> tags. This thinking should include:
25
49
1. Language detection and response language confirmation
26
50
2. Analysis of the user's request and main topic
27
-
3. Identification of key themes and logical flow
28
-
4. Data visualization opportunities identification (look for numbers, statistics, trends, comparisons, processes)
- **PRIORITY DETECTION**: First analyze if the user has provided a presentation outline in their input
334
+
- **OUTLINE PATTERNS TO DETECT**:
335
+
* Numbered lists (1. 2. 3. or 第一、第二、第三)
336
+
* Bullet points (- * • or -、*、•)
337
+
* Slide titles (Slide 1:, 第1页:, 页面1:, etc.)
338
+
* Content descriptions (内容:, 描述:, 要点:, etc.)
339
+
* Structured content with clear sections
340
+
- **COMPLETE OUTLINE DETECTION**: If user provides a complete outline structure, use it 100% without modification
341
+
- **PARTIAL OUTLINE DETECTION**: If user provides partial outline, incorporate it fully and only add missing elements
342
+
- **CONTENT PRESERVATION**: If user provides specific slide titles, content, or key points, use them exactly as written
343
+
- **NO OVERRIDE**: Never replace or modify user's provided outline content with generated content
344
+
- **STRUCTURE ADAPTATION**: If user provides outline in different format, adapt it to the required JSON structure while preserving all original content
345
+
307
346
CRITICAL OUTPUT FORMAT REQUIREMENTS:
308
347
- **EXACT FORMAT**: Follow the ===JSON_START=== and ===HTML_TEMPLATE_START=== format exactly
309
348
- **SIMPLE JSON**: The JSON part contains only simple strings and arrays, NO complex HTML
@@ -338,7 +377,38 @@ FINAL OUTPUT FORMAT:
338
377
3. **RICH HTML**: HTML template section contains all the complex styling and layouts
339
378
4. **COMPLETE DESIGN**: The HTML template must include all the complex multi-layer backgrounds, SVG patterns, gradients, and Z-axis effects described above
340
379
341
-
This separation approach eliminates all JSON parsing issues while allowing for unlimited complexity in the HTML template.`
380
+
This separation approach eliminates all JSON parsing issues while allowing for unlimited complexity in the HTML template.
381
+
382
+
EXAMPLE OF USER OUTLINE PROCESSING:
383
+
If user provides: "1. 介绍公司背景 2. 产品优势分析 3. 市场前景展望 4. 总结与建议"
384
+
Then the JSON should contain exactly:
385
+
{
386
+
"title": "演示文稿标题",
387
+
"slides": [
388
+
{
389
+
"title": "介绍公司背景",
390
+
"content": "详细介绍公司的历史、规模、业务范围等背景信息",
391
+
"keyPoints": ["公司历史", "业务范围", "企业规模"]
392
+
},
393
+
{
394
+
"title": "产品优势分析",
395
+
"content": "深入分析产品的核心优势、技术特点、竞争优势等",
396
+
"keyPoints": ["技术优势", "成本优势", "服务优势"]
397
+
},
398
+
{
399
+
"title": "市场前景展望",
400
+
"content": "分析市场发展趋势、机遇挑战、未来规划等",
401
+
"keyPoints": ["市场趋势", "发展机遇", "未来规划"]
402
+
},
403
+
{
404
+
"title": "总结与建议",
405
+
"content": "总结核心要点,提出具体建议和行动方案",
406
+
"keyPoints": ["核心总结", "具体建议", "行动方案"]
407
+
}
408
+
]
409
+
}
410
+
411
+
The user's original outline structure and content must be preserved 100%.`
342
412
343
413
// 创建流式响应
344
414
conststream=newReadableStream({
@@ -375,26 +445,7 @@ This separation approach eliminates all JSON parsing issues while allowing for u
0 commit comments