update
This commit is contained in:
20
prompts/src/index.ts
Normal file
20
prompts/src/index.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
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 };
|
||||
Reference in New Issue
Block a user