untitled-7369main.tsx1 match
34const html = await fetchText(
5"https://en.wikipedia.org/wiki/OpenAI",
6);
7const $ = load(html);
1import { OpenAI } from "https://esm.town/v/std/openai";
23// --- TYPE DEFINITIONS ---
892try {
893if (req.method === "POST") {
894const openai = new OpenAI();
895const body = await req.json();
896897switch (action) {
898case "suggestHabit": {
899const completion = await openai.chat.completions.create({
900model: "gpt-4o",
901messages: [
910}
911case "suggestHabitSet": {
912const completion = await openai.chat.completions.create({
913model: "gpt-4o",
914messages: [
923}
924case "suggestIcons": {
925const completion = await openai.chat.completions.create({
926model: "gpt-4o",
927messages: [
send-transcriptsREADME.md10 matches
13- Send transcript content via email to multiple recipients
14- Save all transcripts to Supabase database for persistence
15- Generate AI-powered summaries using OpenAI GPT-4o-mini
16- Save summaries to final reports table
17- Generate secure access tokens for each report
641. **Email Delivery** - Sends the transcript to configured recipients
652. **Transcript Storage** - Saves the original transcript to the `transcripts` table
663. **AI Summarization** - Uses OpenAI GPT-4o-mini to generate a professional summary
674. **Final Report Storage** - Saves the AI-generated summary to the `final_reports` table
685. **Token Generation** - Creates a secure access token in the `pricing_wizard_report_tokens` table
1053. **Configure environment variables** (optional - falls back to hardcoded keys):
106- `SUPABASE_SERVICE_KEY`
107- `OPENAI_API_KEY`
108- `RESEND_API_KEY`
1094. **Test the API** with a sample message
139- **Body:** The AI-generated summary of the transcript
140- **Email:** The email address of the person who submitted the original transcript
141- **OpenAI Thread ID:** Unique identifier from OpenAI for the completion request
142- **ID:** UUID primary key (automatically generated)
143- **Created At:** Timestamp of summary creation (automatically set by database)
148id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
149email TEXT NOT NULL,
150openai_thread_id TEXT NOT NULL,
151body TEXT NOT NULL,
152created_at TIMESTAMPTZ DEFAULT NOW(),
177## AI Summarization
178179The API uses OpenAI's GPT-4o-mini model to generate professional summaries of transcripts. The AI is prompted to:
180- Focus on key points and decisions made
181- Identify action items and important details
185Each AI-generated summary is associated with:
186- The original submitter's email address
187- The unique OpenAI completion ID for traceability
188189### AI Configuration
191- **Max Tokens:** 1000
192- **Temperature:** 0.3 (for consistent, focused summaries)
193- **API Key:** Configured via environment variable `OPENAI_API_KEY`
194- **Completion Tracking:** Each summary includes the OpenAI completion ID for audit purposes
195196### Database Configuration
199- **Supabase Project ID:** ffilnpatwtlzjrfbmvxk
200- **Supabase Service Role Key:** Configured via environment variable `SUPABASE_SERVICE_KEY`
201- **OpenAI API Key:** Configured via environment variable `OPENAI_API_KEY`
202203### Error Handling
stevensDemo.cursorrules4 matches
100Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
101102### OpenAI
103```ts
104import { OpenAI } from "https://esm.town/v/std/openai";
105const openai = new OpenAI();
106const completion = await openai.chat.completions.create({
107messages: [
108{ role: "user", content: "Say hello in a creative way" },
honeydewtwomain.tsx5 matches
1import { OpenAI } from "https://esm.town/v/std/openai";
23// --- TYPE DEFINITIONS ---
327}
328export default async function(req: Request): Promise<Response> {
329const openai = new OpenAI();
330const url = new URL(req.url);
331const CORS_HEADERS = {
343case "synthesizeProject": {
344const synthesisContent = `Current Date: ${new Date().toISOString().split("T")[0]}\n\nGoal: ${body.goal}`;
345const completion = await openai.chat.completions.create({
346model,
347messages: [{ role: "system", content: PROJECT_SYNTHESIS_PROMPT }, {
359JSON.stringify(body.tasks, null, 2)
360}`;
361const completion = await openai.chat.completions.create({
362model,
363messages: [{ role: "system", content: DAILY_REBALANCE_PROMPT }, {
385conversation.unshift(contextMessage);
386}
387const completion = await openai.chat.completions.create({
388model,
389messages: [{ role: "system", content: CHAT_PROMPT }, ...conversation],
llm-tips.cursorrules4 matches
94Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
9596### OpenAI
9798```ts
99import { OpenAI } from "https://esm.town/v/std/openai";
100const openai = new OpenAI();
101const completion = await openai.chat.completions.create({
102messages: [
103{ role: "user", content: "Say hello in a creative way" },
Sonar.cursorrules4 matches
94Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
9596### OpenAI
9798```ts
99import { OpenAI } from "https://esm.town/v/std/openai";
100const openai = new OpenAI();
101const completion = await openai.chat.completions.create({
102messages: [
103{ role: "user", content: "Say hello in a creative way" },
personal_trmnlpolymarket_cron.tsx3 matches
1import { OpenAI } from "https://esm.town/v/std/openai";
2import { sqlite } from "https://esm.town/v/std/sqlite";
34const CACHE_RAW = "polymarket_raw";
5const CACHE_SUMMARY = "polymarket_summary";
6const openai = new OpenAI();
78// Calculate date 3 months from now for start_date_min
142143// 5) Call AI
144const aiRes = await openai.chat.completions.create({
145model: "gpt-4o-mini",
146messages: [{ role: "user", content: prompt }],
personal_trmnlmalifold_cron.tsx3 matches
1import { OpenAI } from "https://esm.town/v/std/openai";
2import { sqlite } from "https://esm.town/v/std/sqlite";
36const RAW_URL = "https://api.manifold.markets/v0/markets?limit=100&sort=last-bet-time";
7const DETAIL_URL = (id) => `https://api.manifold.markets/v0/market/${id}`;
8const openai = new OpenAI();
910export async function cronValHandler(interval) {
127128// 5) Call AI once
129const aiRes = await openai.chat.completions.create({
130model: "gpt-4o-mini",
131messages: [{ role: "user", content: prompt }],
362//
363export default async function(req: Request) {
364const { OpenAI } = await import("https://esm.town/v/std/openai");
365366const CORS_HEADERS = {
374const format = url.searchParams.get("format");
375const sourceUrl = import.meta.url.replace("esm.town", "val.town");
376const openai = new OpenAI();
377378const jsonResponse = (body: object, status: number) =>
384): Promise<object> {
385try {
386const response = await openai.chat.completions.create({
387model: "gpt-4o",
388messages: [{ role: "system", content: systemPrompt }, { role: "user", content: userMessagePayload }],