安装#

安装 AutoGen Studio 有两种方式——从 PyPi 或从源代码安装。我们建议从 PyPi 安装,除非你计划修改源代码。

从源代码安装#

注意:此方法需要对使用 React 构建界面有一定的了解。

你有两种从源代码安装的选项:手动安装或使用开发容器安装。

A) 手动从源代码安装#

  1. 确保你已安装 Python 3.10+ 和 Node.js(版本高于 14.15.0)。

  2. 克隆 AutoGen Studio 仓库。

  3. 导航到 python/packages/autogen-studio 目录,并使用 pip install -e . 安装其 Python 依赖项。

  4. 导航到 python/packages/autogen-studio/frontend 目录,安装依赖项并构建 UI。

npm install -g gatsby-cli
npm install --global yarn
cd frontend
yarn install
yarn build
# Windows users may need alternative commands to build the frontend:
gatsby clean && rmdir /s /q ..\\autogenstudio\\web\\ui 2>nul & (set \"PREFIX_PATH_VALUE=\" || ver>nul) && gatsby build --prefix-paths && xcopy /E /I /Y public ..\\autogenstudio\\web\\ui

B) 使用开发容器从源代码安装#

  1. 按照 开发容器教程 安装 VS Code、Docker 和相关扩展。

  2. 克隆 AutoGen Studio 仓库。

  3. 在 VS Code 中打开 python/packages/autogen-studio/。点击右下角的蓝色按钮或按下 F1 并选择 “Dev Containers: Reopen in Container”

  4. 构建 UI

cd frontend
yarn build

运行应用程序#

安装完成后,在终端中输入以下命令运行 Web UI:

autogenstudio ui --port 8081

此命令将在指定端口启动应用程序。打开你的网络浏览器并访问 https://:8081/ 即可使用 AutoGen Studio。

AutoGen Studio 还接受几个参数来定制应用程序。

  • --host <host> 参数用于指定主机地址。默认情况下,它设置为 localhost

  • --appdir <appdir> 参数用于指定应用程序文件(例如,数据库和生成的客户端文件)的存储目录。默认情况下,它设置为用户主目录中的 .autogenstudio 目录。

  • --port <port> 参数用于指定端口号。默认情况下,它设置为 8080

  • --reload 参数用于在代码更改时启用服务器自动重新加载。默认情况下,它设置为 False

  • --database-uri 参数用于指定数据库 URI。示例值包括 SQLite 的 sqlite:///database.sqlite 和 PostgreSQL 的 postgresql+psycopg://user:password@localhost/dbname。如果未指定此参数,数据库 URL 默认为 --appdir 目录中的 database.sqlite 文件。

  • --upgrade-database 参数用于将数据库模式升级到最新版本。默认情况下,它设置为 False

现在你已经安装并运行了 AutoGen Studio,可以探索其功能了,包括定义和修改代理工作流、与代理和会话交互以及扩展代理技能。