24### Analyzer
25
26The analyzer module provides the core functionality for identifying subtle forms of abuse in text. It uses OpenAI's GPT-4o model to analyze text and extract patterns of abuse, manipulation, and problematic language.
27
28Key functions:
11### Core Components
12
13- **Backend API** (`power-abuse-analyzer.ts`): Analyzes text for subtle abuse patterns using OpenAI's GPT-4o model
14- **Frontend Interface** (`frontend/index.html`): A user-friendly chat interface for interacting with the analyzer
15- **Static File Server** (`static-file-server.ts`): Serves the frontend files
2import { email } from "https://esm.town/v/std/email";
3import { extractValInfo } from "https://esm.town/v/stevekrouse/extractValInfo";
4import { OpenAI } from "npm:openai";
5
6function stripHtmlBackticks(html: string): string {
9
10export default async function(e: Email) {
11 const openai = new OpenAI();
12 console.log(`from: ${e.from} to: ${e.to} subject: ${e.subject}, cc: ${e.cc}, bcc: ${e.bcc}`);
13
25 }
26
27 const summary = await openai.chat.completions.create({
28 messages: [
29 {
2import { email } from "https://esm.town/v/std/email";
3import { extractValInfo } from "https://esm.town/v/stevekrouse/extractValInfo";
4import { OpenAI } from "npm:openai";
5
6function stripHtmlBackticks(html: string): string {
9
10export default async function(e: Email) {
11 const openai = new OpenAI();
12 console.log(`from: ${e.from} to: ${e.to} subject: ${e.subject}, cc: ${e.cc}, bcc: ${e.bcc}`);
13
25 }
26
27 const summary = await openai.chat.completions.create({
28 messages: [
29 {
47- **Frontend**: React with TypeScript
48- **Visualizations**: Canvas API, SVG animations
49- **AI Simulation**: OpenAI API for entity communication
50- **Data Storage**: Val Town blob storage
51- **Styling**: TailwindCSS with custom neon effects
205 await handlePatternsExample(typingIndicator);
206 } else {
207 // For general questions, use the OpenAI API
208 await handleGeneralQuestion(question, typingIndicator);
209 }
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" },
7Configure the following variables in your environment:
8- `AGENT_API_KEY` (This is a secure token that you choose to secure the agent.tsx POST endpoint)
9- `OPENAI_API_KEY` (An OpenAI API Key)
10- `EXA_API_KEY` (Optional, though needed if you use the web search tool)
11
1import { anthropic } from "npm:@ai-sdk/anthropic";
2import { openai } from "npm:@ai-sdk/openai";
3import { generateText, streamText } from "npm:ai";
4import { getSystemPrompt } from "./prompt.tsx";
34 const maxSteps = 10;
35
36 const model = Deno.env.get("ANTHROPIC_API_KEY") ? anthropic("claude-3-7-sonnet-latest") : openai("gpt-4.1");
37
38 const options = {