ClickPrompt Logo ClickPrompt

ClickFlow
学习资料
GitHub

函数名 + 输入 + 输出自动填充 - Phodal Huang

Prompt

function listAllFileUnderDist(

Result

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

数据转换 - Phodal Huang

Prompt

// 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 {

Result

export function parseStableDiffusionData(prompt: string): StableDiffusionGenData {
  ...
}

按步骤设计 - Phodal Huang

Prompt

// 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

Result

const loras = promptMatch[1]
  .split(",")
  .map((item) => {
  const match = item.match(/<lora:(.+):.+/);
    return match ? match[1] : "";
})
  .filter((item) => item !== "");

编程语言间翻译 - Phodal Huang

Prompt

使用注释复制其它语言的代码,如输入 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...

Result

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

测试用例生成 - Phodal Huang

Prompt

@Test
fun `test command manager git branch list`() {

Result

@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
}

批量操作 - Phodal Huang

Prompt

// 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",

Result

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"] },
    ],
  }
]

翻译 - Phodal Huang

Prompt

// {
//   "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

Result

// {
//   "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",
// }

国际化 - Phodal Huang

Prompt

// const ROLES = ["天才", "豪门弃子", "修炼废物", "冒险家", "孤儿", "情圣", "幸运儿", "强者", "屌丝", "学者"];
// translate to i18n ,like: "天才" -> t("genius"), and use Output variable to save key-value: {"genius": "天才"}
const ROLES = [t("genius")

Result

// 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": "学者" };
Powered byVercel Logo