twitterNewTweetAlertmain.tsx2 matches
45if (!discordWebhookUrl) {
6throw new Error("Either Discord webhook URL or Telegram bot API token and user ID must be provided.");
7}
8191192if (!response.ok) {
193throw new Error(`Discord API responded with status: ${response.status}`);
194}
195}
saveTextToPodcastindex.ts11 matches
203}
204205// Convert a single text chunk to speech using Deepgram's TTS API with callback
206async function textChunkToSpeechWithCallback(
207text: string,
210callbackUrl: string,
211): Promise<void> {
212const deepgramApiKey = Deno.env.get("DEEPGRAM_API_KEY");
213if (!deepgramApiKey) {
214throw new Error("DEEPGRAM_API_KEY environment variable is required");
215}
216237try {
238const response = await fetch(
239`https://api.deepgram.com/v1/speak?model=${model}&callback_url=${callbackUrlEncoded}`,
240{
241method: "POST",
242headers: {
243"Authorization": `Token ${deepgramApiKey}`,
244"Content-Type": "application/json",
245},
250if (!response.ok) {
251const error = await response.text();
252console.error("Deepgram API Error Details:", {
253status: response.status,
254statusText: response.statusText,
258textLength: cleanText.length,
259});
260throw new Error(`Deepgram TTS API error: ${response.status} - ${error}`);
261}
262264} catch (fetchError) {
265console.error("Fetch error:", fetchError);
266throw new Error(`Network error calling Deepgram API: ${fetchError.message}`);
267}
268}
298// Verify the request is from Deepgram by checking the dg-token header
299const dgToken = c.req.header("dg-token");
300const expectedToken = Deno.env.get("DEEPGRAM_API_KEY");
301302if (!dgToken || dgToken !== expectedToken) {
687app.get("/", (c) => {
688return c.json({
689message: "Text-to-Speech API with Deepgram Callbacks",
690endpoints: {
691"POST /convert": "Start async text-to-speech conversion (requires: Authorization header, file, name)",
215const SEVEN_NOTE_FORM = [0, 3, 6, 8, 10, 12, 14];
216const SINGLE_LINE_HEIGHT_PX = 150;
217const API_ENDPOINT = 'generate';
218219// --- DOM ELEMENTS ---
352}
353try {
354const response = await fetch(API_ENDPOINT, { method: 'POST' });
355if (!response.ok) throw new Error(\`Server responded with \${response.status}\`);
356const data = await response.json();
learning-botmain.tsx1 match
34const bot = new Bot(Deno.env.get("TELEGRAM_TOKEN")!);
5bot.api.sendMessage("5427167514", "Hello!");
67// Appending to a sheet
learning-botnew-file-4258.ts2 matches
15});
1617bot.api.sendMessage("5427167514", "Hello!");
1819// Use part of the TELEGRAM_TOKEN itself as the secret_token
35// This is a no-op if nothing's changed
36if (!isEndpointSet) {
37await bot.api.setWebhook(req.url, {
38secret_token: SECRET_TOKEN,
39});
42- **3D Rendering**: Three.js with WebGL
43- **Styling**: Tailwind CSS with custom components
44- **Backend**: Hono.js for API endpoints
45- **Mathematics**: Custom libraries for higher-dimensional calculations
46- **Platform**: Val Town serverless environment
105```
106โโโ backend/
107โ โโโ index.ts # Main API server with Hono
108โ โโโ routes/ # API endpoints for calculations
109โโโ frontend/
110โ โโโ components/
128```
129130## ๐ง API Endpoints
131132- `GET /`: Main application interface
133- `GET /api/health`: Application health check
134- `GET /api/shapes/:dimension/:shape`: Shape metadata and properties
135- `POST /api/calculate`: Mathematical computation endpoints
136- `GET /api/performance`: Performance monitoring data
137138## ๐ Educational Value
AIDAGeometryViewer.tsx35 matches
255}, [container, appState.camera, appState.lighting, appState.rendering.showFaces]);
256257// Enhanced geometry update with backend API integration
258const updateGeometry = useCallback(async () => {
259if (!geometryGroupRef.current) return;
280281try {
282// Use backend API for shape generation and projection
283let apiResponse;
284let projectedVertices: Vector3D[] = [];
285let edges: { start: number; end: number }[] = [];
287288if (appState.dimension === 4) {
289// Call 4D shape API
290const response = await fetch('/api/calculate/shape4d', {
291method: 'POST',
292headers: {
300301if (!response.ok) {
302throw new Error(`API Error: ${response.status} ${response.statusText}`);
303}
304305apiResponse = await response.json();
306
307if (!apiResponse.success) {
308throw new Error(apiResponse.error || 'Failed to generate 4D shape');
309}
310311// Extract projected data from API response
312projectedVertices = apiResponse.projected3D.vertices;
313edges = apiResponse.projected3D.edges;
314faces = apiResponse.projected3D.faces;
315316// Update performance stats
317setRenderStats({
318vertices: apiResponse.metadata.vertices,
319faces: apiResponse.metadata.faces || faces.length,
320drawCalls: (appState.rendering.showVertices ? 1 : 0) +
321(appState.rendering.showEdges ? 1 : 0) +
326const vertexCountElement = document.getElementById('vertexCount');
327if (vertexCountElement) {
328vertexCountElement.textContent = apiResponse.metadata.vertices.toString();
329}
330331// Pass shape data to parent for cross-section analysis
332if (onShapeGenerated) {
333onShapeGenerated(apiResponse.shape4D);
334}
335336} else if (appState.dimension === 5) {
337// Call 5D shape API
338const response = await fetch('/api/calculate/shape5d', {
339method: 'POST',
340headers: {
348349if (!response.ok) {
350throw new Error(`API Error: ${response.status} ${response.statusText}`);
351}
352353apiResponse = await response.json();
354
355if (!apiResponse.success) {
356throw new Error(apiResponse.error || 'Failed to generate 5D shape');
357}
358359// Extract projected data from API response
360projectedVertices = apiResponse.projected3D.vertices;
361edges = apiResponse.projected3D.edges;
362faces = apiResponse.projected3D.faces;
363364// Update performance stats
365setRenderStats({
366vertices: apiResponse.metadata.vertices,
367faces: apiResponse.metadata.faces || faces.length,
368drawCalls: (appState.rendering.showVertices ? 1 : 0) +
369(appState.rendering.showEdges ? 1 : 0) +
374const vertexCountElement = document.getElementById('vertexCount');
375if (vertexCountElement) {
376vertexCountElement.textContent = apiResponse.metadata.vertices.toString();
377}
378}
379380// Create enhanced 3D visualization with API data
381await createEnhancedVisualization(projectedVertices, edges, faces);
382383// Handle cross-sections with backend API
384if (appState.crossSection.enabled && apiResponse) {
385try {
386const crossSectionResponse = await fetch('/api/calculate/cross-section', {
387method: 'POST',
388headers: {
390},
391body: JSON.stringify({
392shape: appState.dimension === 4 ? apiResponse.shape4D : apiResponse.shape5D,
393hyperplane: {
394position: appState.crossSection.position,
FrontendQAExampleindex.ts2 matches
12app.get("/frontend/**/*", c => serveFile(c.req.path, import.meta.url));
1314// Add your API routes here
15// app.get("/api/data", c => c.json({ hello: "world" }));
1617// Unwrap and rethrow Hono errors as the original error
saveTextToPodcastREADME.md7 matches
1# Text-to-Speech API with Deepgram Callbacks
23This HTTP Val converts text files to speech using Deepgram's TTS API with async callbacks to handle large files without timeouts.
45## Setup
671. Set the `DEEPGRAM_API_KEY` environment variable in your Val Town settings
82. Set the `AUTH_TOKEN` environment variable for API authorization
93. The SQLite database tables will be created automatically on first use
1023241. Visit `/test` for a web interface to upload and convert text files
252. Or use the API endpoints directly (see below)
2627## API Endpoints
2829### GET /test
178179- **POST /convert**: Requires `Authorization: Bearer YOUR_TOKEN` header
180- **POST /deepgram-callback**: Validates `dg-token` header matches `DEEPGRAM_API_KEY`
181- **GET /podcast.xml**: Requires `?key=YOUR_TOKEN` query parameter
182- All other endpoints (episodes list, audio serving, test page, job status) are public
untitled-5156main.tsx2 matches
52}
53if (link?.includes("pixeld")) {
54if (!link?.includes("api")) {
55const token = link.split("/").pop();
56const baseUrl = link.split("/").slice(0, -2).join("/");
57link = `${baseUrl}/api/file/${token}?download`;
58}
59streamLinks.push({ server: "Pixeldrain", link: link, type: "mkv" });