Search

Results include substring matches and semantically similar vals. Learn more
dhvanil avatar
val_sdptufI1Va
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_sdptufI1Va(req) {
try {
// Execute the code directly and capture its result
nbbaier avatar
readmeGPT
@nbbaier
Val Town AI Readme Writer This val provides a class ReadmeWriter for generating readmes for vals with OpenAI. It can both draft readmes and update them directly PRs welcome! See Todos below for some ideas I have. Usage To draft a readme for a given code, use the draftReadme method: import { ReadmeWriter } from "https://esm.town/v/nbbaier/readmeGPT"; const readmeWriter = new ReadmeWriter({}); const val = "https://www.val.town/v/:username/:valname"; const generatedReadme = await readmeWriter.draftReadme(val); To write and update a readme for a given code, use the writeReadme method: import { ReadmeWriter } from "https://esm.town/v/nbbaier/readmeGPT"; const readmeWriter = new ReadmeWriter({}); const val = "https://www.val.town/v/:username/:valname"; const successMessage = await readmeWriter.writeReadme(val); API Reference Class: ReadmeWriter The ReadmeWriter class represents a utility for generating and updating README files. Constructor Creates an instance of the ReadmeWriter class. Parameters: model (optional): The model to be used for generating the readme. Defaults to "gpt-3.5-turbo". apiKey (optional): An OpenAI API key. Defaults to Deno.env.get("OPENAI_API_KEY") . Methods draftReadme(val: string): Promise<string> : Generates a readme for the given val. Parameters: val : URL of the code repository. Returns: A promise that resolves to the generated readme. writeReadme(val: string): Promise<string> : Generates and updates a readme for the given val. Parameters: val : URL of the code repository. Returns: A promise that resolves to a success message if the update is successful. Todos [ ] Additional options to pass to the OpenAI model [ ] Ability to pass more instructions to the prompt to modify how the readme is constructed
Script
his val provides a class `ReadmeWriter` for generating readmes for vals with OpenAI. It can both draft readmes and update the
- `apiKey` (optional): An OpenAI API key. Defaults to `Deno.env.get("OPENAI_API_KEY")`.
- [ ] Additional options to pass to the OpenAI model
import OpenAI, { type ClientOptions } from "npm:openai";
openai: OpenAI;
const { model, ...openaiOptions } = options;
this.openai = new OpenAI(openaiOptions);
private async performOpenAICall(prompt: string) {
const response = await this.openai.chat.completions.create({
throw new Error("No response from OpenAI");
throw new Error("No readme returned by OpenAI. Try again.");
const readme = await this.performOpenAICall(prompt);
robberfree avatar
myApi
@robberfree
An interactive, runnable TypeScript val by robberfree
Script
export function myApi(name) {
return "hi " + name;
dgiulian avatar
myApi
@dgiulian
An interactive, runnable TypeScript val by dgiulian
Script
export function myApi(name) {
return "hi " + name;
lukemeadow avatar
myApi
@lukemeadow
An interactive, runnable TypeScript val by lukemeadow
Script
export function myApi(name) {
return "hi " + name;
horatiothomas avatar
dream_interpreter_journal_dictionary_app
@horatiothomas
An interactive, runnable TypeScript val by horatiothomas
HTTP
export default async function handler(request: Request) {
if (request.method === "GET") {
return new Response(
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.0.3/dist/tailwind.min.css" rel="stylesheet">
<script>
function handleSubmit(event) {
event.preventDefault();
var dreamInput = document.getElementById('dreamInput');
jeffreyyoung avatar
sharedMagentaChameleon
@jeffreyyoung
A simple poe bot
HTTP
server_bot_dependencies: {
"StableDiffusionXL": 1,
function formUI() {
return `<!DOCTYPE html>
<html lang="en">
</div>
<script>
function submitForm() {
const description = document.getElementById('description').value;
const exclude = document.getElementById('exclude').value;
nbbaier avatar
createVal
@nbbaier
An interactive, runnable TypeScript val by nbbaier
Script
privacy?: "public" | "unlisted" | "private"; // Added privacy option
type?: "http" | "script" | "email";
export function createVal({ token, code, name, readme, privacy, type }: CreateValArgs): Promise<ValResponse> {
const body: Record<string, unknown> = {
code,
dhvanil avatar
val_282e3mL94A
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_282e3mL94A(req) {
try {
// Execute the code directly and capture its result
loganwoolf avatar
myApi
@loganwoolf
An interactive, runnable TypeScript val by loganwoolf
Script
export function myApi(name) {
return "hi " + name;
stevekrouse avatar
open_in_valtown
@stevekrouse
* @param handler Fetch handler
Script
import { parentReference } from "https://esm.town/v/stevekrouse/parentReference";
* @param handler Fetch handler
export default function openInValTown(
handler: (req: Request) => Promise<Response>,
): (req: Request) => Promise<Response> {
stevekrouse avatar
emojiSearchBot
@stevekrouse
Emoji search bot Replies to mentions on twitter with the emojis your photo evokes. Inspired by Devon Zuegel .
Cron
import process from "node:process";
import OpenAI from "npm:openai";
const openai = new OpenAI({ apiKey: process.env.openai });
export async function emojiSearchBot({ lastRunAt }: Interval) {
const token = await refreshEmojiSearchToken();
if (attachment.type !== "photo") return;
const response = await openai.chat.completions.create({
model: "gpt-4-vision-preview",
zbeastly1 avatar
hello
@zbeastly1
An interactive, runnable TypeScript val by zbeastly1
Script
export let hello = async function () {
return "hello val town, what am I to do?";
dhvanil avatar
val_utzBgjC7IS
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_utzBgjC7IS(req) {
try {
// Execute the code directly and capture its result
jamisonl avatar
aloneBronzeCattle
@jamisonl
Bot for Cama discord server. To initialize new slash commands, you have to run a separate bit of code. This is for modifying their functionality
HTTP
mmands, you have to run a separate bit of code. This is for modifying their functionality
const rest = new REST({ version: "9" }).setToken(process.env.DISCORD_BOT_TOKEN);
async function findUserVoiceChannel(guildId, userId) {
try {
return null;
async function sayMessage(guildId, channelId, message) {
const url = googleTTS.getAudioUrl(message, {
resolve();
function createDiscordJSAdapter(channelId, guildId) {
return {
req.headers.get("X-Signature-Timestamp"),
// Get the user calling this slash command
const userId = await body.member?.user?.id;
…
58
…
Next