1import ky from "https://esm.sh/ky";
2
3const response = await fetch("https://www.google.com?q=openai&hl=en&gl=us", {
4 headers: {
5 "User-Agent":
593
594export default async function(req: Request) {
595 const { OpenAI } = await import("https://esm.town/v/std/openai");
596 const { PDFExtract } = await import("npm:pdf.js-extract");
597
607 const action = url.searchParams.get("action");
608 const sourceUrl = import.meta.url.replace("esm.town", "val.town");
609 const openai = new OpenAI();
610 const MAX_TEXT_SUGGEST = 20000;
611 const MAX_TEXT_ANALYZE = 30000;
636 agentName: string,
637 ): Promise<object> {
638 log.push({ agent: agentName, type: "step", message: `Calling OpenAI gpt-4o...` });
639 try {
640 const response = await openai.chat.completions.create({
641 model: "gpt-4o",
642 messages: [{ role: "system", content: systemPrompt }, { role: "user", content: userMessage }],
102## Tech Stack
103
104- Backend: Hono + Val Town OpenAI (GPT-4o-mini)
105- Frontend: React + TailwindCSS with markdown rendering
106- Storage: None (stateless analysis)
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 { encode } from "https://esm.sh/gpt-tokenizer@2.1.2";
12});
13
14const openai = new OpenAI();
15
16// Default token limits - reduced chunk size for better granularity
123
124 try {
125 const completion = await openai.chat.completions.create({
126 messages: [
127 { role: "system", content: systemPrompt },
178
179 try {
180 const completion = await openai.chat.completions.create({
181 messages: [
182 { role: "system", content: systemPrompt },
38 description: 'Advanced conversational AI for writing, coding, analysis, and creative tasks',
39 category: 'text-ai',
40 url: 'https://chat.openai.com',
41 tags: JSON.stringify(['conversation', 'writing', 'coding', 'analysis']),
42 pricing: 'freemium',
123 {
124 name: 'DALL-E 3',
125 description: 'OpenAI\'s advanced image generation model with exceptional prompt understanding',
126 category: 'image-gen',
127 url: 'https://openai.com/dall-e-3',
128 tags: JSON.stringify(['openai', 'text-to-image', 'creative', 'advanced']),
129 pricing: 'paid',
130 featured: true,
217 description: 'Advanced conversational AI for writing, coding, analysis, and creative tasks',
218 category: 'text-ai',
219 url: 'https://chat.openai.com',
220 tags: JSON.stringify(['conversation', 'writing', 'coding', 'analysis']),
221 pricing: 'freemium',
88Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
89
90### OpenAI
91
92```ts
93import { OpenAI } from "https://esm.town/v/std/openai";
94const openai = new OpenAI();
95const completion = await openai.chat.completions.create({
96 messages: [
97 { role: "user", content: "Say hello in a creative way" },
94Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
95
96### OpenAI
97
98```ts
99import { OpenAI } from "https://esm.town/v/std/openai";
100const openai = new OpenAI();
101const completion = await openai.chat.completions.create({
102 messages: [
103 { role: "user", content: "Say hello in a creative way" },
88Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
89
90### OpenAI
91
92```ts
93import { OpenAI } from "https://esm.town/v/std/openai";
94const openai = new OpenAI();
95const completion = await openai.chat.completions.create({
96 messages: [
97 { role: "user", content: "Say hello in a creative way" },
94Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
95
96### OpenAI
97
98```ts
99import { OpenAI } from "https://esm.town/v/std/openai";
100const openai = new OpenAI();
101const completion = await openai.chat.completions.create({
102 messages: [
103 { role: "user", content: "Say hello in a creative way" },