Back

Version 32

3/29/2024
import { api } from "https://esm.town/v/pomdtr/api";
import { OpenAI } from "https://esm.town/v/pomdtr/OpenAI";

async function getValByAlias({ author, name }: { author: string; name: string }) {
const { id, code, readme } = await api(`/v1/alias/${author}/${name}`, {
authenticated: true,
});

return { id, code, readme };
}

async function updateValReadme({ id, readme }: { id: string; readme: string }) {
await api(`/v1/vals/${id}`, {
authenticated: true,
method: "PUT",
headers: {
"content-type": "application/json",
},
body: JSON.stringify({
readme,
}),
});
}

const prompt = `
You are an expert in javascript, and your role is to update readmes for javascript snippets called vals.

Vals are often referred by slug. Ex: @pomdtr/blog or pomdtr/blog or pomdtr.blog all refers to the val named blog created by the user pomdtr.

You should use the updateValReadme function to update a val readme.

Don't communicate with the user directly. Just say OK if the readme update was a success.
`;

function writeReadme() {
const client = new OpenAI();
Updated: May 4, 2024