cerebrasTemplatemain.tsx3 matches
3import React, { useState } from "https://esm.sh/react@18.2.0";
45function App() {
6const [messages, setMessages] = useState([]);
7const [input, setInput] = useState("");
71}
7273function client() {
74createRoot(document.getElementById("root")).render(<App />);
75}
79}
8081export default async function server(request: Request): Promise<Response> {
82if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
83const { messages } = await request.json();
victoriousGreenLynxmain.tsx3 matches
3import React, { useState, useEffect, useRef } from "https://esm.sh/react@18.2.0";
45function App() {
6const [messages, setMessages] = useState([]);
7const [input, setInput] = useState("");
81}
8283function client() {
84createRoot(document.getElementById("root")).render(<App />);
85}
89}
9091export default async function server(request: Request): Promise<Response> {
92if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
93const { messages } = await request.json();
masterfulPeachHookwormmain.tsx3 matches
3import React, { useState } from "https://esm.sh/react@18.2.0";
45function App() {
6const [messages, setMessages] = useState([]);
7const [input, setInput] = useState("");
71}
7273function client() {
74createRoot(document.getElementById("root")).render(<App />);
75}
79}
8081export default async function server(request: Request): Promise<Response> {
82if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
83const { messages, sassy } = await request.json();
knowledgeableTomatoCrawdadmain.tsx3 matches
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
45function App() {
6const [messages, setMessages] = useState([]);
7const [input, setInput] = useState("");
79}
8081function client() {
82createRoot(document.getElementById("root")).render(<App />);
83}
87}
8889export default async function server(request: Request): Promise<Response> {
90if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
91const { messages } = await request.json();
considerateTealRoundwormmain.tsx11 matches
26const PoweredByInfo = "";
2728function Hero({
29prompt,
30setPrompt,
4748<p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
49Turn your ideas into fully functional apps in{" "}
50<span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
51less than a second!
121}
122123function App() {
124const previewRef = React.useRef<HTMLDivElement>(null);
125const [prompt, setPrompt] = useState("");
175});
176177function handleStarterPromptClick(promptItem: typeof prompts[number]) {
178setLoading(true);
179setTimeout(() => handleSubmit(promptItem.prompt), 0);
180}
181182async function handleSubmit(e: React.FormEvent | string) {
183if (typeof e !== "string") {
184e.preventDefault();
231}
232233function handleVersionChange(direction: "back" | "forward") {
234const { currentVersionIndex, versions } = versionHistory;
235if (direction === "back" && currentVersionIndex > 0) {
920);
921922function client() {
923const path = window.location.pathname;
924const root = createRoot(document.getElementById("root")!);
956}
957958function extractCodeFromFence(text: string): string {
959const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
960return htmlMatch ? htmlMatch[1].trim() : text;
961}
962963async function generateCode(prompt: string, currentCode: string) {
964const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
965if (starterPrompt) {
1006}
10071008export default async function cerebras_coder(req: Request): Promise<Response> {
1009// Dynamic import for SQLite to avoid client-side import
1010const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1109<meta property="og:site_name" content="Cerebras Coder">
1110<meta property="og:url" content="https://cerebrascoder.com"/>
1111<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."">
1112<meta property="og:type" content="website">
1113<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
blissfulBrownSmeltmain.tsx2 matches
34}
3536async function detectTechnologies(email_address: string): Promise<ShovelResponse> {
37const domain = email_address.split("@")[1];
3857}
5859export async function newUserWelcomeEmail(req: Request): Promise<Response> {
60// if (req.method === "GET") return html(welcomeEmail);
61if (req.headers.get("clerkNonSensitive") !== Deno.env.get("clerkNonSensitive"))
adventurousTealSalmonmain.tsx11 matches
26const PoweredByInfo = "";
2728function Hero({
29prompt,
30setPrompt,
4748<p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
49Turn your ideas into fully functional apps in{" "}
50<span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
51less than a second
121}
122123function App() {
124const previewRef = React.useRef<HTMLDivElement>(null);
125const [prompt, setPrompt] = useState("");
175});
176177function handleStarterPromptClick(promptItem: typeof prompts[number]) {
178setLoading(true);
179setTimeout(() => handleSubmit(promptItem.prompt), 0);
180}
181182async function handleSubmit(e: React.FormEvent | string) {
183if (typeof e !== "string") {
184e.preventDefault();
231}
232233function handleVersionChange(direction: "back" | "forward") {
234const { currentVersionIndex, versions } = versionHistory;
235if (direction === "back" && currentVersionIndex > 0) {
920);
921922function client() {
923const path = window.location.pathname;
924const root = createRoot(document.getElementById("root")!);
956}
957958function extractCodeFromFence(text: string): string {
959const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
960return htmlMatch ? htmlMatch[1].trim() : text;
961}
962963async function generateCode(prompt: string, currentCode: string) {
964const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
965if (starterPrompt) {
1006}
10071008export default async function cerebras_coder(req: Request): Promise<Response> {
1009// Dynamic import for SQLite to avoid client-side import
1010const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1109<meta property="og:site_name" content="Cerebras Coder">
1110<meta property="og:url" content="https://cerebrascoder.com"/>
1111<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."">
1112<meta property="og:type" content="website">
1113<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
cerebras_searchermain.tsx3 matches
9];
1011function App() {
12const [query, setQuery] = useState("");
13const [searchLoading, setSearchLoading] = useState(false);
132}
133134function client() {
135createRoot(document.getElementById("root")).render(<App />);
136}
140}
141142export default async function server(req: Request): Promise<Response> {
143if (req.method === "POST") {
144const url = new URL(req.url);
emailValHandlermain.tsx10 matches
3import { pdfText } from "jsr:@pdf/pdftext";
45// main controller function
6export async function emailValHandler(receivedEmail) {
7const openaiUrl = "https://api.openai.com/v1/chat/completions";
8const apiKey = Deno.env.get("OPENAI_API_KEY"); // replace this entire line with your OpenAI API key as a string, e.g., "sk-123..." or use environment variable: https://docs.val.town/reference/environment-variables/
4849// extract attachments (if any)
50async function extractAttachments(email) {
51if (!email.attachments || email.attachments.length === 0) {
52return [];
64}
6566async function extractPdfText(attachments) {
67const pdfTexts = [];
6897}
9899// helper function to generate a prompt for openai
100function generatePrompt(email, pdfTexts, emailText) {
101// extract the first name from the 'from' field if it exists
102const senderName = email.from.split("<")[0].trim().split(" ")[0] || "";
121}
122123// helper function to send a request to openai
124async function sendRequestToOpenAI(prompt, openaiUrl, apiKey, model) {
125try {
126// prepare the openai messages payload
161}
162163// helper function to send a response back via email
164async function sendResponseByEmail(toEmail, responseContent) {
165const subject = "AI Response to Your Email";
166const text = `${responseContent}`;
agWebsiteStatusmain.tsx3 matches
5import { renderToString } from "npm:react-dom/server";
67function StatusRow({ rows }) {
8return (
9<div className="w-full flex flex-col space-y-2">
28}
2930function StatusSection({ url, rows }) {
31const sectionRows = rows.filter(row => row[0] === url);
32const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
46}
4748export default async function(req: Request): Promise<Response> {
49const { rows } = await sqlite.execute(
50"select url, ok, duration, timestamp from uptime order by timestamp desc limit 200",