cerebras_coderindex.html1 match
19<meta property="og:site_name" content="Cerebras Coder">
20<meta property="og:url" content="https://cerebrascoder.com"/>
21<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."">
22<meta property="og:type" content="website">
23<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
cerebras_codergenerate-code.ts2 matches
2import STARTER_PROMPTS from "../public/starter-prompts.js";
34function extractCodeFromFence(text: string): string {
5const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
6return htmlMatch ? htmlMatch[1].trim() : text;
7}
89export async function generateCode(prompt: string, currentCode: string) {
10const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
11if (starterPrompt) {
plantprofilePlantDetail.tsx1 match
21};
2223// Function to print the plant profile
24const handlePrint = () => {
25const printContent = document.getElementById('plant-profile-content');
plantprofilequeries.ts5 matches
45// Create a new plant profile
6export async function createPlantProfile(plant: Omit<PlantProfile, "id" | "created_at" | "updated_at">): Promise<PlantProfile> {
7const result = await sqlite.execute(
8`INSERT INTO ${PLANTS_TABLE} (
2627// Get all plant profiles
28export async function getAllPlantProfiles(): Promise<PlantProfile[]> {
29const result = await sqlite.execute(`SELECT * FROM ${PLANTS_TABLE} ORDER BY name ASC`);
30return result.rows as PlantProfile[];
3233// Get a plant profile by ID
34export async function getPlantProfileById(id: number): Promise<PlantProfile | null> {
35const result = await sqlite.execute(
36`SELECT * FROM ${PLANTS_TABLE} WHERE id = ?`,
4647// Update a plant profile
48export async function updatePlantProfile(
49id: number,
50plant: Partial<Omit<PlantProfile, "id" | "created_at" | "updated_at">>
118119// Delete a plant profile
120export async function deletePlantProfile(id: number): Promise<boolean> {
121const result = await sqlite.execute(
122`DELETE FROM ${PLANTS_TABLE} WHERE id = ?`,
plantprofilemigrations.ts1 match
4export const PLANTS_TABLE = "plant_profiles_v1";
56export async function setupDatabase() {
7// Create the plants table if it doesn't exist
8await sqlite.execute(`
1export default async function (e: Email) {
2
3}
FirstProjectqueries.ts4 matches
2021// Job posting queries
22export async function getAllJobPostings(): Promise<JobPosting[]> {
23const result = await sqlite.execute(
24`SELECT * FROM ${JOB_POSTINGS_TABLE} ORDER BY created_at DESC`
27}
2829export async function createJobPosting(job: JobPosting): Promise<JobPosting> {
30const timestamp = Date.now();
31const result = await sqlite.execute(
3940// Chat message queries
41export async function getChatMessages(limit = 50): Promise<ChatMessage[]> {
42const result = await sqlite.execute(
43`SELECT * FROM ${CHAT_MESSAGES_TABLE}
49}
5051export async function createChatMessage(message: ChatMessage): Promise<ChatMessage> {
52const timestamp = Date.now();
53const result = await sqlite.execute(
FirstProjectmigrations.ts1 match
8* Initialize database tables
9*/
10export async function initializeDatabase() {
11// Create job postings table
12await sqlite.execute(`
FirstProjectREADME.md1 match
19โ โโโ database/
20โ โ โโโ migrations.ts # Schema definitions
21โ โ โโโ queries.ts # DB query functions
22โ โโโ routes/
23โ โ โโโ jobs.ts # Job posting routes
JobPlatformapp.js16 matches
21init();
2223async function init() {
24// Set view source link
25setViewSourceLink();
41}
4243function setViewSourceLink() {
44// Get the current URL and convert it to Val Town URL
45const currentUrl = window.location.href;
4950// Event Listeners
51function setupEventListeners() {
52// Job form submission
53jobForm.addEventListener('submit', async (e) => {
82}
8384// Job Functions
85async function loadJobs() {
86try {
87const response = await fetch('/api/jobs');
111}
112113async function submitJobPosting() {
114try {
115const formData = {
148}
149150// Chat Functions
151function enableChat() {
152usernameContainer.innerHTML = `<p class="text-sm text-gray-600">Chatting as: <span class="font-semibold">${escapeHtml(username)}</span> <button id="change-username" class="text-blue-600 text-xs hover:underline">Change</button></p>`;
153
185}
186187async function loadChatMessages() {
188try {
189const response = await fetch('/api/chat');
210}
211212function renderChatMessages(messages) {
213chatMessages.innerHTML = messages.map(msg => `
214<div class="chat-message ${msg.username === username ? 'text-right' : ''}">
225}
226227function startChatPolling() {
228// Clear any existing interval
229if (chatPollingInterval) {
273}
274275async function sendChatMessage() {
276const message = chatInput.value.trim();
277if (!message || !username) return;
306}
307308// Utility Functions
309function formatDate(timestamp) {
310if (!timestamp) return 'Unknown';
311
318}
319320function formatTime(timestamp) {
321if (!timestamp) return '';
322
328}
329330function escapeHtml(str) {
331if (!str) return '';
332return str