Versions

  • v94

    8/3/2024
    Open: Version
    Changes from v93 to v94
    +1
    -3
    ⦚ 19 unchanged lines ⦚
    const res = await askAI(msg);

    console.log(res);

    const start = res.indexOf("```");
    const end = res.lastIndexOf("````");

    const data = res.substring(res.indexOf("```"), res.lastIndexOf("```")).split("\n").slice(1, -1);
    return { ok: true, data };
    } catch (err) {
    ⦚ 9 unchanged lines ⦚
    ⦚ 19 unchanged lines ⦚
    const res = await askAI(msg);

    const start = res.indexOf("```");
    const end = res.lastIndexOf("````");

    const data = res.substring(start, end).split("\n").slice(1, -1);
    return { ok: true, data };
    } catch (err) {
    ⦚ 9 unchanged lines ⦚
  • v93

    8/3/2024
    Open: Version
    Changes from v92 to v93
    +0
    -0
    ⦚ 38 unchanged lines ⦚
    ⦚ 38 unchanged lines ⦚
  • v92

    8/3/2024
    Open: Version
    Changes from v91 to v92
    +0
    -0
    ⦚ 38 unchanged lines ⦚
    ⦚ 38 unchanged lines ⦚
  • v91

    8/3/2024
    Open: Version
    Changes from v90 to v91
    +2
    -0
    const baseMsg = (extraInfo = "") => `
    Please generate me a list of 50 unique, memorable strings that I
    ⦚ 34 unchanged lines ⦚
    import { askAI } from "https://esm.town/v/DFB/askAI";

    const baseMsg = (extraInfo = "") => `
    Please generate me a list of 50 unique, memorable strings that I
    ⦚ 34 unchanged lines ⦚
  • v90

    8/3/2024
    Open: Version
    Changes from v89 to v90
    +0
    -18
    import { OpenAI } from "https://deno.land/x/openai@v4.54.0/mod.ts";
    import { z } from "https://deno.land/x/zod/mod.ts";

    const apiKey = Deno.env.get("OPENAI_API_KEY");
    const openai = new OpenAI({ apiKey });
    // const create = openai.chat.completions.create;

    async function askAI(msg: string) {
    const cfg = {
    messages: [{ role: "user", content: msg }],
    model: "gpt-4o-mini",
    max_tokens: 3000,
    } satisfies OpenAI.ChatCompletionCreateParamsNonStreaming;

    const chat = await openai.chat.completions.create(cfg);
    return chat.choices?.[0].message.content;
    }

    const baseMsg = (extraInfo = "") => `
    Please generate me a list of 50 unique, memorable strings that I
    ⦚ 34 unchanged lines ⦚
    const baseMsg = (extraInfo = "") => `
    Please generate me a list of 50 unique, memorable strings that I
    ⦚ 34 unchanged lines ⦚
  • v89

    8/3/2024
    Open: Version
    Changes from v88 to v89
    +2
    -0
    import { OpenAI } from "https://deno.land/x/openai@v4.54.0/mod.ts";

    const apiKey = Deno.env.get("OPENAI_API_KEY");
    ⦚ 45 unchanged lines ⦚
    export default async function(req: Request): Promise<Response> {
    const res = await generate("slug");
    return Response.json(res);
    }
    import { OpenAI } from "https://deno.land/x/openai@v4.54.0/mod.ts";
    import { z } from "https://deno.land/x/zod/mod.ts";

    const apiKey = Deno.env.get("OPENAI_API_KEY");
    ⦚ 45 unchanged lines ⦚
    export default async function(req: Request): Promise<Response> {
    const res = await generate("slug");

    return Response.json(res);
    }
  • v88

    8/3/2024
    Open: Version
    Changes from v87 to v88
    +2
    -2
    ⦚ 47 unchanged lines ⦚

    export default async function(req: Request): Promise<Response> {
    const funResults = await generate("slug");
    return Response.json({ ok: true, data: funResults });
    }
    ⦚ 47 unchanged lines ⦚

    export default async function(req: Request): Promise<Response> {
    const res = await generate("slug");
    return Response.json(res);
    }
  • v87

    8/3/2024
    Open: Version
    Changes from v86 to v87
    +0
    -0
    ⦚ 52 unchanged lines ⦚
    ⦚ 52 unchanged lines ⦚
  • v86

    8/3/2024
    Open: Version
    +52
    -0

    import { OpenAI } from "https://deno.land/x/openai@v4.54.0/mod.ts";

    const apiKey = Deno.env.get("OPENAI_API_KEY");
    const openai = new OpenAI({ apiKey });
    // const create = openai.chat.completions.create;

    async function askAI(msg: string) {
    const cfg = {
    messages: [{ role: "user", content: msg }],
    model: "gpt-4o-mini",
    max_tokens: 3000,
    } satisfies OpenAI.ChatCompletionCreateParamsNonStreaming;

    const chat = await openai.chat.completions.create(cfg);
    return chat.choices?.[0].message.content;
    }

    const baseMsg = (extraInfo = "") => `
    Please generate me a list of 50 unique, memorable strings that I
    could use as simple passwords or for unique IDs. Please use a mix
    of funny words and numbers, but the entries should not be more than
    12 characters in length. ${extraInfo}

    Please separate the values into a marked code block
    so that I can easily parse them. Please dont number them.`;

    const opts = {
    slug: "These values will need to work as slug values, so dont incldue special characters.",
    password: "These values will be used as passwords, so make sure they satisfy reasonable password requirements.",
    } as const;

    async function generate(opt: keyof typeof opts) {
    try {
    const msg = baseMsg(opts[opt]);
    const res = await askAI(msg);

dfb-funidorpassword.web.val.run
Updated: August 12, 2024