Versions

  • v110

    8/3/2024
    Open: Version
    Changes from v109 to v110
    +1
    -1
    ⦚ 14 unchanged lines ⦚
    } as const;

    type ApiResult = { ok: boolean; data: string[] } | { ok: false; err: unknown };
    async function generate(opt: keyof typeof opts): Promise<ApiResult> {
    try {
    ⦚ 19 unchanged lines ⦚
    ⦚ 14 unchanged lines ⦚
    } as const;

    type ApiResult = { ok: true; data: string[] } | { ok: false; err: unknown };
    async function generate(opt: keyof typeof opts): Promise<ApiResult> {
    try {
    ⦚ 19 unchanged lines ⦚
  • v109

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

    8/3/2024
    Open: Version
    Changes from v107 to v108
    +1
    -1
    ⦚ 15 unchanged lines ⦚

    type ApiResult = { ok: boolean; data: string[] } | { ok: false; err: unknown };
    async function generate(opt: keyof typeof opts): ApiResult {
    try {
    const msg = baseMsg(opts[opt]);
    ⦚ 18 unchanged lines ⦚
    ⦚ 15 unchanged lines ⦚

    type ApiResult = { ok: boolean; data: string[] } | { ok: false; err: unknown };
    async function generate(opt: keyof typeof opts): Promise<ApiResult> {
    try {
    const msg = baseMsg(opts[opt]);
    ⦚ 18 unchanged lines ⦚
  • v107

    8/3/2024
    Open: Version
    Changes from v106 to v107
    +2
    -2
    ⦚ 14 unchanged lines ⦚
    } as const;

    type Response = { ok: boolean; data: string[] } | { ok: false; err: unknown };
    async function generate(opt: keyof typeof opts) {
    try {
    const msg = baseMsg(opts[opt]);
    ⦚ 18 unchanged lines ⦚
    ⦚ 14 unchanged lines ⦚
    } as const;

    type ApiResult = { ok: boolean; data: string[] } | { ok: false; err: unknown };
    async function generate(opt: keyof typeof opts): ApiResult {
    try {
    const msg = baseMsg(opts[opt]);
    ⦚ 18 unchanged lines ⦚
  • v106

    8/3/2024
    Open: Version
    Changes from v105 to v106
    +1
    -0
    ⦚ 14 unchanged lines ⦚
    } as const;

    async function generate(opt: keyof typeof opts) {
    try {
    ⦚ 19 unchanged lines ⦚
    ⦚ 14 unchanged lines ⦚
    } as const;

    type Response = { ok: boolean; data: string[] } | { ok: false; err: unknown };
    async function generate(opt: keyof typeof opts) {
    try {
    ⦚ 19 unchanged lines ⦚
  • v105

    8/3/2024
    Open: Version
    Changes from v104 to v105
    +2
    -2
    ⦚ 24 unchanged lines ⦚

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

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

    8/3/2024
    Open: Version
    Changes from v103 to v104
    +2
    -2
    ⦚ 24 unchanged lines ⦚

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

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

    8/3/2024
    Open: Version
    Changes from v102 to v103
    +1
    -0
    ⦚ 24 unchanged lines ⦚

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

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

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

    import { askAI } from "https://esm.town/v/DFB/askAI";

    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);

    const sep = "```"; // Should be THREE backticks
    const start = res.indexOf(sep);
    const end = res.lastIndexOf(sep);

    const data = res.substring(start, end).split("\n").slice(1, -1);
    } catch (err) {
    return { ok: false, err };
    }
    }

    export default async function(req: Request): Promise<Response> {
    const res = await generate("slug");

    return Response.json(res);
    }
dfb-funidorpassword.web.val.run
Updated: August 12, 2024