OpenTownieNormalindex.ts1 match
20export const thinkTool = tool({
21description:
22"Use the tool to think about something. It will not obtain new information or change the database, but just append the thought to the log. Use it when complex reasoning or some cache memory is needed.",
23parameters: z.object({
24thought: z.string().describe("A thought to think about."),
cerebras_coderindex2 matches
1import { generateCode } from "./backend/generate-code";
2import { createTables } from "./database/migrations";
3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
45async function servePublicFile(path: string): Promise<Response> {
MiniAppStarterREADME.md1 match
9- The **client-side entrypoint** is `/frontend/index.html`, which in turn imports `/frontend/index.tsx`, which in turn imports the React app from `/frontend/App.tsx`.
1011[React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a fuller featured example project, with a SQLite database table, queries, client-side CSS and a favicon, and some shared code that runs on both client and server.
SchoolListingWebsitemain.tsx1 match
531const imageUrl = `/blob/${imageKey}`;
532533// Insert school into database
534await sqlite.execute(`
535INSERT INTO ${KEY}_schools
openTownieMadeThis1README.md1 match
6061- Add proper authentication
62- Implement a real database for hotel and offer data
63- Use a more robust date picker library
64- Add form validation
242};
243244// In a real app, this would be a server-side database operation
245setStories(prev => [storyToSubmit, ...prev]);
246
128`);
129} catch (error) {
130console.error("Database initialization error:", error);
131}
132
EchoPromptermain.tsx8 matches
942const openai = new OpenAI();
943944// Use the val's URL as a unique key for database tables
945const KEY = "EchoPrompter";
946947// Initialize database tables
948await sqlite.execute(`
949CREATE TABLE IF NOT EXISTS ${KEY}_agents (
978});
979} catch (error) {
980console.error("Database error:", error);
981return new Response(
982JSON.stringify({ error: "Failed to fetch recent agents" }),
1175}
11761177// Insert into database with commands
1178const result = await sqlite.execute(
1179`INSERT INTO ${KEY}_agents (name, description, prompt, commands) VALUES (?, ?, ?, ?)`,
1215const { agentId, message, history } = await request.json();
12161217// Get agent from database
1218const agentResult = await sqlite.execute(
1219`SELECT * FROM ${KEY}_agents WHERE id = ?`,
1265const response = completion.choices[0].message.content;
12661267// Log conversation in database
1268await sqlite.execute(
1269`INSERT INTO ${KEY}_conversations (agent_id, user_message, assistant_response) VALUES (?, ?, ?)`,
1294const { agentId, command, inputs, history } = await request.json();
12951296// Get agent from database
1297const agentResult = await sqlite.execute(
1298`SELECT * FROM ${KEY}_agents WHERE id = ?`,
1478}
14791480async function initDatabase(db) {
1481// Create agents table if not exists
1482await db.execute(`
MiniAppStarterREADME.md1 match
9- The **client-side entrypoint** is `/frontend/index.html`, which in turn imports `/frontend/index.tsx`, which in turn imports the React app from `/frontend/App.tsx`.
1011[React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a fuller featured example project, with a SQLite database table, queries, client-side CSS and a favicon, and some shared code that runs on both client and server.
openTownieMadeThis4README.md1 match
9- The **client-side entrypoint** is `/frontend/index.html`, which in turn imports `/frontend/index.tsx`, which in turn imports the React app from `/frontend/components/App.tsx`.
1011[React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a fuller featured example project, with a SQLite database table, queries, client-side CSS and a favicon, and some shared code that runs on both client and server.