Files
batch-prompts/prompts/src/index.ts
2026-01-10 00:59:25 +08:00

20 lines
844 B
TypeScript

import { PromptGenerator, type PromptGeneratorOptions } from "./module/prompt-geneator.ts";
import { writeFile } from "node:fs/promises";
import { Prompt } from "./module/prompt-perfect.ts";
import { customAlphabet } from "nanoid";
const letter = 'abcdefghijklmnopqrstuvwxyz'
const randomString = customAlphabet(letter, 16);
async function saveToFile(data: Map<string, string>, outputPath: string): Promise<void> {
const arrayData = Array.from(data.entries()).map(([key, value]) => ({ key, value, id: randomString() }));
await writeFile(outputPath, JSON.stringify(arrayData, null, 2), "utf-8");
console.log(`Generated ${arrayData.length} prompts and saved to ${outputPath}`);
}
import './routes/index.ts';
export * from './app.ts';
// list all routes and import
export { PromptGenerator, PromptGeneratorOptions, saveToFile, Prompt };