Search

Results include substring matches and semantically similar vals. Learn more
tmcw avatar
azureCheetah
@tmcw
The actual code for VALL-E: https://www.val.town/v/janpaul123/VALLE
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import valleGetValsContextWindow from "https://esm.town/v/janpaul123/valleGetValsContextWindow";
import _ from "npm:lodash@4";
import { renderToString } from "npm:react-dom/server";
export default function(
const systemprompt = `All the above are example conversations and context you can refer to, but don't
consider it part of the current conversation. The conversation below is your recent interaction with the user.
Your entire response should only be TypeScript.
tionis avatar
lastlogin
@tionis
Lastlogin Authentication for val.town Live demo: https://stevekrouse-lastlogin_demo.web.val.run/ Source: @stevekrouse/lastlogin_demo Usage Wrap your http handlers in a lastlogin middleware (sessions will be persisted in the lastlogin_session table on your sqlite account). /** @jsxImportSource npm:hono@3/jsx */ import { lastlogin } from "https://esm.town/v/stevekrouse/lastlogin?v=5"; import { Hono } from "npm:hono"; const app = new Hono(); app.get("/", (c) => { const email = c.req.header("X-LastLogin-Email"); if (email) { return c.html( <div> <h1>Welcome, {email}!</h1> <a href="/auth/logout">Logout</a> </div> ); } else { return c.html( <div> <h1>Welcome to the App</h1> <p>Please sign in to continue.</p> <a href="/auth/login">Sign In</a> </div> ); } }); export default lastlogin(app.fetch);
Script
const url = new URL(req.url);
const clientID = `${url.protocol}//${url.host}/`;
const redirectUri = `${url.protocol}//${url.host}/auth/callback`;
const tokenUrl = new URL("https://lastlogin.io/token");
tokenUrl.searchParams.set("client_id", clientID);
tokenUrl.searchParams.set("code", code);
const authUrl = new URL("https://lastlogin.io/auth");
authUrl.searchParams.set("client_id", clientID);
authUrl.searchParams.set("redirect_uri", redirectUri);
tdecelle avatar
linkInBioTemplate
@tdecelle
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "npm:react-dom/server";
export default async function(req: Request) {
return new Response(
yawnxyz avatar
honoAlpineExample
@yawnxyz
// Endpoint to catch and log the submitted name
HTTP (deprecated)
<head>
<meta charset="UTF-8">
<title>Reactive Form with Alpine.js</title>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<script defer src="https://unpkg.com/htmx.org"></script>
xuybin avatar
valTownChatGPT
@xuybin
ChatGPT Implemented in Val Town Demonstrated how to use assistants and threads with the OpenAI SDK and how to stream the response with Server-Sent Events.
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import OpenAI from "npm:openai";
import { renderToString } from "npm:react-dom/server";
// This uses by personal API key, you'll need to provide your own if
return new Response(renderToString(jsx), { headers: { "Content-Type": "text/html" } });
const clientCode = () => {
document.getElementById("input").addEventListener("submit", async function(event) {
</form>
<script dangerouslySetInnerHTML={{ __html: `(${clientCode.toString()})()` }}>
</script>
stevekrouse avatar
spotify
@stevekrouse
// await sqlite.execute("CREATE TABLE spot (id text primary key, data text)")
HTTP (deprecated)
return c.redirect(
`https://accounts.spotify.com/authorize?response_type=code&client_id=${
encodeURIComponent(Deno.env.get("SPOTIFY_CLIENT_ID"))
}&scope=${encodeURIComponent(scopes)}&redirect_uri=${encodeURIComponent(redirect_uri)}&state=${state}`,
code,
client_id: Deno.env.get("SPOTIFY_CLIENT_ID"),
client_secret: Deno.env.get("SPOTIFY_CLIENT_SECRET"),
redirect_uri,
refresh_token: data.refresh_token,
client_id: Deno.env.get("SPOTIFY_CLIENT_ID"),
client_secret: Deno.env.get("SPOTIFY_CLIENT_SECRET"),
if (refresh.error) return c.json("Refresh error: " + refresh.error);
parkerdavis avatar
sqliteExplorerApp
@parkerdavis
SQLite Explorer View and interact with your Val Town SQLite data. It's based off Steve's excellent SQLite Admin val, adding the ability to run SQLite queries directly in the interface. This new version has a revised UI and that's heavily inspired by LibSQL Studio by invisal . This is now more an SPA, with tables, queries and results showing up on the same page. Install Install the latest stable version (v66) by forking this val: Authentication Login to your SQLite Explorer with password authentication with your Val Town API Token as the password. Todos / Plans [ ] improve error handling [ ] improve table formatting [ ] sticky table headers [ ] add codemirror [ ] add loading indication to the run button (initial version shipped) [ ] add ability to favorite queries [ ] add saving of last query run for a table (started) [ ] add visible output for non-query statements [ ] add schema viewing [ ] add refresh to table list sidebar after CREATE/DROP/ALTER statements [ ] add automatic execution of initial select query on double click [ ] add views to the sidebar [ ] add triggers to sidebar [ ] add upload from SQL, CSV and JSON [ ] add ability to connect to a non-val town Turso database [x] fix wonky sidebar separator height problem (thanks to @stevekrouse) [x] make result tables scrollable [x] add export to CSV, and JSON (CSV and JSON helper functions written in this val . Thanks to @pomdtr for merging the initial version!) [x] add listener for cmd+enter to submit query
HTTP (deprecated)
- [ ] add schema viewing
- [ ] add refresh to table list sidebar after `CREATE/DROP/ALTER` statements
- [ ] add automatic execution of initial select query on double click
- [ ] add views to the sidebar
- [ ] add triggers to sidebar
- [ ] add upload from SQL, CSV and JSON
- [ ] add ability to connect to a non-val town Turso database
- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
- [x] make result tables scrollable
return c.render(
<main class="sidebar-layout">
<div class="sidebar">
<TablesList tables={tables}></TablesList>
<Separator direction="horizontal"></Separator>
<div class="not-sidebar">
<EditorSection />
stevekrouse avatar
blueOwl
@stevekrouse
The actual code for VALL-E: https://www.val.town/v/janpaul123/VALLE
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import valleGetValsContextWindow from "https://esm.town/v/janpaul123/valleGetValsContextWindow";
import _ from "npm:lodash@4";
import { renderToString } from "npm:react-dom/server";
// Set these to your own
const systemprompt = `All the above are example conversations and context you can refer to, but don't
consider it part of the current conversation. The conversation below is your recent interaction with the user.
Your entire response should only be TypeScript.
grubdragon avatar
linkInBioTemplate
@grubdragon
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "npm:react-dom/server";
export default async function(req: Request) {
return new Response(
iamseeley avatar
valTownAnalytics
@iamseeley
Val Town Analytics
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import { DateTime } from "https://cdn.skypack.dev/luxon@2.3.2";
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo?v=27";
import { sqlite } from "https://esm.town/v/std/sqlite?v=6";
import { renderToString } from "npm:react-dom/server";
const { author, name, httpEndpoint } = extractValInfo(import.meta.url);
sqlite.batch([
moe avatar
tailwind
@moe
@jsxImportSource https://esm.sh/preact
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/preact */
import { reactResponse } from "https://esm.town/v/moe/responses"
export default (req: Request) => {
// console.log(qp)
return reactResponse(
<html>
maxm avatar
preactExample
@maxm
@jsxImportSource https://esm.sh/preact
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/preact */
import { render } from "npm:preact-render-to-string";
export const preactExample = () =>
new Response(render(<div>Test {1 + 1}</div>), {
trantion avatar
linkInBioTemplate
@trantion
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "npm:react-dom/server";
export default async function(req: Request) {
return new Response(
tfayyaz avatar
tldrawReactExportScript
@tfayyaz
@jsxImportSource https://esm.sh/react@18.2.0
Script
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import { useState } from "https://esm.sh/react@18.2.0";
import { Tldraw } from "https://esm.sh/tldraw@2.1.0";
export function MyApp() {
willthereader avatar
greenCow
@willthereader
ChatGPT Implemented in Val Town Demonstrated how to use assistants and threads with the OpenAI SDK and how to stream the response with Server-Sent Events
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import OpenAI from "npm:openai";
import { renderToString } from "npm:react-dom/server";
const openai = new OpenAI();
return new Response(renderToString(jsx), { headers: { "Content-Type": "text/html" } });
const clientCode = () => {
document.getElementById("input").addEventListener("submit", function(event) {
</form>
<script dangerouslySetInnerHTML={{ __html: `(${clientCode.toString()})()` }}>
</script>