cerebras_codermain.tsx5 matches
212} catch (error) {
213Toastify({
214text: "We may have hit our Cerebras Usage limits. Try again later or fork this and use your own API key.",
215position: "center",
216duration: 3000,
971};
972} else {
973const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
974const completion = await client.chat.completions.create({
975messages: [
1096<meta name="viewport" content="width=device-width, initial-scale=1.0">
1097<title>CerebrasCoder</title>
1098<link rel="preconnect" href="https://fonts.googleapis.com" />
1099<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1100<link
1101href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap"
1102rel="stylesheet"
1103/>
1112<meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1113<meta property="og:type" content="website">
1114<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1115
1116
ValTown-Package-Trackerindex.html2 matches
151async function loadDevices() {
152try {
153const response = await fetch('/api/devices');
154const devices = await response.json();
155
175try {
176const deviceId = deviceSelector.value;
177const url = deviceId ? `/api/locations?deviceId=${deviceId}` : '/api/locations';
178
179const response = await fetch(url);
ValTown-Package-Trackerindex.ts22 matches
4041// Debug endpoint to check system status
42app.get("/api/debug/status", async (c) => {
43try {
44// Check database connection
93app.get("/frontend/*", (c) => serveFile(c.req.path, import.meta.url));
9495// API endpoint to receive ChirpStack payloads
96app.post("/api/location", async (c) => {
97console.log("[INGEST] Received payload request");
98
186});
187188// API endpoint to get location history
189app.get("/api/locations", async (c) => {
190console.log("[API] Fetching location history");
191
192try {
193const deviceId = c.req.query("deviceId");
194if (deviceId) {
195console.log(`[API] Filtering locations by device ID: ${deviceId}`);
196} else {
197console.log("[API] Fetching all locations (no device filter)");
198}
199const { rows } = await getLocationHistory(deviceId);
203);
204console.log(
205`[API] Retrieved ${rows.length} total, ${filtered.length} in North America`
206);
207return c.json(filtered);
208209} catch (error) {
210console.error("[API] Error fetching location history:", error);
211return c.json({
212error: "Database error",
217});
218219// API endpoint to get a specific location
220app.get("/api/locations/:id", async (c) => {
221try {
222const idParam = c.req.param("id");
223console.log(`[API] Fetching location with ID: ${idParam}`);
224
225const id = parseInt(idParam);
226if (isNaN(id)) {
227console.error(`[API] Invalid location ID: ${idParam}`);
228return c.json({
229error: "Invalid parameter",
234const location = await getLocationById(id);
235if (!location) {
236console.log(`[API] Location not found with ID: ${id}`);
237return c.json({
238error: "Not found",
241}
242
243console.log(`[API] Successfully retrieved location with ID: ${id}`);
244return c.json(location);
245} catch (error) {
246console.error(`[API] Error fetching location:`, error);
247return c.json({
248error: "Database error",
253});
254255// API endpoint to get list of devices
256app.get("/api/devices", async (c) => {
257console.log("[API] Fetching device list");
258
259try {
260const devices = await getDevices();
261console.log(`[API] Successfully retrieved ${devices.rows.length} devices`);
262return c.json(devices.rows);
263} catch (error) {
264console.error("[API] Error fetching devices:", error);
265return c.json({
266error: "Database error",
Townieuser-summary.ts1 match
20SUM(num_images) as total_images
21FROM ${USAGE_TABLE}
22WHERE our_api_token = 1
23GROUP BY user_id, username
24ORDER BY total_price DESC
TownieuseProject.tsx2 matches
1import { useState, useEffect } from "https://esm.sh/react@18.2.0?dev";
23const PROJECT_ENDPOINT = "/api/project";
4const FILES_ENDPOINT = "/api/project-files";
56export function useProject (projectId: string, branchId?: string) {
TownieuseProjects.tsx1 match
1import { useState, useEffect } from "https://esm.sh/react@18.2.0?dev";
23const ENDPOINT = "/api/projects-loader";
45export function useProjects () {
TownieuseCreateProject.tsx1 match
1import { useState, useEffect } from "https://esm.sh/react@18.2.0?dev";
23const ENDPOINT = "/api/create-project";
45export function useCreateProject () {
TownieuseCreateBranch.tsx1 match
1import { useState, useEffect } from "https://esm.sh/react@18.2.0?dev";
23const ENDPOINT = "/api/create-branch";
45export function useCreateBranch (projectId: string) {
TownieuseChatLogic.ts2 matches
14project,
15branchId,
16// anthropicApiKey,
17// bearerToken,
18selectedFiles,
33status,
34} = useChat({
35api: "/api/send-message",
36body: {
37project,
TownieuseBranches.tsx1 match
1import { useState, useEffect } from "https://esm.sh/react@18.2.0?dev";
23const ENDPOINT = "/api/project-branches";
45export function useBranches (projectId: string) {