跳至内容

概述

GenAIScript 是命名为 *.genai.mjs 的 JavaScript 文件,或命名为 *.genai.mts 的 TypeScript 文件,它们内置了一个通过LLM提示设计的提示生成引擎。

shorten.genai.mjs
script({
title: "Shorten", // displayed in UI and Copilot Chat
// also displayed but grayed out:
description:
"A prompt that shrinks the size of text without losing meaning",
})
// but the variable is appropriately delimited
const file = def("FILE", env.files)
// this appends text to the prompt
$`Shorten ${file}. Limit changes to minimum.`

脚本文件

  • GenAIScript将检测工作区中任何匹配*.genai.mjs*.genai.js*.genai.mts的文件。
  • GenAIScript文件可以放在工作区的任何位置; 但默认情况下,扩展程序会将它们放置在genaisrc文件夹中。
  • .genai.mjs 使用模块化JavaScript语法并支持imports
  • .genai.js 文件会被执行但不支持导入。
  • .genai.mtsTypeScript 模块文件,支持 imports,包括对其他 TypeScript 文件的动态导入。
  • Directory/genaisrc
    • jsconfig.json // TypeScript编译器配置
    • genaiscript.d.ts // TypeScript类型定义
    • myscript.genai.mjs // 你的脚本!

主题