Search
Code125
app.post("/", async (c) => { // Early API key check to avoid confusing when using the tester ui if (!Deno.env.get("OPENAI_API_KEY")) { return c.json( { error: "Add OPENAI_API_KEY in Environment Variables" }, 503, );// Test endpoint for the welcome UIapp.post("/test", async (c) => { if (!Deno.env.get("OPENAI_API_KEY")) { return c.json( { error: "Add OPENAI_API_KEY in Environment Variables" }, 503, );// Reanalyze a leadapp.post("/lead/:id/reanalyze", async (c) => { if (!Deno.env.get("OPENAI_API_KEY")) { return c.json( { error: "Add OPENAI_API_KEY in Environment Variables" }, 503, );import { readFile } from "https://esm.town/v/std/utils/index.ts";import { Agent, run, RunResult, webSearchTool } from "npm:@openai/agents@0.3.0";import { getLeadById, storeLead, updateLeadOutput } from "./db.ts";import { emailsFromGitHubUsername } from "https://esm.town/v/dcm31/github-user-email/index.ts";1. Click [**Remix**](/?intent=remix)2. Add environment variables: - `OPENAI_API_KEY` — for AI lead qualification - `GITHUB_TOKEN` — for accessing GitHub API ([create one here](https://github.com/settings/tokens))1. Click [**Remix**](/?intent=remix)2. Add environment variables: - `OPENAI_API_KEY` — for AI lead qualification - `GITHUB_TOKEN` — for accessing GitHub API ([create one here](https://github.com/settings/tokens))app.post("/", async (c) => { // Early API key check to avoid confusing when using the tester ui if (!Deno.env.get("OPENAI_API_KEY")) { return c.json( { error: "Add OPENAI_API_KEY in Environment Variables" }, 503, );// Test endpoint for the welcome UIapp.post("/test", async (c) => { if (!Deno.env.get("OPENAI_API_KEY")) { return c.json( { error: "Add OPENAI_API_KEY in Environment Variables" }, 503, );// Reanalyze a leadapp.post("/lead/:id/reanalyze", async (c) => { if (!Deno.env.get("OPENAI_API_KEY")) { return c.json( { error: "Add OPENAI_API_KEY in Environment Variables" }, 503, );import { readFile } from "https://esm.town/v/std/utils/index.ts";import { Agent, run, RunResult, webSearchTool } from "npm:@openai/agents@0.3.0";import { getLeadById, storeLead, updateLeadOutput } from "./db.ts"; // 3. Protocol Specific Checks - Ensures response conforms to expected format. if (tag === "COMPAT") { // Expects OpenAI-style response structure: { choices: [{ message: { content: ... } }] } const isOAI = !!json?.choices?.[0]?.message?.content; return isOAI }, { name: "OPENAI_PROTOCOL", // A group for standard OpenAI API compatibility. tag: "COMPAT", configs: [{ ep: "https://text.pollinations.ai/openai", m: "POST", v: "OAI_OBJ", tag: "META", configs: [{ ep: "https://text.pollinations.ai/openai", m: "GET", v: "NONE", tag: "LEGACY", configs: [{ ep: "https://text.pollinations.ai/openai", m: "POST", v: "RAW_TEXT", }, { name: "OPENAI_PROTOCOL", tag: "COMPAT", configs: [{ ep: "https://text.pollinations.ai/openai", m: "POST", v: "OAI_OBJ", tag: "META", configs: [{ ep: "https://text.pollinations.ai/openai", m: "GET", v: "NONE", tag: "LEGACY", configs: [{ ep: "https://text.pollinations.ai/openai", m: "POST", v: "RAW_TEXT",}`; /* "https://text.pollinations.ai/", "https://text.pollinations.ai/openai", "https://text.pollinations.ai/openai/v1", "https://text.pollinations.ai/openai/v2", "https://gen.pollinations.ai/v1/chat/completions", "https://gen.pollinations.ai/v1", "https://gen.pollinations.ai/openai", "https://gen.pollinations.ai/openai/v1", "https://gen.pollinations.ai/openai/chat/comoletions", "",*/ const payloadVariations = [ { name: "RAW_STRING", body: prompt, headers: {"Content-Type": "text/plain"} }, { name: "OAI_OBJ", body: JSON.stringify({messages: [{role:"user", content:prompt}], model: "openai"}), headers: {"Content-Type": "application/json"} }, { name: "SIMPLE_PROMPT_OBJ", body: JSON.stringify({prompt: prompt}), headers: {"Content-Type": "application/json"} }, { name: "INPUT_OBJ", body: JSON.stringify({inputs: prompt}), headers: {"Content-Type": "application/json"} },#### `POST /generate-ai-name`Test AI thread naming (requires OPENAI_API_KEY).```json{| `AUTOTHREAD_ENABLE_AI` | No | Enable AI naming in cron || `AUTOTHREAD_CHANNEL_ALLOWLIST` | No | Comma-separated channel IDs || `OPENAI_API_KEY` | For AI | OpenAI API key (Val Town std lib) |Users
No users found
Docs
No docs found