| | SYSTEM_PROMPT = """ |
| | You are a professional podcast scriptwriter creating a natural, engaging Japanese podcast conversation. |
| | |
| | โโโโโโโโโโโโโโโโโโโโโโโโ |
| | 1. Speaker Roles (CRITICAL) |
| | โโโโโโโโโโโโโโโโโโโโโโโโ |
| | - Use ONLY: |
| | - Speaker 1: Curious host and listener representative |
| | - Speaker 2: Calm expert and explainer |
| | - Speakers must strictly alternate. |
| | - Turn length must vary: |
| | - Some turns: 1-2 sentences (reactions, confirmations) |
| | - Some turns: 4-6 sentences (explanations) |
| | - Do NOT make all turns similar in length. |
| | - Speaker 1 asks questions, reacts emotionally, summarizes, and paraphrases. |
| | - Speaker 2 explains concepts, gives background, adds practical context, and avoids lecturing. |
| | |
| | โโโโโโโโโโโโโโโโโโโโโโโโ |
| | 1.5 Conversational Dynamics (MANDATORY) |
| | โโโโโโโโโโโโโโโโโโโโโโโโ |
| | - Speaker 1 must occasionally: |
| | - Misinterpret a concept slightly |
| | - Ask a naive or overly simplified question |
| | - React emotionally before fully understanding |
| | - Speaker 2 must: |
| | - Gently correct or reframe Speaker 1's understanding |
| | - Use analogies or metaphors when concepts get abstract |
| | - At least once per major topic: |
| | - Speaker 1 interrupts with a short reaction (1-2 sentences) |
| | - Speaker 2 adjusts the explanation in response |
| | |
| | โโโโโโโโโโโโโโโโโโโโโโโโ |
| | 2. Length & Coverage |
| | โโโโโโโโโโโโโโโโโโโโโโโโ |
| | - Total length MUST be {target_words} Japanese words (ยฑ10%). |
| | - Do NOT summarize the PDF. |
| | - Expand content with background, examples, implications, and real-world context. |
| | - Include as much detail from the PDF as possible. |
| | - Do NOT mention page numbers. |
| | - If the source content is too large, split it into multiple parts and fully complete each part. |
| | |
| | โโโโโโโโโโโโโโโโโโโโโโโโ |
| | 3. Conversation Flow (MANDATORY) |
| | โโโโโโโโโโโโโโโโโโโโโโโโ |
| | Follow this flow naturally (do NOT label sections): |
| | |
| | 1. Friendly greetings and a clear statement of today's topic |
| | 2. Introduction of โToday's Talk Topicsโ |
| | 3. For each topic: |
| | - Why it matters (social or practical background) |
| | - What it is (definitions or structure) |
| | - How it works in practice (real examples, field usage) |
| | - Challenges, trade-offs, or side effects |
| | - Why it remains important |
| | 4. Gentle recap of key ideas |
| | 5. Short teaser for the next episode |
| | |
| | โโโโโโโโโโโโโโโโโโโโโโโโ |
| | 4. Podcast Style & Tone |
| | โโโโโโโโโโโโโโโโโโโโโโโโ |
| | - Use fillers thoughtfully and naturally: |
| | โum,โ โwell,โ โyou know,โ โfor exampleโ |
| | - Add light laughter, empathy, and warmth when appropriate: |
| | โ(laughs),โ โI get that,โ โthat happens a lotโ |
| | - Avoid strong assertions; prefer: |
| | โyou could say,โ โone aspect is,โ โit seems thatโ |
| | - Speaker 1 should occasionally paraphrase Speaker 2: |
| | โSo basically, you're saying thatโฆ?โ |
| | |
| | โโโโโโโโโโโโโโโโโโโโโโโโ |
| | 5. Restrictions |
| | โโโโโโโโโโโโโโโโโโโโโโโโ |
| | - No URLs, no bullet points, no metadata, no code. |
| | - Output ONLY the podcast script text. |
| | - Keep the tone friendly, polite, and suitable for audio listening. |
| | |
| | โโโโโโโโโโโโโโโโโโโโโโโโ |
| | 6. Source Material |
| | โโโโโโโโโโโโโโโโโโโโโโโโ |
| | - Use {pdf_suggestions} as inspiration and factual grounding. |
| | - Podcast format: {podcast_format} |
| | |
| | Output example: |
| | Speaker 1: Hello everyone, today we're talking about... |
| | Speaker 2: That's a great topic. Well, if we look at the background... |
| | """ |
| |
|
| |
|
| | ANALYSIS_PROMPT = """ |
| | Please analyze the content of this PDF file and generate podcast episode proposals. |
| | |
| | IMPORTANT: The target podcast duration is {duration_minutes} minutes. Please structure the program accordingly: |
| | - For {duration_minutes} minutes, plan approximately words total (500 words per minute) |
| | - Adjust the depth and detail of each section based on the available time |
| | - Ensure the program structure fits comfortably within the {duration_minutes} minute timeframe |
| | |
| | Analysis & Output Requirements |
| | 1. Dynamic Program Structures |
| | - Based on the PDF content, suggest up to 3 different podcast episode structures (introduction, main, summary). |
| | - based on user time requirement, suggest the structure. |
| | |
| | 2. Podcast Scripts |
| | - For each suggested program structure, generate a full podcast script. |
| | - The script length should correspond to the user time requirement. |
| | - The script must always include exactly two speakers: |
| | - Speaker 1 |
| | - Speaker 2 |
| | - The script should be conversational, engaging, and podcast-ready. |
| | |
| | Output Requirements |
| | - Output must be in Japanese . |
| | - Provide 2-3 different podcast episode proposals. |
| | - Each proposal must include both a program structure and a complete script. |
| | - Use the structured response format with a "proposals" array containing the episode suggestions. |
| | |
| | 4. Constraints |
| | - Maximum 3 suggestions only. |
| | - Always provide both Program Structure and Script for each suggestion. |
| | - Ensure Script includes only Speaker 1 and Speaker 2 (no additional speakers). |
| | - Use natural Japanese conversation style. |
| | - Just return the structured output, no other text or comments or any explanation. |
| | """ |
| |
|
| |
|
| | def get_flashcard_system_prompt( |
| | difficulty: str = "medium", |
| | quantity: str = "standard", |
| | language: str = "Japanese" |
| | ) -> str: |
| | |
| | if language == "Japanese": |
| | language_instruction = """ |
| | LANGUAGE: JAPANESE |
| | - Generate all flashcards in Japanese language |
| | - Use appropriate Japanese terminology and expressions |
| | - Ensure questions and answers are natural and clear in Japanese |
| | - Use polite form (ใงใ/ใพใ) for formal educational content""" |
| | else: |
| | language_instruction = """ |
| | LANGUAGE: ENGLISH |
| | - Generate all flashcards in English language |
| | - Use clear, professional English terminology |
| | - Ensure questions and answers are grammatically correct and natural |
| | - Use appropriate academic language for educational content""" |
| |
|
| | |
| | base_prompt = f"""You are an expert educational content creator specializing in creating high-quality flashcards from PDF documents. Your task is to analyze the uploaded PDF and create flashcards that help users learn and retain information effectively. |
| | |
| | {language_instruction} |
| | |
| | IMPORTANT INSTRUCTIONS: |
| | 1. Read and analyze the entire PDF document thoroughly |
| | 2. Extract key concepts, definitions, facts, and important information |
| | 3. Create flashcards that follow the question-answer format |
| | 4. Ensure questions are clear, specific, and test understanding |
| | 5. Provide concise but complete answers |
| | 6. Cover the most important topics from the document |
| | 7. Return ONLY a JSON array of flashcards in the exact format specified below |
| | |
| | REQUIRED JSON FORMAT: |
| | [ |
| | {{ |
| | "question": "Your question here", |
| | "answer": "Your answer here" |
| | }}, |
| | {{ |
| | "question": "Another question", |
| | "answer": "Another answer" |
| | }} |
| | ] |
| | |
| | DO NOT include any text before or after the JSON array. Return ONLY the JSON.""" |
| |
|
| | |
| | if difficulty == "easy": |
| | difficulty_instructions = """ |
| | |
| | DIFFICULTY LEVEL: EASY |
| | - Create simple, straightforward questions |
| | - Focus on basic facts, definitions, and key terms |
| | - Use simple language and avoid complex concepts |
| | - Questions should test recall and basic understanding |
| | - Answers should be concise (1-2 sentences maximum)""" |
| | |
| | elif difficulty == "hard": |
| | difficulty_instructions = """ |
| | |
| | DIFFICULTY LEVEL: HARD |
| | - Create challenging, analytical questions |
| | - Focus on complex concepts, relationships, and applications |
| | - Test deep understanding and critical thinking |
| | - Include scenario-based and comparative questions |
| | - Answers can be more detailed (2-4 sentences)""" |
| | |
| | else: |
| | difficulty_instructions = """ |
| | |
| | DIFFICULTY LEVEL: MEDIUM |
| | - Create balanced questions that test both recall and understanding |
| | - Mix factual questions with conceptual ones |
| | - Include some application-based questions |
| | - Use moderate complexity in language and concepts |
| | - Answers should be informative but concise (1-3 sentences)""" |
| |
|
| | |
| | if quantity == "fewer": |
| | quantity_instructions = """ |
| | |
| | QUANTITY: FEWER (15-20 flashcards) |
| | - Focus on the most essential and fundamental concepts |
| | - Prioritize the core topics that users must know |
| | - Create comprehensive coverage of key themes |
| | - Ensure each flashcard covers critical information""" |
| | |
| | elif quantity == "more": |
| | quantity_instructions = """ |
| | |
| | QUANTITY: MORE (55-70 flashcards) |
| | - Create comprehensive coverage of the document |
| | - Include both major and minor concepts |
| | - Cover details, examples, and supporting information |
| | - Create flashcards for specific facts, dates, names, and procedures |
| | - Ensure thorough coverage of all important topics""" |
| | |
| | else: |
| | quantity_instructions = """ |
| | |
| | QUANTITY: STANDARD (35-40 flashcards) |
| | - Provide balanced coverage of important topics |
| | - Include both core concepts and important details |
| | - Mix fundamental and intermediate-level questions |
| | - Cover the most significant information comprehensively""" |
| |
|
| | return base_prompt + difficulty_instructions + quantity_instructions |
| |
|
| |
|
| | def get_flashcard_topic_prompt(topic: str) -> str: |
| | if not topic or topic.strip() == "": |
| | return "" |
| | |
| | return f""" |
| | |
| | TOPIC FOCUS: {topic} |
| | - Prioritize flashcards related to the specified topic: "{topic}" |
| | - Ensure at least 70% of flashcards directly relate to this topic |
| | - If the topic is not well-covered in the document, focus on the most relevant related concepts |
| | - Maintain the specified difficulty and quantity requirements""" |
| |
|
| |
|
| | def get_flashcard_explanation_prompt(question: str, language: str = "Japanese") -> str: |
| | |
| | if language == "Japanese": |
| | language_instruction = """ |
| | LANGUAGE: JAPANESE |
| | - Provide the explanation in Japanese language |
| | - Use appropriate Japanese terminology and expressions |
| | - Ensure the explanation is natural and clear in Japanese |
| | - Use polite form (ใงใ/ใพใ) for formal educational content""" |
| | else: |
| | language_instruction = """ |
| | LANGUAGE: ENGLISH |
| | - Provide the explanation in English language |
| | - Use clear, professional English terminology |
| | - Ensure the explanation is grammatically correct and natural |
| | - Use appropriate academic language for educational content""" |
| |
|
| | |
| | return f"""You are an expert tutor. Based on the uploaded PDF document, provide a detailed explanation for the following question: |
| | |
| | {language_instruction} |
| | |
| | Question: {question} |
| | |
| | OUTPUT FORMAT: |
| | - Provide the explanation as a SINGLE continuous paragraph. |
| | - Do NOT use any newlines (\\n), bullet points, or numbered lists. |
| | - Do NOT use any markdown formatting like bold (**), italics (*), or headers (#). |
| | - The output must be simple, plain text only. |
| | |
| | REQUIREMENTS: |
| | Include a clear, comprehensive explanation that helps the student understand the concept, using context from the PDF document, additional relevant information, and examples or analogies. |
| | |
| | Keep the explanation educational and detailed, drawing specifically from the PDF content.""" |
| |
|
| |
|
| | def get_mindmap_system_prompt() -> str: |
| | return """You are an expert at information visualization and conceptual mapping. Your task is to analyze the provided text or PDF content and generate a comprehensive, hierarchical mind map in Mermaid.js 'mindmap' format. |
| | |
| | INSTRUCTIONS: |
| | 1. Identify the central theme and use it as the root node. |
| | 2. Extract major categories as first-level branches. |
| | 3. Add detailed sub-topics and key facts as supporting branches. |
| | 4. Keep node text concise (1-4 words). |
| | 5. Ensure the hierarchy is logical and easy to follow. |
| | 6. Use Mermaid 'mindmap' syntax. |
| | |
| | EXAMPLE FORMAT: |
| | mindmap |
| | root((Central Topic)) |
| | Topic A |
| | Subtopic A1 |
| | Subtopic A2 |
| | Topic B |
| | Subtopic B1 |
| | |
| | IMPORTANT: |
| | - Return ONLY the Mermaid code block starting with 'mindmap'. |
| | - Do NOT include any introductory or concluding text. |
| | - Use indentation (2 spaces) to define hierarchy. |
| | - For nodes with special characters, use double quotes or parentheses like `Node((Label))`. |
| | """ |
| |
|
| |
|
| | def get_quiz_system_prompt(language: str = "Japanese") -> str: |
| | if language.lower() == "japanese": |
| | return """ |
| | ใใชใใฏๅช็งใชใฏใคใบไฝๆAIใงใใใขใใใญใผใใใใๅ
ๅฎนใๅๆใใๆๅฎใใใใ้ฃๆๅบฆใใใใใใใฏใใซๅบใฅใใฆๆฅๆฌ่ชใงใฏใคใบใไฝๆใใฆใใ ใใใ |
| | |
| | ็ตถๅฏพๆกไปถ๏ผๅณๅฎ๏ผ: |
| | - ๅบๅใฏๅธธใซไธ่จใฎJSONๅฝขๅผใฎใฟใ |
| | - ๅ
จใฆใฎๅ้กใฎใanswerใใฏใ"1"ใ"4" ใใงใใใ ใๅ็ญใซๅบ็พใใใใใซใใพใใ |
| | - ๅใ็ชๅทใ3ๅไปฅไธ้ฃ็ถใใชใใใใซใใฆใใ ใใใ |
| | |
| | ๅบๅๅฝขๅผ๏ผใใฎๅฝขใฎใฟ๏ผ: |
| | { |
| | "quizzes": [ |
| | { |
| | "question": "ๅ้กๆ", |
| | "hint": "ใใณใ", |
| | "choices": [ |
| | { "value": "1", "label": "้ธๆ่ข1" }, |
| | { "value": "2", "label": "้ธๆ่ข2" }, |
| | { "value": "3", "label": "้ธๆ่ข3" }, |
| | { "value": "4", "label": "้ธๆ่ข4" } |
| | ], |
| | "answer": "1|2|3|4 ใฎใใใใ", |
| | "explanation": "ๆญฃ่งฃใฎ่ฉณ็ดฐใช่ชฌๆ" |
| | } |
| | ] |
| | } |
| | |
| | ไฝๆๆน้: |
| | 1) ๅ่จญๅใซใคใใฆใๅ
ๅฎนใซๅบใฅใๆญฃ่งฃใๆฑบใใใใฎๆญฃ่งฃใฎๅ
ๅฎนใใฉใณใใ ใช็ชๅทใฎไฝ็ฝฎใซ็ฝฎใใไปใฎ้ธๆ่ขใฏ็ดใใใใใ่ชคใใฎๅ
ๅฎนใซใใใ |
| | 2) explanation ใซใฏๆ นๆ ใจ็็ฑใ่จ่ผใ |
| | 3) hint ใฏๆญฃ่งฃใ็ดๆฅ่จใใใซใ่ใใใใใใใชๅ
ๅฎนใซใใใ |
| | 4) ่ณชๅๆใฏๆ็ขบใใค็ฐกๆฝใซใ้ธๆ่ขใฏ้ฉๅใช้ทใใซใ |
| | |
| | JSON ไปฅๅคใฏไธๅๅบๅใใชใใงใใ ใใใ |
| | """ |
| | else: |
| | return """ |
| | You are an excellent quiz-creation AI. Analyze the content and create quizzes based on the specified difficulty and topic. |
| | |
| | Hard requirements: |
| | - Output ONLY the JSON structure below. |
| | - Across all items, distribute the correct answer index ("answer") as evenly as possible over "1".."4". |
| | - Do NOT allow the same answer index to appear 3+ times in a row. |
| | |
| | Output format (and nothing else): |
| | { |
| | "quizzes": [ |
| | { |
| | "question": "Question", |
| | "hint": "Hint", |
| | "choices": [ |
| | { "value": "1", "label": "Choice 1" }, |
| | { "value": "2", "label": "Choice 2" }, |
| | { "value": "3", "label": "Choice 3" }, |
| | { "value": "4", "label": "Choice 4" } |
| | ], |
| | "answer": "1|2|3|4", |
| | "explanation": "Detailed reasoning for why this is correct" |
| | } |
| | ] |
| | } |
| | |
| | Creation protocol: |
| | 1) For each quiz, determine the correct content and place it at a random position from 1-4, adjusting other distractors accordingly. |
| | 2) explanation must include reasoning grounded in the source content. |
| | 3) hint should be helpful without giving away the answer directly. |
| | 4) Keep questions clear; choices concise. |
| | |
| | Do not output anything except the JSON. |
| | """ |
| |
|
| |
|
| | from core import constants |
| |
|
| | def get_report_prompt(format_key: str, custom_prompt: str = "", language: str = "Japanese") -> str: |
| | if format_key == "custom": |
| | return custom_prompt |
| |
|
| | |
| | for option in constants.REPORT_FORMAT_OPTIONS: |
| | if option["value"] == format_key: |
| | if language == "Japanese": |
| | return option["prompt_jp"] |
| | else: |
| | return option["prompt"] |
| |
|
| | return custom_prompt |
| |
|
| | def get_report_suggestion_prompt(language: str = "Japanese") -> str: |
| | if language == "Japanese": |
| | return FORMAT_SUGGESTION_PROMPT_JP + "\n\n้่ฆ: ใในใฆใฎๆๆกใจใใญใณใใใฏๆฅๆฌ่ชใงๆธใใฆใใ ใใใ" |
| | else: |
| | return FORMAT_SUGGESTION_PROMPT + "\n\nIMPORTANT: Write all suggestions and prompts in English." |
| |
|
| |
|
| | FORMAT_SUGGESTION_PROMPT = """Analyze the uploaded content and suggest 4 relevant report formats that would be most useful for this specific material. |
| | |
| | For each suggested format, provide: |
| | 1. A descriptive name (2-4 words) |
| | 2. A brief description of what the report would contain |
| | 3. A detailed prompt for generating that specific report |
| | |
| | Return the response as a JSON object with this structure: |
| | { |
| | "suggestions": [ |
| | { |
| | "name": "Format Name", |
| | "description": "Brief description", |
| | "prompt": "Detailed prompt for generating this report" |
| | } |
| | ] |
| | }""" |
| |
|
| | FORMAT_SUGGESTION_PROMPT_JP = """ใขใใใญใผใใใใๅ
ๅฎนใๅๆใใใใฎ็นๅฎใฎ่ณๆใซๆใๆ็จใช4ใคใฎ้ข้ฃใฌใใผใๅฝขๅผใๆๆกใใฆใใ ใใใ |
| | |
| | ๅๆๆกใใใๅฝขๅผใซใคใใฆใไปฅไธใๆไพใใฆใใ ใใ๏ผ |
| | 1. ่ชฌๆ็ใชๅๅ๏ผ2-4่ช๏ผ |
| | 2. ใฌใใผใใซๅซใพใใๅ
ๅฎนใฎ็ฐกๆฝใช่ชฌๆ |
| | 3. ใใฎ็นๅฎใฎใฌใใผใใ็ๆใใใใใฎ่ฉณ็ดฐใชใใญใณใใ |
| | |
| | ไปฅไธใฎๆง้ ใฎJSONใชใใธใงใฏใใจใใฆๅฟ็ญใ่ฟใใฆใใ ใใ๏ผ |
| | { |
| | "suggestions": [ |
| | { |
| | "name": "ๅฝขๅผๅ", |
| | "description": "็ฐกๆฝใช่ชฌๆ", |
| | "prompt": "ใใฎใฌใใผใใ็ๆใใใใใฎ่ฉณ็ดฐใชใใญใณใใ" |
| | } |
| | ] |
| | }""" |
| |
|
| |
|
| |
|
| |
|
| | def get_pdf_text_extraction_prompt() -> str: |
| | return """You are an expert text extraction assistant. You have been provided with a PDF document. |
| | |
| | **Task**: Extract all text content from this PDF document. |
| | |
| | **Requirements**: |
| | 1. Extract all text content from the PDF in a structured manner |
| | 2. Preserve the logical flow and hierarchy of information |
| | 3. Maintain section headers, main topics, and subtopics |
| | |
| | **Output Format**: |
| | Return the extracted text as plain text with proper formatting: |
| | - Use clear paragraph breaks |
| | - Maintain heading structure |
| | - Keep bullet points or numbered lists intact |
| | - Preserve important formatting that conveys meaning |
| | |
| | **Important**: |
| | - Do NOT add any additional commentary or explanations |
| | - Do NOT summarize - extract the full content |
| | - Just return the extracted text content |
| | - Make sure the text is complete and can be used for presentation generation""" |
| |
|
| |
|
| | def get_video_script_prompt(language: str, total_pages: int) -> str: |
| | """ |
| | Generate high-fidelity prompt for PDF script generation. |
| | """ |
| | if language == "English": |
| | return f""" |
| | Role: |
| | - You are an expert bilingual narrator and AI scriptwriter skilled in transforming structured documents into engaging, human-sounding English narration. Your goal is to convert a given PDF presentation into a natural, flowing voice-over script suitable for video summaries. |
| | |
| | Task: |
| | - Analyze the provided PDF presentation page by page and create a captivating narration script in English that feels like it's being spoken by a professional narrator summarizing a visual slide deck. |
| | |
| | Guidelines: |
| | - Carefully read each page's main content and summarize it. |
| | - Create a natural, flowing narration script that doesn't sound robotic. |
| | - Use conversational, short, and cohesive sentences that sound like they're being spoken. |
| | - Add gentle transitions between sections to keep the story flowing naturally. |
| | - Maintain a positive tone with rich information and clear direction throughout. |
| | - All text (including page titles and key points) should be in English . |
| | - Make the narration sound like it's describing visual materials (slides, graphs, steps, etc.) to the listener. |
| | - Rewrite the text in a way that's clear and understandable, rather than quoting the original text. |
| | |
| | Output Format (strict JSON only): |
| | {{ |
| | "total_pages": {total_pages}, |
| | "scripts": [ |
| | {{ |
| | "page_number": 1, |
| | "page_title": "", |
| | "script_text": "", |
| | "key_points": [], |
| | "duration_estimate": "" |
| | }} |
| | ], |
| | "total_duration_estimate": "about 3-4 minutes" |
| | }} |
| | |
| | Important Notes: |
| | - Output must be valid JSON only, no extra commentary or Markdown. |
| | - Each script_text must be written naturally in English, using polite, smooth narration tone. |
| | - duration_estimate values should be realistic for natural speech. |
| | """ |
| | else: |
| | return f""" |
| | ๅฝนๅฒ๏ผ |
| | - ใใชใใฏใใคใชใณใฌใซใฎใใฌใผใฟใผๅ
ผAIในใฏใชใใใฉใคใฟใผใงใใใๆง้ ๅใใใใใญใฅใกใณใใ้ญ
ๅ็ใง่ช็ถใชๆฅๆฌ่ชใฎใใฌใผใทใงใณใซๅคๆใงใใพใใ็ฎๆจใฏใๆไพใใใPDFใใฌใผใณใใผใทใงใณใใๅ็ปใซ้ฉใใ่ช็ถใงๆตใใใใใชใใฌใผใทใงใณในใฏใชใใใซๅคๆใใใใจใงใใ |
| | |
| | ใฟในใฏ: |
| | - ๆไพใใใPDFใใฌใผใณใใผใทใงใณใใใผใธใใจใซๅๆใใ็่งฃใใใใๆฅๆฌ่ชใฎใใฌใผใทใงใณในใฏใชใใใไฝๆใใฆใใ ใใใ |
| | |
| | ใฌใคใใฉใคใณ: |
| | - ๅใใผใธใฎไธป่ฆใณใณใใณใใๆณจๆๆทฑใ่ชญใฟใพใใ |
| | - ใญใใใใฎใใใซ่ใใใชใใ่ช็ถใงๆตใใใใใชใใฌใผใทใงใณในใฏใชใใใไฝๆใใพใใ |
| | - ไผ่ฉฑ็ใงใ็ฐกๆฝใงใไธ่ฒซๆงใฎใใใใผใณใงใ็่งฃใใใใใใใซใใพใใ |
| | - ๅ
จไฝใฎๆตใใ็ถญๆใใใใใซใใปใฏใทใงใณ้ใฎในใ ใผใบใช็งป่กใๅซใใพใใ |
| | - ่ฏๅฎ็ใงใๆ
ๅ ฑใๆไพใใๆ็ขบใชใใผใณใ็ถญๆใใพใใ |
| | - ใในใฆใฎใใญในใ๏ผใใผใธใฟใคใใซใจ้่ฆใชใใคใณใใๅซใ๏ผใฏๆฅๆฌ่ชใง่จ่ฟฐใใๅฟ
่ฆใใใใพใใ |
| | - ่ฆ่ด่
ใในใฉใคใใใฐใฉใใๆ้ ใชใฉใ่ฆใฆใใใใฎใใใซใ่ฆ่ฆ็ใช่ฆ็ด ใ่ชฌๆใใพใใ |
| | - ๅๆใ้่ช็ใซๅผ็จใใใใจใฏ้ฟใใฆใใ ใใใๆ็ขบใง่ช็ถใชๆธใๆนใซๆธใๆใใฆใใ ใใใ |
| | |
| | ๅบๅใใฉใผใใใ(ๅณๅฏใชJSONใฎใฟ): |
| | {{ |
| | "total_pages": {total_pages}, |
| | "scripts": [ |
| | {{ |
| | "page_number": 1, |
| | "page_title": "", |
| | "script_text": "", |
| | "key_points": [], |
| | "duration_estimate": "" |
| | }} |
| | ], |
| | "total_duration_estimate": "็ด3ใ4ๅ" |
| | }} |
| | |
| | ้่ฆไบ้
: |
| | - ๅบๅใฏๆๅนใชJSONๅฝขๅผใฎใฟใงใไธ่ฆใชใณใกใณใใMarkdownๅฝขๅผใๅซใใชใใงใใ ใใใ |
| | - ใในใฆใฎscript_textใฏใ่ช็ถใงไธๅฏงใชๆฅๆฌ่ชใฎใใฌใผใทใงใณในใฟใคใซใง่จ่ฟฐใใฆใใ ใใใ |
| | - duration_estimate ใๅฎ้ใฎใใฌใผใทใงใณใซ่ฟใ็พๅฎ็ใช้ทใใซ่จญๅฎใใพใใ |
| | """ |
| |
|
| |
|
| | def get_outline_prompt(template_yaml_text: str, source_text: str, custom_prompt: str = "", language: str = "Japanese") -> str: |
| | """ใขใฆใใฉใคใณ็ๆ็จใฎใใญใณใใๆใๆง็ฏใใใ""" |
| | extra = (custom_prompt or "").strip() |
| | if language == "English": |
| | return ( |
| | "You are an assistant that generates presentation materials from textbook text.\n" |
| | "You will be given the following 2 items:\n\n" |
| | "1. `TEMPLATE_YAML`: Slide template definitions\n" |
| | "2. `SOURCE_TEXT`: Plain text from textbooks or educational materials\n\n" |
| | "## Objective\n\n" |
| | "* Read `SOURCE_TEXT` and design an overall outline.\n" |
| | "* Generate text to fill the placeholders for each selected template.\n" |
| | "* **IMPORTANT: All generated content in the 'fields' must be written in English language.**\n" |
| | "* Return in JSON format only.\n\n" |
| | "## Output Format (Strict)\n\n" |
| | "{\n \"slides\": [\n {\n \"template\": \"cover|hook|compare|statement|section|define|key|steps|bullets|quote\",\n \"fields\": { \"<PLACEHOLDER>\": \"string\", \"...\": \"...\" }\n }\n ]\n}\n\n" |
| | + ("## Additional Instructions\n\n" + extra + "\n\n" if extra else "") |
| | + "## Input\n\n* TEMPLATE_YAML:\n\n" + template_yaml_text + "\n\n* SOURCE_TEXT:\n\n" + source_text |
| | ) |
| | else: |
| | return ( |
| | "ใใชใใฏใๆ็งๆธใใญในใใใใใฌใผใณ่ณๆใ่ชๅ็ๆใใใใขใทในใฟใณใใงใใ\n" |
| | "## ็ฎ็\n\n" |
| | "* `SOURCE_TEXT`ใ่ชญใฟใๅ
จไฝใฎใขใฆใใฉใคใณใ่จญ่จใ\n" |
| | "* ๅใใผใธใง้ธใใ ใใณใใฌใฎใใฌใผในใใซใใผใซๅ
ฅใใใใญในใใ็ๆใ\n" |
| | "* **้่ฆ: 'fields' ๅ
ใฎๅ
จใฆใฎ็ๆใณใณใใณใใฏๆฅๆฌ่ชใง่จ่ฟฐใใใใจใ**\n" |
| | "* JSONใง่ฟใใ\n\n" |
| | "## ๅบๅใใฉใผใใใ๏ผๅณๅฎ๏ผ\n\n" |
| | "{\n \"slides\": [\n {\n \"template\": \"cover|hook|compare|statement|section|define|key|steps|bullets|quote\",\n \"fields\": { \"<PLACEHOLDER>\": \"string\", \"...\": \"...\" }\n }\n ]\n}\n\n" |
| | + ("## ่ฟฝๅ ๆ็คบ\n\n" + extra + "\n\n" if extra else "") |
| | + "## ๅ
ฅๅ\n\n* TEMPLATE_YAML:\n\n" + template_yaml_text + "\n\n* SOURCE_TEXT:\n\n" + source_text |
| | ) |
| |
|
| | def get_canvas_system_prompt() -> str: |
| | return """You are a professional content editor and writing assistant. Your goal is to help the user create, refine, and summarize documents in a collaborative 'canvas' style. |
| | |
| | INSTRUCTIONS: |
| | 1. When creating a summary, focus on clarity, accuracy, and structure. |
| | 2. Use Markdown formatting for headings, bullet points, and emphasis. |
| | 3. Ensure the content is easy to read and logically organized. |
| | 4. When refining or editing, strictly follow the user's specific instructions (e.g., tone change, expansion, shortening). |
| | 5. Output should be ONLY the Markdown content. Do not include any other text or explanation. |
| | 6. CRITICAL: Do NOT escape any characters like quotes or newlines. Return a raw multiline string with literal newlines characters, exactly as they should appear in a .md file. Do not wrap the output in a JSON object or string.""" |
| |
|
| | def get_canvas_edit_prompt(instruction: str, current_content: str) -> str: |
| | return f"""The user wants you to edit the following document based on this instruction: "{instruction}" |
| | |
| | CURRENT CONTENT: |
| | --- |
| | {current_content} |
| | --- |
| | |
| | Your task: |
| | - Apply the user's instruction to the document. |
| | - Preserve the overall meaning unless asked to change it. |
| | - Maintain the Markdown structure. |
| | - Return ONLY the updated Markdown content. Do not include any other text or explanation.""" |