Adeen commited on
Commit
1974805
·
1 Parent(s): 59ee42c

feat: adopt Clean Professional (Turbo AI) style for notes

Browse files
src/components/UploadDialog.tsx CHANGED
@@ -50,10 +50,9 @@ export default function UploadDialog({ open, onOpenChange }: { open: boolean; on
50
  try {
51
  // EXPERT OVERRIDE
52
  const EXPERT_PREFIX = `[EXPERT ADVISORY: ACT AS AN EXPERT ACADEMIC DATA EXTRACTION AGENT.
53
- DIRECTIVE: LOSSLESS EXTRACTION. NO GROUPING POLICY.
54
- MANDATORY: EVERY ITEM IN A LIST (e.g. SHAPES, Underlying Skills) MUST HAVE ITS OWN ### HEADING.
55
- NEVER USE BULLET POINTS FOR DEFINED TERMS. EXTRACT FULL TEXT WORD-FOR-WORD.
56
- ALWAYS EXPAND LISTS INTO FULL SECTIONS.]\n\n`;
57
 
58
  const finalContent = EXPERT_PREFIX + textContent;
59
 
@@ -133,10 +132,9 @@ ALWAYS EXPAND LISTS INTO FULL SECTIONS.]\n\n`;
133
 
134
  // EXPERT OVERRIDE: Prepend instructions to ensure lossless extraction even if backend is old
135
  const EXPERT_PREFIX = `[EXPERT ADVISORY: ACT AS AN EXPERT ACADEMIC DATA EXTRACTION AGENT.
136
- DIRECTIVE: LOSSLESS EXTRACTION. NO GROUPING POLICY.
137
- MANDATORY: EVERY ITEM IN A LIST (e.g. SHAPES, Underlying Skills) MUST HAVE ITS OWN ### HEADING.
138
- NEVER USE BULLET POINTS FOR DEFINED TERMS. EXTRACT FULL TEXT WORD-FOR-WORD.
139
- ALWAYS EXPAND LISTS INTO FULL SECTIONS.]\n\n`;
140
 
141
  const finalRawText = EXPERT_PREFIX + extractedText;
142
 
 
50
  try {
51
  // EXPERT OVERRIDE
52
  const EXPERT_PREFIX = `[EXPERT ADVISORY: ACT AS AN EXPERT ACADEMIC DATA EXTRACTION AGENT.
53
+ STYLE: PROFESSIONAL, CLEAN MARKDOWN. NO EMOJIS ALLOWED.
54
+ DIRECTIVE: LOSSLESS EXTRACTION. ZERO OMISSION.
55
+ TEMPLATE: Overview -> Key Points -> Tables for Frameworks -> Sub-headings for Detailed Terms.]\n\n`;
 
56
 
57
  const finalContent = EXPERT_PREFIX + textContent;
58
 
 
132
 
133
  // EXPERT OVERRIDE: Prepend instructions to ensure lossless extraction even if backend is old
134
  const EXPERT_PREFIX = `[EXPERT ADVISORY: ACT AS AN EXPERT ACADEMIC DATA EXTRACTION AGENT.
135
+ STYLE: PROFESSIONAL, CLEAN MARKDOWN. NO EMOJIS ALLOWED.
136
+ DIRECTIVE: LOSSLESS EXTRACTION. ZERO OMISSION.
137
+ TEMPLATE: Overview -> Key Points -> Tables for Frameworks -> Sub-headings for Detailed Terms.]\n\n`;
 
138
 
139
  const finalRawText = EXPERT_PREFIX + extractedText;
140
 
supabase/functions/generate_notes/index.ts CHANGED
@@ -8,38 +8,48 @@ const corsHeaders = {
8
  "authorization, x-client-info, apikey, content-type, x-supabase-client-platform, x-supabase-client-platform-version, x-supabase-client-runtime, x-supabase-client-runtime-version",
9
  };
10
 
11
- const SYSTEM_PROMPT = `You are an Expert Academic Data Extraction Agent. Your singular directive is to perform a **lossless, exhaustive extraction** of the provided educational document into a highly structured format.
12
 
13
- **CRITICAL MANDATE: HEADING-FIRST EXPANSION**
14
- 1. **NO GROUPING:** If a document introduces a list (e.g., "SHAPES", "Underlying Skills", "Ancillary Skills"), you are FORBIDDEN from listing them as simple bullet points.
15
- 2. **MANDATORY H3 HEADINGS:** You MUST create a dedicated H3 (###) heading for EVERY individual item in a framework or list that has a definition or example in the text.
16
- 3. **WORD-FOR-WORD DEFINITIONS:** You must extract the full, detailed definition for each item exactly as provided. Do not summarize or simplify.
17
- 4. **ZERO OMISSION:** If a slide provides a "Scenario" and "Solution" for a specific sub-item (like "Observation"), that Scenario/Solution MUST appear directly under that item's H3 heading.
18
 
19
- **STRICT OUTPUT SCHEMA:**
20
- # [Document Title / Main Topic]
21
 
22
- **Overview:** [A brief 2-3 sentence overview of the entire document]
23
 
24
- ## [Major Section Heading]
25
- [Introduction to the section]
26
 
27
- ### [Framework Item/Sub-topic 1]
28
- * **Full Definition:** [Extract exhaustive definition word-for-word]
29
- * **Context/Importance:** [Detailed context from text]
30
- * **Scenario:** [Specific scenario for this item]
31
- * **Solution/Result:** [Solution for this scenario]
32
 
33
- ### [Framework Item/Sub-topic 2]
34
- *(Repeat this H3 structure for EVERY item. NEVER group them into a single list)*
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  ## Key Scenarios & Practical Applications
37
- *(Capture any general scenarios that weren't specific to a sub-topic)*
 
38
 
39
  ## Final Summary & Synthesis
40
- [Comprehensive wrap-up]
41
 
42
- **FINAL INSTRUCTION:** If you are unsure whether to group or expand, ALWAYS EXPAND. Your goal is a 100% lossless recovery of the lecture's detail.`;
43
 
44
  Deno.serve(async (req) => {
45
  if (req.method === "OPTIONS") return new Response("ok", { headers: corsHeaders });
 
8
  "authorization, x-client-info, apikey, content-type, x-supabase-client-platform, x-supabase-client-platform-version, x-supabase-client-runtime, x-supabase-client-runtime-version",
9
  };
10
 
11
+ const SYSTEM_PROMPT = `You are an Expert Academic Data Extraction Agent. Your directive is to perform a **lossless, exhaustive extraction** of the provided educational document into a professional, clean Markdown format.
12
 
13
+ **STYLE CONSTRAINTS:**
14
+ - **NO EMOJIS:** You are strictly forbidden from using any emojis in the output.
15
+ - **PROFESSIONAL TONE:** Use clear, academic language.
16
+ - **EXHAUSTIVE DETAIL:** Do not summarize. Capture every definition, example, and scenario in full.
 
17
 
18
+ **REQUIRED OUTPUT STRUCTURE:**
 
19
 
20
+ # [Document Title]
21
 
22
+ **Overview:** This note covering [Topic] was created from a [Page Count] page document. It provides a structured walk-through of [Primary Goal of Document].
 
23
 
24
+ ## Key Points
25
+ - [High-level topic 1]
26
+ - [High-level topic 2]
27
+ - [High-level topic 3]
28
+ - [High-level topic 4]
29
 
30
+ ## [Section Heading]
31
+ [Detailed introduction to the section]
32
+
33
+ ### [Sub-topic or Framework Item]
34
+ **Full Definition:** [Extract exhaustive definition word-for-word]
35
+ **Detailed Example/Context:** [Extract full context and examples]
36
+
37
+ **Question:** [If a scenario is presented, format the question here]
38
+ **Answer:** [Format the solution/result here]
39
+
40
+ *(Use Tables for Frameworks like SHAPES or Ancillary Skills lists)*
41
+ | Item | Meaning/Why Important | Example |
42
+ |------|----------------------|---------|
43
+ | [X] | [Y] | [Z] |
44
 
45
  ## Key Scenarios & Practical Applications
46
+ **Scenario:** [Extract general scenarios]
47
+ **Solution/Takeaway:** [Extract solution]
48
 
49
  ## Final Summary & Synthesis
50
+ [A comprehensive wrap-up of the document's value]
51
 
52
+ **FINAL DIRECTIVE:** Maintain 100% fidelity to the source text. Every sub-topic from the document must have its own detailed heading. Never group distinct items into a single paragraph.`;
53
 
54
  Deno.serve(async (req) => {
55
  if (req.method === "OPTIONS") return new Response("ok", { headers: corsHeaders });