1export default async function (req: Request): Promise<Response> {
2return Response.json({ ok: true })
3}
githubParsermain.tsx19 matches
182const repoList = document.getElementById('repoList');
183const ignoredPatternsTextarea = document.getElementById('ignoredPatterns');
184async function updateRepoList() {
185const repos = await db.repositories.toArray();
186repoList.innerHTML = repos.map(repo =>
211});
212213function displayRepoData(repo) {
214resultArea.value = repo.content;
215updateStats(repo.content);
217}
218219function updateStats(content) {
220const bytes = new TextEncoder().encode(content).length;
221const kb = bytes / 1024;
227}
228229function updateTokenCounts(tokenCounts) {
230tokenCountCl100k.textContent = tokenCounts.cl100k_base.toLocaleString();
231tokenCountP50k.textContent = tokenCounts.p50k_base.toLocaleString();
234}
235236// Add this new function to parse the patterns
237function parseIgnoredPatterns() {
238return ignoredPatternsTextarea.value
239.split('\\n')
243244245async function fetchFileTypes(repoUrl) {
246const response = await fetch('/file-types', {
247method: 'POST',
257}
258259function displayFileTypeSelector(fileTypes, ignoredPatterns) {
260const fileTypeSelectorDiv = document.getElementById('fileTypeSelector');
261const fileTypeList = document.getElementById('fileTypeList');
528});
529530function getTiktokenSegments(encoder, inputText) {
531try {
532const tokens = encoder.encode(inputText);
566}
567568function getFileExtension(filename) {
569const parts = filename.split('.');
570return parts.length > 1 ? '.' + parts.pop().toLowerCase() : 'no-extension';
572573574function getFileType(path) {
575// Handle directories
576if (path.endsWith('/')) {
587}
588589async function fetchRepositoryContent(owner, repo, specifiedBranch = null, ignoredPatterns, selectedTypes = null) {
590// First, try to get the default branch or use the specified branch
591const repoInfoUrl = `https://api.github.com/repos/${owner}/${repo}`;
661}
662663async function fetchFileContent(owner, repo, path, branch) {
664const apiUrl = `https://api.github.com/repos/${owner}/${repo}/contents/${path}`;
665const response = await fetch(apiUrl, {
678}
679680function getIgnoredPatterns() {
681return [
682// Folders
754}
755756function shouldIgnoreFile(path, ignoredPatterns) {
757// Special case for README.md
758if (path.toLowerCase() === 'readme.md') {
763}
764765async function countTokens(text) {
766const encoders = {
767cl100k_base: get_encoding("cl100k_base"),
780}
781782async function getTokenizedText(text) {
783const encoder = get_encoding("cl100k_base");
784const tokens = encoder.encode(text);
819});
820821// Add new function to get repository file types
822async function getRepositoryFileTypes(owner, repo, specifiedBranch = null) {
823const repoInfoUrl = `https://api.github.com/repos/${owner}/${repo}`;
824const repoInfoResponse = await fetch(repoInfoUrl, {
4import { pdfText } from "jsr:@pdf/pdftext";
56// main controller function
7export default async function(receivedEmail) {
8const apiKey = Deno.env.get("FIREWORKS_API_KEY");
9const model = "accounts/fireworks/models/deepseek-r1";
5354// extract attachments (if any)
55async function extractAttachments(email) {
56if (!email.attachments || email.attachments.length === 0) {
57return [];
69}
7071async function extractPdfText(attachments) {
72const pdfTexts = [];
73102}
103104// helper function to generate a prompt for AI
105function generatePrompt(email, pdfTexts, emailText) {
106const senderName = email.from.split("<")[0].trim().split(" ")[0] || "User";
107const fullSenderName = email.from.split("<")[0].trim() || "User";
131}
132133// helper function to send a request to Fireworks.ai
134async function sendRequestToFireworks(prompt, apiKey, model) {
135try {
136const client = new OpenAI({
165}
166167// helper function to parse the AI response
168function parseAIResponse(response) {
169let parsedResponse = response;
170let thinking = "";
183}
184185// helper function to send a response back via email
186async function sendResponseByEmail(originalEmail, responseContent, thinking) {
187const subject = originalEmail.subject.startsWith("Re:")
188? originalEmail.subject
4import React from "https://esm.sh/react@18.2.0";
56function Sketch() {
7const [p5Loaded, setP5Loaded] = React.useState(false);
838}
3940function client() {
41// Dynamically import React DOM to ensure it's only loaded in the browser
42if (typeof window !== "undefined") {
50}
5152// Only call client function in browser environment
53if (typeof window !== "undefined") { client(); }
5455export default async function server(request: Request) {
56return new Response(
57`
2import hash from "npm:hash-it";
34export async function newUniq(ns: string): Promise<Uniq> {
5let u = new Uniq(ns);
6await u.init();
8};
910function App() {
11const [isPending, startTransition] = useTransition();
12const [likes, setLikes] = useState(0);
43}
4445export default async function server(request: Request): Promise<Response> {
46const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
47const KEY = "app";
1export default async function (req: Request): Promise<Response> {
2return Response.json({ ok: true })
3}
1/**** a simple smoke test for val "OpenRouterChatCompletion" ****/
23export default async function (Request:Request):Promise<Response> {
4const OpenAIRequest = {
5messages: [
cerebras_codermain.tsx11 matches
24);
2526function Hero({
27prompt,
28setPrompt,
4546<p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
47Turn your ideas into fully functional apps in{" "}
48<span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
49less than a second
116}
117118function App() {
119const previewRef = React.useRef<HTMLDivElement>(null);
120const [prompt, setPrompt] = useState("");
170});
171172function handleStarterPromptClick(promptItem: typeof prompts[number]) {
173setLoading(true);
174setTimeout(() => handleSubmit(promptItem.prompt), 0);
175}
176177async function handleSubmit(e: React.FormEvent | string) {
178if (typeof e !== "string") {
179e.preventDefault();
226}
227228function handleVersionChange(direction: "back" | "forward") {
229const { currentVersionIndex, versions } = versionHistory;
230if (direction === "back" && currentVersionIndex > 0) {
974);
975976function client() {
977const path = window.location.pathname;
978const root = createRoot(document.getElementById("root")!);
1010}
10111012function extractCodeFromFence(text: string): string {
1013const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1014return htmlMatch ? htmlMatch[1].trim() : text;
1015}
10161017async function generateCode(prompt: string, currentCode: string) {
1018const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1019if (starterPrompt) {
1060}
10611062export default async function cerebras_coder(req: Request): Promise<Response> {
1063// Dynamic import for SQLite to avoid client-side import
1064const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1163<meta property="og:site_name" content="Cerebras Coder">
1164<meta property="og:url" content="https://cerebrascoder.com"/>
1165<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."">
1166<meta property="og:type" content="website">
1167<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1export default async function (req: Request): Promise<Response> {
2return Response.json({ ok: true })
3}