Search

Results include substring matches and semantically similar vals. Learn more
dcm31 avatar
telegramWebhookEchoMessageOLD
@dcm31
// v15 was the last stable version
HTTP
import { OpenAI } from "https://esm.town/v/std/openai";
const openai = new OpenAI();
async function handleMessage(message) {
async function processUserInputWithAI(userMessage: string, tasks: Task[], state: UserState): Promise<{ response: string, upda
You can use the following functions:
const completion = await openai.chat.completions.create({
function addTask(tasks: Task[], title: string) {
function markTaskAsDone(tasks: Task[], taskId: string) {
function breakDownTask(tasks: Task[], taskId: string, subtasks: string[]) {
function findTask(tasks: Task[], taskId: string): Task | null {
ejfox avatar
githubactivitysummarizer
@ejfox
GitHub Activity Summarizer This val.town script fetches a user's recent GitHub activity and generates a summarized narrative overview using OpenAI's GPT model. Features Retrieves GitHub activity for a specified user from the past week Summarizes activity using OpenAI's GPT-3.5-turbo model Returns a concise, narrative summary of the user's GitHub contributions Usage Access the script via HTTP GET request: https://https://ejfox-githubactivitysummarizer.web.val.run/?username=<github_username> Replace <github_username> with the desired GitHub username like https://https://ejfox-githubactivitysummarizer.web.val.run/?username=ejfox in the past week Note Ensure you have necessary permissions and comply with GitHub's and OpenAI's terms of service when using this script.
HTTP
s recent GitHub activity and generates a summarized narrative overview using OpenAI's GPT model.
- Summarizes activity using OpenAI's GPT-3.5-turbo model
Ensure you have necessary permissions and comply with GitHub's and OpenAI's terms of service when using this script.
// sends it to OpenAI for analysis, and returns collaboration suggestions.
// and the OpenAI API (which does require an API key).
import { OpenAI } from "https://esm.town/v/std/openai";
const OPENAI_API_KEY = "your_openai_api_key"; // Replace with your actual OpenAI API key
export default async function main(req: Request): Promise<Response> {
async function fetchUserActivity(username: string) {
function summarizeActivity(data: any[]) {
const openai = new OpenAI(OPENAI_API_KEY);
const completion = await openai.chat.completions.create({
artem avatar
telegramAudioMessageTranscription
@artem
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
import React, { DragEvent, useRef, useState } from "https://esm.sh/react@18.2.0";
function App() {
const [transcription, setTranscription] = useState<string>("");
margin: "0 4px",
OPENAI_API_KEY
</code>
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
if (request.method === "POST" && new URL(request.url).pathname === "/transcribe") {
return new Response("No file uploaded", { status: 400 });
const { OpenAI } = await import("npm:openai");
const openai = new OpenAI({ apiKey: Deno.env.get("OPENAI_API_KEY") });
const arrayBuffer = await audioFile.arrayBuffer();
const transcription = await openai.audio.transcriptions.create({
file: new File([arrayBuffer], audioFile.name, { type: audioFile.type }),
zzz avatar
demoOpenAIGPT4Summary
@zzz
An interactive, runnable TypeScript val by zzz
Script
import { confession } from "https://esm.town/v/alp/confession?v=2";
import { runVal } from "https://esm.town/v/std/runVal";
export let demoOpenAIGPT4Summary = await runVal(
"zzz.OpenAISummary",
confession,
stevekrouse avatar
hootsuiteNasa
@stevekrouse
This uses the now-deprecated express handler. Comment on this val if you'd like me to update it. Or send me a PR :)
Script
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
export async function hootsuiteNasa(req: express.Request, res: express.Response) {
const NASA_ROOT = "https://images-api.nasa.gov";
const alphaNumericSpaces = new RegExp("^[a-zA-Z0-9\\s-_]+$");
andreterron avatar
generateValCode
@andreterron
An interactive, runnable TypeScript val by andreterron
Script
import { openaiChatCompletion } from "https://esm.town/v/andreterron/openaiChatCompletion";
export const generateValCode = async (
const lodash = await import('npm:lodash');
const response = await openaiChatCompletion({
openaiKey: key,
organization: org,
role: "user",
content: `Here's the description of the function I want to write:
${description}
Please start writing the function now, and just write the function, no console.log required:
const message: string = response.choices[0].message.content;
iamseeley avatar
exampleFeatureExtraction
@iamseeley
An interactive, runnable TypeScript val by iamseeley
HTTP
import Pipeline from "https://esm.town/v/iamseeley/pipeline";
export default async function handler(req) {
if (req.method === "GET") {
return new Response(`
CoachCompanion avatar
curiousTurquoiseDormouse
@CoachCompanion
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
function ConfirmationModal({ isOpen, onClose }) {
function App() {
function client() {
async function server(request: Request): Promise<Response> {
const { OpenAI } = await import("https://esm.town/v/std/openai");
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
// Function to insert YouTube links into the training plan
async function getYouTubeVideoId(query, sport, apiKey, useApiKey = true) {
function getFallbackYouTubeLink(query, sport) {
dhvanil avatar
web_Zw1Asa4o7V
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_Zw1Asa4o7V(req) {
return new Response(`<!DOCTYPE html>
<html>
<script>
// Add some paranoid interactivity
document.addEventListener('mousemove', function(e) {
if(Math.random() < 0.01) {
const warning = document.createElement('div');
pomdtr avatar
verifyToken
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
async function fetchUser(token: string): Promise<{ id: string }> {
const resp = await fetch("https://api.val.town/v1/me", {
headers: {
throw new Error("Could not fetch user");
return resp.json();
export async function verifyToken(token: string) {
try {
const [currentUser, requestUser] = await Promise.all([fetchUser(Deno.env.get("valtown")), fetchUser(token)]);
liaolile avatar
weatherGPT
@liaolile
If you fork this, you'll need to set OPENAI_API_KEY in your Val Town Secrets .
Cron
If you fork this, you'll need to set `OPENAI_API_KEY` in your [Val Town Secrets](https://www.val.town/settings/secrets).
import { fetch } from "https://esm.town/v/std/fetch";
import { OpenAI } from "npm:openai";
let location = "shenzhen";
).then(r => r.json());
const openai = new OpenAI();
let chatCompletion = await openai.chat.completions.create({
messages: [{
console.log(text);
export async function weatherGPT() {
const result = await fetch(`https://hello.liaolile.com/test/weather`, {
dhvanil avatar
val_xrAXPiDVNV
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_xrAXPiDVNV(req) {
try {
// Execute the code directly and capture its result
jackbridger avatar
myApi
@jackbridger
An interactive, runnable TypeScript val by jackbridger
Email
export function myApi(name) {
return "hi " + name + " want to come on Scaling DevTools?";
dhvanil avatar
val_4r3qJnBh7d
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_4r3qJnBh7d(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
function probeComputationalLimits(depth = 0, maxDepth = 1000) {
if (depth >= maxDepth) {
return {
wolf avatar
useDynamic
@wolf
This is a test Test
Script
"https://wolf-everything.web.val.run/sortTwoAscendingArrays?id=207849e6-5b45-4d33-9f7e-63ajagaea0c4";
// dynamically generate, cache, and then import the pumpkin ascii art function
// the uuid param ensures that it will cache and always return this specific uuid
// call the dynamically generated function
const result = pumpkinAsciiArtGreetPerson("Wolf");
console.log(result);
// call the other function
const result2 = sortTwoAscendingArrays([1, 2, 3], [4, 5, 6]);