跳至内容

安装

GenAIScript可作为命令行工具或Visual Studio Code扩展使用。

Node.JS

GenAIScript需要Node.JS才能运行。 我们建议使用node版本管理器安装LTS版本。

  1. 安装Node.JS (node) 使用包管理器您至少需要Node.JS v20版本。

  2. 检查您的安装

    终端窗口
    node -v
    npx -v

    您应该看到类似或高于以下版本的信息:

    v20.11.1
    10.5.0

Visual Studio Code 扩展

Visual Studio Code Marketplace包含extension的最新稳定版本。

  1. 安装 Visual Studio Code

    Visual Studio Code 是一款轻量级但功能强大的源代码编辑器,可在您的桌面上运行,适用于 Windows、macOS 和 Linux 系统。

  2. 在Visual Studio Code中打开您的项目文件夹。

  3. 点击扩展视图

    Icon representing the GenAIScript view in Visual Studio Code, 
located in the activity bar on the left side of the screen.
  4. 搜索 genaiscript 并点击 安装

    Visual Studio Code Marketplace listing for 'GenAIScript' extension by Microsoft, featuring a logo with 'gen AI' in yellow on a black background, followed by the text 'GenAIScript Generative AI Scripting.' with a settings gear icon to the right.
  5. 如果成功,您将在扩展视图中看到该图标。

    Icon for genAI script view in Visual Studio Code, featuring the text 'gen AI' in white on a dark background with a red outline.
  6. (可选) 点击扩展页面上的⚙️齿轮图标,选择添加到工作区推荐

要安装特定版本的扩展,我们建议将genaiscript.vsix存储在您的代码库中并使用手动安装步骤。

终端默认配置文件

GenAIScript会在默认终端中启动一个node服务器。如果默认终端未配置或不支持node.js,您可能需要在用户/工作区设置中进行更新。

  • 打开命令面板 Ctrl+Shift+P 并搜索 Terminal: Select Default Profile
  • 选择终端配置文件,例如Git Bash

手动安装(高级)

该扩展的最新开发版本也可通过GitHub发布获取。这可以让您在官方市场发布前更早获得错误修复。

  1. 在GitHub上打开最新版本

  2. genaiscript.vsix下载到您的项目根文件夹中

    • Directory.genaiscript/ folder created by the extension to store supporting files
      • Directorycache/ various cache files
      • Directoryretrieval/ retrieval database caches
      • 支持文件
    • genaiscript.vsix
  3. 在Visual Studio Code中打开您的项目

  4. 右键点击 .vsix 文件并选择 安装扩展 VSIX...

命令行

genaiscript 命令行工具允许您从任何终端运行您的 GenAIScript。

终端窗口
npx genaiscript run my-script some/path/*.pdf

npx 会自动安装并缓存CLI。

开发容器

您可以将此文件添加到项目中,以便在DevContainer中使用GenAIScript,它包含了入门所需的最基本工具。

.devcontainer/devcontainer.json
{
"image": "mcr.microsoft.com/devcontainers/typescript-node:20",
"customizations": {
"vscode": {
"extensions": ["genaiscript.genaiscript-vscode"]
}
}
}

devcontainer定义将被 GitHub CodeSpacesdevcontainer cli 或各种editor integrations自动使用。

下一步

让我们配置LLM连接信息