Townie.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" },
Townie-2system_prompt.txt4 matches
88Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
8990### OpenAI
9192```ts
93import { OpenAI } from "https://esm.town/v/std/openai";
94const openai = new OpenAI();
95const completion = await openai.chat.completions.create({
96messages: [
97{ role: "user", content: "Say hello in a creative way" },
Townie-2.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" },
min-md-blogtest.md3 matches
263:::customcard2
264{
265"link": "https://x.com/OpenAi",
266"imageSrc": "https://pbs.twimg.com/profile_images/1885410181409820672/ztsaR0JW_400x400.jpg",
267"title": "OpenAi",
268"description": "Follow OpenAI on X for updates!",
269"icon": "simple-icons:x",
270"width": "w-48",
Townsystem_prompt.txt4 matches
88Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
8990### OpenAI
9192```ts
93import { OpenAI } from "https://esm.town/v/std/openai";
94const openai = new OpenAI();
95const completion = await openai.chat.completions.create({
96messages: [
97{ role: "user", content: "Say hello in a creative way" },
Town.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" },
thirdTimer.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" },
voicemessagesvoicenotes.ts3 matches
1import { type Context, Hono } from "https://esm.sh/hono@3.11.7";
2import { blob } from "https://esm.town/v/std/blob";
3import { OpenAI } from "https://esm.town/v/std/openai";
4import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
5import Groq from "npm:groq-sdk";
1617const app = new Hono();
18const openai = new OpenAI();
1920// Get all voice notes (for admin/dashboard)
153async function transcribeAudio(voiceNoteId: string, audioBuffer: ArrayBuffer) {
154try {
155// Convert ArrayBuffer to File for OpenAI
156const audioFile = new File([audioBuffer], "audio.webm", { type: "audio/webm" });
157
voicemessagesREADME.md2 matches
67- 🎙️ Record voice notes directly in the browser
8- 🤖 AI-powered transcription using OpenAI Whisper
9- 🔗 Share voice notes via unique URLs
10- ⏰ Set expiration by max listens or date
53- **Database**: SQLite for voice note metadata
54- **Storage**: Val Town Blob storage for audio files
55- **AI**: OpenAI Whisper for transcription
56- **Frontend**: React with TypeScript
57- **Styling**: TailwindCSS
1import { fetch } from "https://esm.town/v/std/fetch";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { PDFExtract, PDFExtractOptions } from "npm:pdf.js-extract";
4173}
174175async function callOpenAI(
176openaiInstance: OpenAI,
177systemPrompt: string,
178userMessage: string,
182agentName: string,
183): Promise<object | string> {
184log.push({ agent: agentName, type: "step", message: `Calling OpenAI model ${model}...` });
185try {
186const response = await openaiInstance.chat.completions.create({
187model: model,
188messages: [
222}
223} catch (error) {
224console.error(agentName, "OpenAI API call error:", error);
225let errMsg = "AI communication error.";
226if (error.message) errMsg += ` Message: ${error.message}`;
1072<li>**No client-side persistence of documents and analyses**</li>
1073</ul>
1074<p>This application uses OpenAI's GPT models for its AI capabilities. Data submitted will be processed by OpenAI.</p>
1075</div>
1076\`;
10851086export default async function(req: Request) {
1087const openai = new OpenAI();
1088const url = new URL(req.url);
1089const format = url.searchParams.get("format");
1154const suggPrompt = legalTaskSuggestionSystemPromptTemplate.replace("%%DOCUMENT_TEXT%%", suggText);
1155const suggAgent = "Task Suggestion AI (LLM1)";
1156const suggRes = await callOpenAI(
1157openai,
1158suggPrompt,
1159"Generate task suggestions based on the provided document text.",
13031304const analysisAgent = "Legal Analysis AI (LLM2)";
1305const aiRes = await callOpenAI(openai, finalPrompt, docToAnalyze, "gpt-4o", true, log, analysisAgent);
13061307if (typeof aiRes === "object" && (aiRes as any).error) {