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).
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
3import { html } from "https://esm.town/v/stevekrouse/html?v=5";
4
5// Initialize SQLite database and comments table if it doesn't exist
6const initDB = async () => {
7 await sqlite.execute(`
57 const text = formData.text;
58
59 // Insert the comment into the database
60 await sqlite.execute("INSERT INTO comments (text) VALUES (?)", [text]);
61
1// This HTTP val creates a comment box where users can submit comments.
2// The comments are stored in a SQLite database and displayed on the page.
3
4import { Hono } from "npm:hono";
6import { html } from "https://esm.town/v/stevekrouse/html?v=5";
7
8// Initialize SQLite database and comments table if it doesn't exist
9const initDB = async () => {
10 await sqlite.execute(`
60 const text = formData.get('text'); // using get method to fetch the value
61
62 // Insert the comment into the database
63 await sqlite.execute("INSERT INTO comments (text) VALUES (?)", [text]); // Correctly passing argument as array element
64
1// Import necessary modules and initialize the Hono app and SQLite database.
2// This script creates a comment box using HTML, handles form submissions to
3// store comments in an SQLite database, and displays all previous comments.
4
5import { Hono } from "npm:hono";
7import { html } from "https://esm.town/v/stevekrouse/html?v=5";
8
9// Initialize the SQLite database and create a comments table if it doesn't exist.
10const initDB = async () => {
11 await sqlite.execute(`
57});
58
59// Handle comment submissions by storing the comment in the SQLite database and redirecting back to the main page.
60app.post("/comment", async context => {
61 const formData = await context.req.parseBody();
62 const text = formData.text;
63
64 // Insert the comment into the database.
65 await sqlite.execute("INSERT INTO comments (text) VALUES (?)", [text]);
66
10import { html } from "https://esm.town/v/stevekrouse/html?v=5";
11
12// Initialize SQLite database and comments table if it doesn't exist
13const initDB = async () => {
14 await sqlite.execute(`
64 const text = formData.get("text"); // Correctly capturing the form data
65
66 // Insert the comment into the database
67 await sqlite.execute("INSERT INTO comments (text) VALUES (?)", [text]);
68
771. Use `await c.req.parseBody()` and ensure that the form data is correctly captured using `formData.get("text")`. This ensures that the `text` field is properly retrieved and passed to the `sqlite.execute` method.
78
79This should resolve the ARGS_INVALID error and properly insert comments into your SQLite database.
3import { html } from "https://esm.town/v/stevekrouse/html?v=5";
4
5// Initialize SQLite database and comments table if it doesn't exist
6const initDB = async () => {
7 await sqlite.execute(`
61 }
62
63 // Insert the comment into the database
64 await sqlite.execute("INSERT INTO comments (text) VALUES (?)", [text]);
65
1/**
2 * This val creates a simple comment box using an HTML form. When a comment is submitted,
3 * it stores the comment in a SQLite database and then displays all the comments.
4 * We use the built-in database functions from Val Town.
5 */
6
7import { sqlite } from "https://esm.town/v/std/sqlite";
8
9// Initialize the database and create the table if it doesn't exist
10await sqlite.execute(`
11 CREATE TABLE IF NOT EXISTS comments (
35 }
36
37 // Fetch all comments from the database
38 const comments = await sqlite.all("SELECT content, created_at FROM comments ORDER BY created_at DESC");
39