1import { OpenAI } from "https://esm.town/v/std/openai";
2import type { AIGenerationRequest, AIGenerationResponse } from "../../shared/types.ts";
3
4const openai = new OpenAI();
5
6export async function generateContent(request: AIGenerationRequest): Promise<AIGenerationResponse> {
39Generate an improved description:`;
40
41 const completion = await openai.chat.completions.create({
42 messages: [{ role: "user", content: prompt }],
43 model: "gpt-4o-mini",
51 const suggestionsPrompt = `Generate 2 alternative short descriptions for the same product. Each should be 1-2 sentences and include emojis:`;
52
53 const suggestionsCompletion = await openai.chat.completions.create({
54 messages: [
55 { role: "user", content: prompt },
88Generate a helpful auto-reply response:`;
89
90 const completion = await openai.chat.completions.create({
91 messages: [{ role: "user", content: prompt }],
92 model: "gpt-4o-mini",
48- **Backend**: Hono + TypeScript
49- **Frontend**: React + TypeScript + TailwindCSS
50- **AI**: OpenAI GPT for content generation
51- **Voice**: Web Speech API for voice input
2
3import { Hono } from "https://esm.sh/hono@3.11.7";
4import { OpenAI } from "https://esm.town/v/std/openai";
5import type {
6 MealPlanRequest,
26
27const plans = new Hono();
28const openai = new OpenAI();
29
30// Generate a new meal plan
53- **Database**: SQLite for user preferences and meal data
54- **Styling**: TailwindCSS
55- **AI**: OpenAI for intelligent meal suggestions
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import {
4 getUserSkills,
12
13const matching = new Hono();
14const openai = new OpenAI();
15
16// AI-powered skill matching
84Format: {"score": number, "reasoning": "string"}`;
85
86 const completion = await openai.chat.completions.create({
87 messages: [{ role: "user", content: prompt }],
88 model: "gpt-4o-mini",
287Return as JSON array: ["skill1", "skill2", "skill3", "skill4", "skill5"]`;
288
289 const completion = await openai.chat.completions.create({
290 messages: [{ role: "user", content: prompt }],
291 model: "gpt-4o-mini",
59## Environment Variables
60
61- `OPENAI_API_KEY`: Required for AI matching functionality
1// Mood check-in routes for Ayédùn app
2import { Hono } from "https://esm.sh/hono@3.11.7";
3import { OpenAI } from "https://esm.town/v/std/openai";
4import { createMoodEntry, getUserMoodEntries, trackEngagement } from "../database/queries.ts";
5import { MOODS, AFFIRMATIONS } from "../../shared/data.ts";
6
7const mood = new Hono();
8const openai = new OpenAI();
9
10// Get all available moods
46 Provide a gentle, culturally warm affirmation in ${language === 'fr' ? 'French' : 'English'} that acknowledges their feelings and offers hope. Keep it under 100 characters and make it personal and healing-focused.`;
47
48 const completion = await openai.chat.completions.create({
49 messages: [{ role: "user", content: prompt }],
50 model: "gpt-4o-mini",
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
4import type { StoryRequest, PoemRequest, GenerationResponse, LogsResponse, EngagementStats } from "../shared/types.ts";
15});
16
17const openai = new OpenAI();
18
19// Helper function to get or create session ID
72Create an engaging story with a clear beginning, middle, and end. Focus on vivid imagery, compelling dialogue, and emotional resonance. The story should capture the specified mood and explore the theme meaningfully.`;
73
74 const completion = await openai.chat.completions.create({
75 messages: [
76 {
97 } else {
98 // Generate a title
99 const titleCompletion = await openai.chat.completions.create({
100 messages: [
101 {
150Create a poem that evokes the specified mood and meaningfully explores the theme. Use vivid imagery, metaphor, and emotional resonance. The poem should feel authentic and inspiring.`;
151
152 const completion = await openai.chat.completions.create({
153 messages: [
154 {
175 } else {
176 // Generate a title
177 const titleCompletion = await openai.chat.completions.create({
178 messages: [
179 {
19- **Backend**: Hono API framework
20- **Database**: SQLite for user data and analytics
21- **AI**: OpenAI for affirmations and recommendations
22- **Styling**: African-inspired design with warm color palette
23
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { readFile } from "https://esm.town/v/std/utils@85-main/index.ts";
4
10});
11
12const openai = new OpenAI();
13
14// Fallback name pairs for when OpenAI parsing fails
15function generateFallbackPairs(genderPreference: string, style: string) {
16 const fallbacks = {
125Focus on creating beautiful, meaningful name combinations that parents would actually consider. Return only the JSON object.`;
126
127 const completion = await openai.chat.completions.create({
128 messages: [
129 { role: "system", content: "You are a helpful assistant specializing in baby names. Provide creative, culturally diverse, and meaningful name suggestions." },