Search

Results include substring matches and semantically similar vals. Learn more
stevekrouse avatar
awesome
@stevekrouse
Awesome Val Town An curated list of useful community vals. Feel free to create your own awesome list! Apps @pomdtr/blob_editor @nbbaier/sqliteExplorerApp View and interact with your Val Town SQLite data. @pomdtr/http_client Attach a postman-like http client to your vals VS Code Extension vt Chrome Extension Tooling Authentication @pomdtr/basicAuth @pomdtr/email_auth @pomdtr/password_auth Sqlite @sqlite/db @pomdtr/sql @pomdtr/kv @postpostscript/sqliteUniverse Blob @stevekrouse/blobAdmin @pomdtr/lowdb Middleware @andreterron/codeOnValTown Testing @pomdtr/test_explorer Api @pomdtr/api @pomdtr/trpc Other @vladimyr/valshot @pomdtr/mdx @pomdtr/serve_readme OpenAI @pomdtr/ask_ai Web Components Val Town Playground CodeMirror
HTTP (deprecated)
- @pomdtr/serve_readme
### OpenAI
- @pomdtr/ask_ai
daniellevine avatar
bedtimeStoryMaker
@daniellevine
Bedtime Story Maker Inspired from a RedwoodJS demo I made last year, this adds generative art powered by Fal to the bedtime story maker. Start writing a story by picking a style (spooky, colorful, adventurous an animal (penguin, mouse, unicorn, whale ...) a color for the animal and activity (befriends aliens, goes to the doctor, rides a rollercoaster, bakes a cake for friends) It uses OpenAI to write a children's bedtime story title summary story for a "fantastical story about a green whale who rides the bus" or the "spooky story about the tomato fox who explores a cave". Then using the summary, OpenAI geenrates another prompt to describe the instructions to generate a children's story book image. That's sent to Fal to generate an image. Stories get saved to bedtime_stories in SQLite for viewing, searching and maybe sharing. You then get a bedtime story to enjoy!
HTTP (deprecated)
* and activity (befriends aliens, goes to the doctor, rides a rollercoaster, bakes a cake for friends)
It uses OpenAI to write a children's bedtime story
* title
for a "fantastical story about a green whale who rides the bus" or the "spooky story about the tomato fox who explores a cave
Then using the summary, OpenAI geenrates another prompt to describe the instructions to generate a children's story book imag
That's sent to Fal to generate an image.
import { ValTownLink } from "https://esm.town/v/dthyresson/viewOnValTownComponent";
import { chat } from "https://esm.town/v/stevekrouse/openai";
import * as fal from "npm:@fal-ai/serverless-client";
ejfox avatar
inventory
@ejfox
* This val creates an interactive tech stack wizard that generates a video game-style inventory screen. * It uses React for the UI, leverages emoji and Unicode symbols for a visually rich experience, and * incorporates Tailwind CSS for elegant, grayscale styling. * The wizard allows users to select tools, libraries, and APIs, then displays them in a shareable format.
HTTP
{ name: "Fly.io", icon: "🪰" },
{ name: "Val.town", icon: "🏘️" },
{ name: "OpenAI", icon: "🧠" },
{ name: "SQLite", icon: "🗃️" },
{ name: "Commander", icon: "🎖️" },
janpaul123 avatar
valle_tmp_605448986086057210791953389018616
@janpaul123
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
import _ from "npm:lodash@4";
import OpenAI from "npm:openai";
import { renderToString } from "npm:react-dom/server";
const contextWindow: any = await valleGetValsContextWindow(model);
const openai = new OpenAI();
const stream = await openai.chat.completions.create({
model,
janpaul123 avatar
valle_tmp_562580635116363837652861654341074
@janpaul123
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
import _ from "npm:lodash@4";
import OpenAI from "npm:openai";
import { renderToString } from "npm:react-dom/server";
const contextWindow: any = await valleGetValsContextWindow(model);
const openai = new OpenAI();
const stream = await openai.chat.completions.create({
model,
ejfox avatar
weeksummary
@ejfox
@jsxImportSource https://esm.sh/react
HTTP
if (url.pathname === "/api/summary") {
const { OpenAI } = await import("https://esm.town/v/std/openai");
const openai = new OpenAI();
const supabaseUrl = Deno.env.get("SUPABASE_PERSONAL_URL");
title: scrap.title ? scrap.title.substring(0, 256) : "",
// Generate summary using OpenAI
try {
).join("\n");
const completion = await openai.chat.completions.create({
messages: [
thomasatflexos avatar
convertTodoItemsToGamePlans
@thomasatflexos
An interactive, runnable TypeScript val by thomasatflexos
Express
redirect: "follow",
let openApiResponse = await fetch(
"https://api.openai.com/v1/chat/completions",
requestOptions,
let jsonResponse = await openApiResponse.json();
stevekrouse avatar
key_safe_link
@stevekrouse
One-click environment variable Copying and pasting secret API keys into your Val Town Environment Variables is annoying and error prone. Wouldn't it be nice if you could add an environment variable in one click? What could such a protocol look like for third-party API company to be able to safely pass their customer's API keys to their customer's Val Town account. A naive approach to this would be a link that looks like this: <a href="https://www.val.town/settings/environment-variables?name=OpenAI&value=sk-123..."> Add OpenAI key to Val Town </a> However it isn't safe to put API key values in URLs like that, but it would be great if we could still put it in the URL so it can act like a simple link. We need to encrypt the API key in such a way that nobody can read it except for the Val Town app. Val Town could provide a public key for API providers to encrypt their tokens with. We could add an extra layer of security by including the timestamp in the request as well as the Val Town username that the token is intended for. All that data should be included in the encrypted package. We can also ensure that each such link is used exactly once. This scheme does feel a bit ad hoc though, so it'd be nice if there existed another protocol for doing this that we could use.
HTTP (deprecated)
A naive approach to this would be a link that looks like this:
<a href="https://www.val.town/settings/environment-variables?name=OpenAI&value=sk-123...">
Add OpenAI key to Val Town
</a>
patrickjm avatar
weatherTomorrowGpt3
@patrickjm
An interactive, runnable TypeScript val by patrickjm
Script
import { gpt3 } from "https://esm.town/v/patrickjm/gpt3";
import { simpleWeather } from "https://esm.town/v/patrickjm/simpleWeather";
export let weatherTomorrowGpt3 = (params: { openAiKey: string, city: string }) =>
simpleWeather(params.city).then((weather) =>
gpt3({
openAiKey: params.openAiKey,
prompt: `
Given a JSON sequence, give a short, plain-English summary about the weather tomorrow.
stevekrouse avatar
telegramBotHandler
@stevekrouse
Telegram to DallE Bot Set up First you'll need to set yourself up to send and receive messages on Telegram. Follow all 5 steps here: https://www.val.town/v/stevekrouse.telegram Fork this @telegramBotHandler val below. Make sure you click Run to save it to your account. On your forked val, click the ⋮ menu > Endpoints > Copy express endpoint Message @ValTownBot /webhook Message @ValTownBot the express endpoint you copied You'll also need an openai key in your secrets for this particular DallE bot to work
HTTP
5. Message @ValTownBot the express endpoint you copied
6. You'll also need an `openai` key in [your secrets](/settings/secrets) for this particular DallE bot to work
try {
let resp = await textToImageDalle(
process.env.openai,
text.replace("/dalle", ""),
1,
cephalization avatar
smsjournalertextrelay
@cephalization
* This val creates a webhook endpoint that receives text messages and sends SMS replies using the TextBelt API. * It uses blob storage to keep track of message history and conversation state. * The TextBelt API is used for sending SMS messages without requiring an API key. * The conversation history is stored as an array of message objects containing sender, content, date, and phone number. * OpenAI's GPT-4 is used to generate contextual responses based on the conversation history.
HTTP (deprecated)
* The conversation history is stored as an array of message objects containing sender, content, date, and phone number.
* OpenAI's GPT-4 is used to generate contextual responses based on the conversation history.
import { blob } from "https://esm.town/v/std/blob";
import { OpenAI } from "https://esm.town/v/std/openai";
import { Buffer } from "node:buffer";
async function generateAIResponse(history: Message[]): Promise<string> {
const openai = new OpenAI();
const messages: { role: "user" | "assistant" | "system"; content: string }[] = history.map(msg => ({
"You are an AI assistant communicating via SMS. Keep your responses concise and under 160 characters. Your task is to h
const completion = await openai.chat.completions.create({
messages,
willthereader avatar
ChatGPTTextDefinitionUserscript
@willthereader
// @name Improved ChatGPT Text Definition
Script
// Configuration
const API_CONFIG = {
url: "https://willthereader-openaidefiner.web.val.run",
method: "POST",
mode: "cors",
nerdymomocat avatar
add_to_habitify_from_todoist_w_ai
@nerdymomocat
// if you added new items to habitify after running this script
Cron
import Jimp from "npm:jimp";
import OpenAI from "npm:openai";
import { z } from "npm:zod";
const HABITIFY_API_KEY = process.env.HABITIFY_API_KEY;
const OPENAI_API_KEY = process.env.OPENAI_API_KEY;
const DEF_TIMEZONE = "America/Los_Angeles"; // Get your timezone from here: https://stackoverflow.com/a/54500197
const todoistapi = new TodoistApi(TODOIST_API_KEY);
const oai = new OpenAI({
apiKey: OPENAI_API_KEY ?? undefined,
const client = Instructor({
jxnblk avatar
IndirectionAPI
@jxnblk
// Test without using this?
Script
const tabooResponse = await fetchOpenAIText(tabooPrompt);
return fetchOpenAIStream(cluePrompt);
async function fetchOpenAIText(content: string): string {
const { OpenAI } = await import("https://esm.town/v/std/openai");
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
export async function fetchOpenAIStream(content: string): Promise<Response> {
const { OpenAI } = await import("https://esm.town/v/std/openai");
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
stevekrouse avatar
cron_client_side_script_fork
@stevekrouse
CronGPT This is a minisite to help you create cron expressions, particularly for crons on Val Town. It was inspired by Cron Prompt , but also does the timezone conversion from wherever you are to UTC (typically the server timezone). Tech Hono for routing ( GET / and POST /compile .) Hono JSX HTML (probably overcomplicates things; should remove) @stevekrouse/openai, which is a light wrapper around @std/openai
HTTP (deprecated)
* HTML (probably overcomplicates things; should remove)
* @stevekrouse/openai, which is a light wrapper around @std/openai
/** @jsxImportSource npm:hono@3/jsx */
import { chat } from "https://esm.town/v/stevekrouse/openai";
import cronstrue from "npm:cronstrue";
import { Hono } from "npm:hono@3";