1import { PresidentDocs } from "./nonprofitDocs";
2import { OpenAI } from "https://esm.town/v/std/openai";
3
4const openai = new OpenAI();
5
6export default async function (req: Request): Promise<Response> {
19 // { role: "user", content: "Say hello in a creative way" },
20
21 const completion = await openai.chat.completions.create({
22 messages: [
23 { role: "system", content: systemPrompt },
1import { nanoid } from "https://deno.land/x/nanoid@v3.0.0/mod.ts";
2import { blob } from "https://esm.town/v/std/blob?v=11";
3import { OpenAI } from "https://esm.town/v/std/openai?v=4";
4
5const AUDIT_DEPTH_INTERVAL = 2;
40
41// --- BACKEND LOGIC ---
42const openai = new OpenAI();
43
44async function callAI(
47): Promise<Prerequisite[]> {
48 try {
49 const completion = await openai.chat.completions.create({
50 model: "gpt-4o",
51 messages: [
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" },
1// @ts-ignore
2import { OpenAI } from "https://esm.town/v/std/openai?v=4";
3// @ts-ignore
4import { blob } from "https://esm.town/v/std/blob?v=11";
109const MAX_DEPTH = 4;
110const AUDIT_DEPTH_INTERVAL = 2; // Trigger auditor every 2 levels.
111const openai = new OpenAI();
112
113/**
116async function callAI(fact: string, prompt: string): Promise<Prerequisite[]> {
117 try {
118 const completion = await openai.chat.completions.create({
119 model: "gpt-4o",
120 messages: [
1// @ts-ignore
2import { OpenAI } from "https://esm.town/v/std/openai?v=4";
3// @ts-ignore
4import { blob } from "https://esm.town/v/std/blob?v=11";
57// --- CORE AI & TREE LOGIC ---
58const MAX_DEPTH = 4;
59const openai = new OpenAI();
60
61async function callAI(fact: string, prompt: string): Promise<Prerequisite[]> {
62 try {
63 const completion = await openai.chat.completions.create({
64 model: "gpt-4o",
65 messages: [
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" },