function listAllFileUnderDist(
function listAllFileUnderDist() { const distDir = path.join(__dirname, "../dist"); const files = walkdir.sync(distDir, { no_recurse: true }); const index = files.map((f) => { return path.relative(distDir, f); }); fs.writeFileSync(path.join(distDir, "index.json"), JSON.stringify(index, null, 2)); }
// for generated by @GitHubCopilot // sample data: // Prompt: particle effects small breasts, 1 girl, solo // Negative prompt: obese, (ugly:1.3), (duplicate:1.3), (morbid) // Steps: 20, Sampler: Euler a, CFG scale: 7, Seed: 1338233768, Size: 512x512, Model hash: f773383dbc, Model: anything-v4.5-pruned-fp16 export function parseStableDiffusionData(prompt: string): StableDiffusionGenData {
export function parseStableDiffusionData(prompt: string): StableDiffusionGenData { ... }
// 1. split promptMatch by comma // 2. match lora name by regex, lora full name: <lora:japaneseDollLikeness_v10:0.1>, // 3. push lora name to loras array
const loras = promptMatch[1] .split(",") .map((item) => { const match = item.match(/<lora:(.+):.+/); return match ? match[1] : ""; }) .filter((item) => item !== "");
使用注释复制其它语言的代码,如输入 TypeScript,输出语言是 Kotlin
// async checkout(ref: string, startPoint: string): Promise<void> { // const args = ['checkout', '--progress', '--force'] // if (startPoint) { // args.push('-B', ref, startPoint) // } else { // args.push(ref) // } // // await this.execGit(args) // } fun checkout...
fun checkout(ref: String, startPoint: String): Promise<Unit> { val args = mutableListOf("checkout", "--progress", "--force") if (startPoint != null) { args.add("-B") args.add(ref) args.add(startPoint) } else { args.add(ref) } return execGit(args) }
@Test fun `test command manager git branch list`() {
@Test fun `test command manager git branch list`() { val output = gitCommandManager.branchList(false) output.contains("master") shouldBe true val branchList = gitCommandManager.parseBranchList(listOf("refs/heads/master")) branchList.contains("refs/heads/master") shouldBe false branchList.contains("master") shouldBe true }
// convert navList with i18n keys to navList with i18n values // { // "chatgpt-general": "ChatGPT 常用指令", // "chatgpt-prompt-role-play": "ChatGPT 角色扮演", // "chatgpt-generator-cot": "ChatGPT 思维链模式", // "chatgpt-interactive-game": "ChatGPT 交互式游戏", // "chatgpt-samples": "ChatGPT 示例", // "chatgpt": "ChatGPT 聊天室", // "stable-diffusion-examples": "StableDiffusion 示例", // "stable-diffusion-generator": "AI 绘画生成器", // "github-copilot-samples": "GitHub Copilot 示例", // "resources": "学习资料", // } const navList = [ { title: "ChatGPT",
const navList = [ { title: "ChatGPT", children: [ { url: `/chatgpt-general/`, title: dict.all["chatgpt-general"] }, { url: `/chatgpt-prompt-role-play/`, title: dict.all["chatgpt-prompt-role-play"] }, { url: `/chatgpt-generator-cot/`, title: dict.all["chatgpt-generator-cot"] }, { url: `/chatgpt-interactive-game/`, title: dict.all["chatgpt-interactive-game"] }, { url: `/chatgpt-samples/`, title: dict.all["chatgpt-samples"] }, { url: `/chatgpt/`, title: dict.all["chatgpt"] }, ], } ]
// { // "chatgpt-general": "ChatGPT 常用指令", // "chatgpt-prompt-role-play": "ChatGPT 角色扮演", // "chatgpt-generator-cot": "ChatGPT 思维链模式", // "chatgpt-interactive-game": "ChatGPT 交互式游戏", // "chatgpt-samples": "ChatGPT 示例", // "chatgpt": "ChatGPT 聊天室", // "stable-diffusion-examples": "StableDiffusion 示例", // "stable-diffusion-generator": "AI 绘画生成器", // "github-copilot-samples": "GitHub Copilot 示例", // "resources": "学习资料", // } // translate to English
// { // "chatgpt-general": "ChatGPT General", // "chatgpt-prompt-role-play": "ChatGPT Role Play", // "chatgpt-generator-cot": "ChatGPT Generator COT", // "chatgpt-interactive-game": "ChatGPT Interactive Game", // "chatgpt-samples": "ChatGPT Samples", // "chatgpt": "ChatGPT", // "stable-diffusion-examples": "StableDiffusion Examples", // "stable-diffusion-generator": "StableDiffusion Generator", // "github-copilot-samples": "GitHub Copilot Samples", // "resources": "Resources", // }
// const ROLES = ["天才", "豪门弃子", "修炼废物", "冒险家", "孤儿", "情圣", "幸运儿", "强者", "屌丝", "学者"]; // translate to i18n ,like: "天才" -> t("genius"), and use Output variable to save key-value: {"genius": "天才"} const ROLES = [t("genius")
// const ROLES = ["天才", "豪门弃子", "修炼废物", "冒险家", "孤儿", "情圣", "幸运儿", "强者", "屌丝", "学者"]; // translate to i18n ,like: "天才" -> t("genius"), and use Output variable to save key-value: {"genius": "天才"} const ROLES = [t("genius"), t("rich"), t("waste"), t("adventurer"), t("orphan"), t("playboy"), t("lucky"), t("strong"), t("loser"), t("scholar")]; const Output = { "genius": "天才", "rich": "豪门弃子", "waste": "修炼废物", "adventurer": "冒险家", "orphan": "孤儿", "playboy": "情圣", "lucky": "幸运儿", "strong": "强者", "loser": "屌丝", "scholar": "学者" };