2
3export const buddhaRandomQuote = (async () => {
4 const resp = await fetch("https://buddha-api.com/api/random");
5 const j = await resp.json();
6 const { text, byName } = j;
5export async function annoy() {
6 const resume = resume2;
7 // const boo = await import("https://esm.sh/@atproto/api");
8 const { default: BskyAgent } = await import("npm:@atproto/api");
9 console.log(BskyAgent);
10 const agent = new BskyAgent.BskyAgent({ service: "https://bsky.social" });
50 `;
51 console.log({ prompt });
52 const response = await fetch("https://api.openai.com/v1/completions", {
53 method: "POST",
54 headers: {
55 "Content-Type": "application/json",
56 "Authorization": "Bearer " + process.env.OPENAI_API_KEY, // Replace with your OpenAI API Key
57 },
58 body: JSON.stringify({
3export function alias<P extends Params>(params: P): Promise<Result<P>> {
4 const username = params.username;
5 let url = `https://api.val.town/v1/alias/${username}`;
6 if ("valName" in params)
7 url = url + `/${params.valName}`;
6 }
7 const [author, name] = val.split(".");
8 const resp = await fetch(`https://api.val.town/v1/alias/${author}/${name}`);
9 if (resp.status !== 200) {
10 throw new Error(resp.statusText);
1import { chatMessages } from "https://esm.town/v/nimalu/chatMessages";
2
3// https://api.val.town/express/@nimalu.chat
4export const chat = (req, res) => {
5 const messages = chatMessages
24 document.getElementById("message-input").value = '';
25 const ul = document.getElementById("inbox");
26 const data = await fetch("https://api.val.town/eval/@nimalu.sendChatMessage('" + message + "','"+ sender + "')")
27 .then(res => res.json())
28 .then(res => res.data)
1export function myApi(name) {
2 return "hi " + name;
3}
3export async function testPostCall() {
4 const result = await fetchJSON(
5 "https://api.val.town/express/@stevekrouse.postWebhook1",
6 {
7 method: "POST",
1import { getExchangeRates } from "https://esm.town/v/mgruel/getExchangeRates";
2
3/** Calls https://www.exchangerate-api.com to retrieve the currency exchange rates
4 * for the provided base currency or "eur" if undefined
5 * @param {string} desired - The desired currency convert to
9 };
10};
11export const pageApi = async <T extends any = any>(
12 url: string,
13 { offset = 0, limit = 25 }: {
3
4export const pipeSampleLLMTool = (async () => {
5 const { SerpAPI } = await import("npm:langchain/tools");
6 const { PromptTemplate } = await import("npm:langchain/prompts");
7 const { StringOutputParser } = await import(
8 "npm:langchain/schema/output_parser"
9 );
10 const search = new SerpAPI(process.env.SERPAPI_KEY);
11 const prompt = PromptTemplate.fromTemplate(
12 `Turn the following user input into a search query for a search engine: