Skip to content

Commit f6cabc8

Browse files
committed
modified the prompt
1 parent 2076db9 commit f6cabc8

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

  • supabase/functions/analyze-event

supabase/functions/analyze-event/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { serve } from "https://deno.land/std@0.168.0/http/server.ts"
22
import Groq from "npm:groq-sdk"
33

4-
// Declare Deno global to fix TypeScript errors in standard IDE setups
54
declare const Deno: {
65
env: {
76
get(name: string): string | undefined;
@@ -28,7 +27,6 @@ serve(async (req) => {
2827
let textToParse = "";
2928
let todayStr = "";
3029

31-
// Check if the request contains audio (FormData) or raw text (JSON)
3230
const contentType = req.headers.get("content-type") || "";
3331
if (contentType.includes("multipart/form-data")) {
3432
const formData = await req.formData();
@@ -52,11 +50,12 @@ serve(async (req) => {
5250

5351
const systemPrompt = `
5452
You are an expert scheduling assistant. Your ONLY job is to extract event details and output an EXACT, valid JSON object.
55-
Context Information: Today's local date is ${todayStr}. Use this to exactly calculate actual dates for relative words like "today", "tomorrow", "Friday", "next week", etc.
53+
Context Information: Today's local date is ${todayStr}. Use this to exactly calculate actual dates for relative words like "today", "tomorrow", "Friday", "half a month", "a month before", etc.
5654
5755
Use EXACTLY these keys and formats:
56+
- "thought_process": (string) Briefly explain your logic for calculating the final date and time based on the user's constraints. E.g. "The user said 1 month before April 28th, so the target date is March 28th."
5857
- "title": (string) A short, clean event title.
59-
- "date": (string) MUST be EXACTLY "YYYY-MM-DD". Calculate the date precisely. If totally unknown, return null.
58+
- "date": (string) MUST be EXACTLY "YYYY-MM-DD". Calculate the exact date algebraically based on your thought process. If totally unknown, return null.
6059
- "time": (string) MUST be EXACTLY "HH:MM" (24-hour time). E.g., "14:30" (2:30 PM), "09:00" (9 AM). If totally unknown, return null.
6160
- "description": (string) Clean summary. Remove any junk OCR characters, menus, random symbols. Return "" if none.
6261
- "category": (string) Best match: "work", "personal", "family", "health", "social", or "".

0 commit comments

Comments
 (0)