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) {
1000);
10011002function client() {
1003const path = window.location.pathname;
1004const root = createRoot(document.getElementById("root")!);
1036}
10371038function extractCodeFromFence(text: string): string {
1039const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1040return htmlMatch ? htmlMatch[1].trim() : text;
1041}
10421043async function generateCode(prompt: string, currentCode: string) {
1044const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1045if (starterPrompt) {
1086}
10871088export default async function cerebras_coder(req: Request): Promise<Response> {
1089// Dynamic import for SQLite to avoid client-side import
1090const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1189<meta property="og:site_name" content="Cerebras Coder">
1190<meta property="og:url" content="https://cerebrascoder.com"/>
1191<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."">
1192<meta property="og:type" content="website">
1193<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
lotterymahaGamemain.tsx3 matches
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
45function WalletApp() {
6const [mode, setMode] = useState('login');
7const [username, setUsername] = useState('');
514}
515516function client() {
517createRoot(document.getElementById("root")).render(<WalletApp />);
518}
520if (typeof document !== "undefined") { client(); }
521522export default async function server(request: Request): Promise<Response> {
523const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
524const KEY = "lotterymahaGame";
labUploadUploadmain.tsx1 match
2import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
34export default async function(req: Request): Promise<Response> {
5let json;
6try {
blobStoragemain.tsx8 matches
13}
1415function Tooltip({ children, content }: TooltipProps) {
16const [isVisible, setIsVisible] = useState(false);
17const tooltipRef = useRef<HTMLDivElement>(null);
52}
5354function formatBytes(bytes: number, decimals = 2) {
55if (bytes === 0) return "0 Bytes";
56const k = 1024;
61}
6263function copyToClipboard(text: string) {
64navigator.clipboard.writeText(text).then(() => {
65console.log("Text copied to clipboard");
69}
7071function ActionMenu({ blob, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
72const [isOpen, setIsOpen] = useState(false);
73const menuRef = useRef(null);
7677useEffect(() => {
78function handleClickOutside(event) {
79if (menuRef.current && !menuRef.current.contains(event.target)) {
80event.stopPropagation();
158}
159160function BlobItem({ blob, onSelect, isSelected, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
161const [isLoading, setIsLoading] = useState(false);
162const decodedKey = decodeURIComponent(blob.key);
219}
220221function App({ initialEmail, initialProfile }) {
222const encodeKey = (key: string) => encodeURIComponent(key);
223const decodeKey = (key: string) => decodeURIComponent(key);
645}
646647function client() {
648const initialEmail = document.getElementById("root").getAttribute("data-email");
649const initialProfile = JSON.parse(document.getElementById("root").getAttribute("data-profile"));
emailValHandlermain.tsx14 matches
58import { pdfText } from "jsr:@pdf/pdftext";
5960// Main controller function
61export default async function emailValHandler(receivedEmail) {
62const openaiUrl = "https://api.openai.com/v1/chat/completions";
63const openaiKey = Deno.env.get("OPENAI_API_KEY");
100101// Extract attachments (if any)
102async function extractAttachments(email) {
103if (!email.attachments || email.attachments.length === 0) {
104return [];
117118// Extract links from email text
119function extractLinks(text) {
120const urlRegex = /(https?:\/\/[^\s]+)/g;
121return text.match(urlRegex) || [];
123124// Extract website markdown content
125async function extractWebsiteMarkdown(links, apiKey) {
126const markdownResults = [];
127const requestsPerMinute = 5;
177178// Process image attachments with GPT-4V
179async function analyzeImage(imageAttachment, apiKey, transformedPrompt) {
180try {
181const response = await fetch("https://api.openai.com/v1/chat/completions", {
221222// Transform the original prompt using the prompt transformer
223async function transformPrompt(emailText, openaiUrl, apiKey, model) {
224const promptTransformerText =
225`You are an AI assistant tasked with transforming user queries into structured research or information requests. Your goal is to take a simple query and expand it into a comprehensive research objective with specific formatting requirements.
311312// Process all attachments (PDFs and Images)
313async function processAttachments(attachments, apiKey, transformedPrompt) {
314const pdfTexts = [];
315const imageAnalysis = [];
331}
332333async function extractPdfText(attachments) {
334const pdfTexts = [];
335365366// Generate the final prompt with all context
367function generateFinalPrompt(transformedPrompt, pdfTexts, imageAnalysis, websiteMarkdown, email) {
368let contextDump = [];
369387}
388389// Helper function to send a request to OpenAI
390async function sendRequestToOpenAI(prompt, transformedPrompt, openaiUrl, apiKey, model) {
391try {
392// Debug logging for the prompt and transformed prompt
439}
440441// Helper function to send a response back via email
442async function sendResponseByEmail(toEmail, responseContent) {
443const subject = "AI Response to Your Email";
444const text = `${responseContent}`;
blob_adminmain.tsx8 matches
13}
1415function Tooltip({ children, content }: TooltipProps) {
16const [isVisible, setIsVisible] = useState(false);
17const tooltipRef = useRef<HTMLDivElement>(null);
52}
5354function formatBytes(bytes: number, decimals = 2) {
55if (bytes === 0) return "0 Bytes";
56const k = 1024;
61}
6263function copyToClipboard(text: string) {
64navigator.clipboard.writeText(text).then(() => {
65console.log("Text copied to clipboard");
69}
7071function ActionMenu({ blob, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
72const [isOpen, setIsOpen] = useState(false);
73const menuRef = useRef(null);
7677useEffect(() => {
78function handleClickOutside(event) {
79if (menuRef.current && !menuRef.current.contains(event.target)) {
80event.stopPropagation();
158}
159160function BlobItem({ blob, onSelect, isSelected, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
161const [isLoading, setIsLoading] = useState(false);
162const decodedKey = decodeURIComponent(blob.key);
219}
220221function App({ initialEmail, initialProfile }) {
222const encodeKey = (key: string) => encodeURIComponent(key);
223const decodeKey = (key: string) => decodeURIComponent(key);
645}
646647function client() {
648const initialEmail = document.getElementById("root").getAttribute("data-email");
649const initialProfile = JSON.parse(document.getElementById("root").getAttribute("data-profile"));
tangibleIvoryCanidaemain.tsx2 matches
2import d3 from "https://esm.sh/d3@7";
34export async function fabw(board) {
5// Import d3 and Plot with a server-side compatible approach
6const { document } = await import("https://esm.sh/linkedom@0.16.1").then((m) =>
52}
5354export default async function(request: Request) {
55try {
56// Check if the request method is POST and has JSON content
bluesky_bot_templatemain.tsx5 matches
6});
78// Helper function to convert data URI to Uint8Array
9function convertDataURIToUint8Array(dataURI: string): Uint8Array {
10const base64Data = dataURI.split(",")[1];
11const binaryString = atob(base64Data);
17}
1819// Helper function to fetch SVG and convert to base64
20async function fetchSVGAsBase64(url: string): Promise<string> {
21const response = await fetch(url);
22if (!response.ok) {
27}
2829export default async function(interval: Interval) {
30// Don't forget to set these environment variables in the val's settings.
31const username = process.env.BLUESKY_USERNAME;
vividCopperWrenmain.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">
reverentAquaCuckoomain.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">