1# VALL-E
2
3LLM code generation for vals! Make apps with a frontend, backend, and database.
4
5It's a bit of work to get this running, but it's worth it.
32 };
33
34 const clearDatabase = async () => {
35 await fetch('/clear-database', { method: 'POST' });
36 setProfiles([]);
37 setCurrentIndex(0);
38 setMessage('Database cleared');
39 };
40
118 <div className="admin-section">
119 <h2>Admin Controls</h2>
120 <button onClick={clearDatabase}>Clear Database</button>
121 <form onSubmit={addNewProfile}>
122 <h3>Add New Profile</h3>
182 await sqlite.execute(`DELETE FROM ${KEY}_profiles_${SCHEMA_VERSION} WHERE id = ?`, [id]);
183 } else {
184 // For right swipes, we don't need to do anything as the profile stays in the database
185 // You could add additional logic here if needed, e.g., to mark the profile as "liked"
186 }
207 }
208
209 if (url.pathname === '/clear-database' && request.method === 'POST') {
210 await sqlite.execute(`DELETE FROM ${KEY}_profiles_${SCHEMA_VERSION}`);
211 return new Response('Database cleared');
212 }
213
5/**
6 * Every Val Town account comes with its own private
7 * [SQLite database](https://www.sqlite.org/) that
8 * is accessible from any of your vals.
9 * ([Docs ↗](https://docs.val.town/std/sqlite))
115
116// adapted from
117// https://github.com/tursodatabase/libsql-client-ts/blob/17dd996b840c950dd22b871adfe4ba0eb4a5ead3/packages/libsql-client/src/sqlite3.ts#L314C1-L337C2
118function rowFromSql(
119 sqlRow: Array<unknown>,
125 const imageUrl = `https://maxm-imggenurl.web.val.run/${encodeURIComponent(prompt)}`;
126
127 // Store the generated image in the database
128 await sqlite.execute(`
129 INSERT INTO ${KEY}_images (imageUrl, prompt) VALUES (?, ?)
3import { jsxRenderer } from "npm:hono/jsx-renderer";
4
5// Simulated database
6let contact = {
7 id: 1,
1# VALL-E-DRAW
2
3LLM code generation for vals, on a canvas! Make apps with a frontend, backend, and database.
4
5* First you need a working version of VALL-E. Follow the steps [here](https://www.val.town/v/janpaul123/VALLE).
1# VALL-E
2
3LLM code generation for vals! Make apps with a frontend, backend, and database.
4
5It's a bit of work to get this running, but it's worth it.
1# VALL-E
2
3LLM code generation for vals! Make apps with a frontend, backend, and database.
4
5It's a bit of work to get this running, but it's worth it.
1# VALL-E-DRAW
2
3LLM code generation for vals, on a canvas! Make apps with a frontend, backend, and database.
4
5* First you need a working version of VALL-E. Follow the steps [here](https://www.val.town/v/janpaul123/VALLE).
5/**
6 * Every Val Town account comes with its own private
7 * [SQLite database](https://www.sqlite.org/) that
8 * is accessible from any of your vals.
9 * ([Docs ↗](https://docs.val.town/std/sqlite))
115
116// adapted from
117// https://github.com/tursodatabase/libsql-client-ts/blob/17dd996b840c950dd22b871adfe4ba0eb4a5ead3/packages/libsql-client/src/sqlite3.ts#L314C1-L337C2
118function rowFromSql(
119 sqlRow: Array<unknown>,