debugValEmbeddingsmain.tsx1 match
29import { email } from "https://esm.town/v/std/email?v=12";
3031export default async function(interval: Interval) {
32const dynamiclandWebsiteHash = await blob.getJSON("dynamiclandWebsiteHash");
33const newHash = await getHashForUrl("https://dynamicland.org/");
gameIdeaApimain.tsx3 matches
90const ideasKey = "game-ideas";
9192async function getIdeas(): Promise<Idea[]> {
93let ideas = await blob.getJSON(ideasKey) as Idea[];
94if (ideas == null) ideas = [];
96}
9798async function setIdeas(ideas: Idea[]): Promise<void> {
99await blob.setJSON(ideasKey, ideas);
100}
101102function getRandomElement<T>(array: T[]): T {
103const randomIndex = Math.floor(Math.random() * array.length);
104return array[randomIndex];
extractHttpEndpointmain.tsx1 match
1export function extractHttpEndpoint(url: string | URL) {
2const { pathname } = new URL(url);
3const [author, filename] = pathname.split("/").slice(-2);
formatResumemain.tsx3 matches
1export function formatResume(resumeDetails) {
2function applyFormatting(text) {
3if (typeof text === 'string') {
4return text
9}
1011function preprocessResumeDetails(details) {
12if (Array.isArray(details)) {
13return details.map(item => preprocessResumeDetails(item));
8import OpenAI from "npm:openai";
910export default async function semanticSearchPublicVals(query) {
11const allValsBlobEmbeddingsMeta = (await blob.getJSON("allValsBlobEmbeddingsMeta")) ?? {};
12const allBatchDataIndexes = _.uniq(Object.values(allValsBlobEmbeddingsMeta).map(item => item.batchDataIndex));
Title_Extractormain.tsx4 matches
2import { fetch } from "https://esm.town/v/std/fetch";
34// Helper function to retrieve CSRF token if needed
5async function getCsrfToken(url, cookies) {
6try {
7console.log("Fetching CSRF Token from URL:", url);
36}
3738// Function to fetch HTML content and extract titles
39async function titleExtractor(url, cookies, csrfToken) {
40try {
41console.log("Fetching URL:", url);
indexValsTursomain.tsx2 matches
6import { truncateMessage } from "npm:openai-tokens";
78export default async function(interval: Interval) {
9const sqlite = createClient({
10url: "libsql://valsembeddings-jpvaltown.turso.io",
23);
2425function idForVal(val: any): string {
26return `${val.author_username}!!${val.name}!!${val.version}`;
27}
bloomingButtonmain.tsx7 matches
1let active = false;
23function getRandomEmoji() {
4const emojis = ["๐ณ", "๐ณ", "๐ฒ", "๐ฟ", "๐ฑ", "๐พ", "๐", "๐", "๐", "๐ท", "๐ชป", "๐"];
5const randomIndex = Math.floor(Math.random() * emojis.length);
7}
89function injectCSS(css: string) {
10const style = document.createElement("style");
11style.type = "text/css";
33const buttonBackgroundMap = new Map();
3435// Function to create or get the background div
36function getBackgroundDiv(button) {
37if (!buttonBackgroundMap.has(button)) {
38const newDiv = document.createElement("div");
49}
5051// Function to position the background div behind the button
52function positionDivBehindButton(button) {
53const rect = button.getBoundingClientRect();
54const newDiv = getBackgroundDiv(button);
63window.addEventListener("scroll", () => positionDivBehindButton(button));
6465button.addEventListener("click", function() {
66if (active) return;
67active = true;
18const resp = await fetch("https://maxm-wasmblobhost.web.val.run/jpxqvyy5tphiwehzklmioklpkpz4gpzs.wasm");
19const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));
20export default async function(req: Request): Promise<Response> {
21return handler(req);
22}
gptApiFrameworkmain.tsx9 matches
7980/**
81* An optional function that returns the policy to be used available at `/privacypolicy`.
82*/
83policyGetter?: (() => string) | (() => Promise<string>);
89* @returns The generated JSON schema.
90*/
91function getSchemaDesc(schema: z.Schema | null) {
92if (!schema) return null;
93return zodToJsonSchema(schema, {
140* @returns The paths of the OpenAPI spec.
141*/
142function getPathsDesc(endpoints: EndpointDefinition[]): Paths {
143const paths: Paths = {};
144for (const endpoint of endpoints) {
186* @returns The OpenAPI spec.
187*/
188function getOpenApiSpec(
189url: string,
190title: string,
258* only a status code.
259* @param endpointDef Definition of the endpoint.
260* @param handler Function that handles the request.
261*/
262jsonToNothing<TRequestSchema extends z.Schema>(
290* returns a specific JSON response.
291* @param endpointDef Definition of the endpoint.
292* @param handler Function that handles the request.
293*/
294nothingToJson<TResponseSchema extends z.Schema>(
320* returns a specific JSON response.
321* @param endpointDef Definition of the endpoint.
322* @param handler Function that handles the request.
323*/
324jsonToJson<TRequestSchema extends z.Schema, TResponseSchema extends z.Schema>(
356* Regusters a handler for a verb + path combo.
357* @param endpointDef Definition of the endpoint.
358* @param handler Function that handles the request.
359*/
360private registerHandler(
388389/**
390* Returns a function that can be used to serve the API.
391*
392* @example ValTown usage: