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",
isAgWebsiteDownmain.tsx1 match
13);
1415export async function uptimeCheck(url: string) {
16let ok = true;
17let reason: string;
mileiShowGraphmain.tsx3 matches
13} from "https://esm.sh/recharts@2.7.2?deps=react@18.2.0,react-dom@18.2.0";
1415function App({ tweetData }) {
16const [selectedTweetId, setSelectedTweetId] = useState("1852746483306492004");
17const [filteredData, setFilteredData] = useState([]);
123}
124125function client() {
126const tweetData = JSON.parse(document.getElementById("tweet-data").textContent);
127createRoot(document.getElementById("root")).render(<App tweetData={tweetData} />);
129if (typeof document !== "undefined") { client(); }
130131export default async function server(request: Request): Promise<Response> {
132const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
133
ALPHANUMERIC_TEXT_TOO_LONGmain.tsx3 matches
3import React, { useState } from "https://esm.sh/react@18.2.0";
45function App() {
6const [messages, setMessages] = useState([
7{ role: "system", content: "You are a helpful AI assistant." },
63}
6465function client() {
66createRoot(document.getElementById("root")).render(<App />);
67}
68if (typeof document !== "undefined") { client(); }
6970export default async function server(request: Request): Promise<Response> {
71if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
72try {
cerebras_codermain.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">
aiEmailAssistantmain.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_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}`;
welcomingAmethystMoosemain.tsx4 matches
3import React, { useState } from "https://esm.sh/react@18.2.0";
45function PaymentButton({ method, icon, onClick }) {
6return (
7<button
23}
2425function App() {
26const [status, setStatus] = useState("Ready to pay");
27100}
101102function client() {
103createRoot(document.getElementById("root")).render(<App />);
104}
105if (typeof document !== "undefined") { client(); }
106107export default async function server(request: Request): Promise<Response> {
108if (request.method === "POST" && new URL(request.url).pathname === "/process-payment") {
109try {
paymentGatewayWebmain.tsx4 matches
3import React, { useState } from "https://esm.sh/react@18.2.0";
45function PaymentButton({ method, icon, onClick }) {
6return (
7<button
23}
2425function App() {
26const [status, setStatus] = useState("Ready to pay");
27100}
101102function client() {
103createRoot(document.getElementById("root")).render(<App />);
104}
105if (typeof document !== "undefined") { client(); }
106107export default async function server(request: Request): Promise<Response> {
108if (request.method === "POST" && new URL(request.url).pathname === "/process-payment") {
109try {