# @fonoster/autopilot 中文文档

规范地址：https://npmcn.com/package/%40fonoster/autopilot/

版本：0\.62\.0
npm 元数据更新时间：2026-11-15T17:58:38.472Z
中文译文更新时间：2026-11-15T04:20:20.623Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40fonoster/autopilot
原文对照：https://npmcn.com/package/%40fonoster/autopilot/?lang=original
项目主页：https://github.com/fonoster/fonoster#readme
源码仓库：https://github.com/fonoster/fonoster

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：307 kB，157 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- 运行依赖：22 个
- 首次发布：2024-03-16T18:39:31.553Z
- 最新版本发布：2026-11-15T17:58:38.100Z
- 近 30 天下载量：7332（2026-10-15 至 2026-11-13，npm 官方下载统计）
- 已发布版本数：289（近 12 个月 75 个）

## 中文简介

长老会平台之声AI

## 安装

```sh
npm install @fonoster/autopilot
```

也可以使用：`pnpm add @fonoster/autopilot`、`yarn add @fonoster/autopilot`、`bun add @fonoster/autopilot`

## README

# 自动驾驶

[![Autopilot](https://img.shields.io/badge/autopilot-api-brightgreen.svg)](https://fonoster.com/) [![Version](https://img.shields.io/npm/v/@fonoster/autopilot.svg)](https://npmjs.org/package/@fonoster/autopilot) [![Downloads/week](https://img.shields.io/npm/dw/@fonoster/autopilot.svg)](https://npmjs.org/package/@fonoster/autopilot) [![License](https://img.shields.io/npm/l/@fonoster/autopilot.svg)](https://github.com/fonoster/fonoster/blob/main/package.json)

自动驾驶模块提供了在长老会创建Voice AI应用程序的方法. 它利用了长老会内部的Voice API和"大语言模型"的力量来创造与召唤方的对话体验.

-   [安装](https://npmcn.com/package/%40fonoster/autopilot/#readme-installation)
-   [示例](https://npmcn.com/package/%40fonoster/autopilot/#readme-example)
-   [增加知识库](https://npmcn.com/package/%40fonoster/autopilot/#readme-configuring-the-knowledge-base)
-   [添加工具](https://npmcn.com/package/%40fonoster/autopilot/#readme-configuring-the-tools)

## 安装

自动驾驶是AppBridge拨打的普通会话应用. 运行 `fonoster/autopilot` 图像( 从 `mods/autopilot/Dockerfile`),或来自存储库:

```sh-session
$ cp config/autopilot-session.example.yaml config/autopilot-session.yaml
$ node mods/autopilot/dist/session/main.js --config config/autopilot-session.yaml
```

见 [文件/自动驾驶员.md](https://npmcn.com/package/docs/autopilot.md) 用于发动机、速度和代理 计划.

## 示例

要发挥作用,Autopilot需要配置文件,OpenAI API密钥,以及活跃的长老会账户或自办长老会实例.

配置文件有两个主要部分: `conversationSettings` 财务报告和审定财务报表 `languageModel`编辑 `conversationSettings` 区域包含对话的设置,如第一个消息、系统模板和传输选项。 这个 `languageModel` 一节包含语言模型的设置,如提供者、模型和温度等.

```json
{
  "conversationSettings": {
    "firstMessage": "Hello, this is Olivia from Dr. Green's Family Medicine. How can I assist you today?",
    "systemPrompt": "You are a Customer Service Representative. You are here to help the caller with their needs.",
    "systemErrorMessage": "I'm sorry, but I seem to be having trouble. Please try again later.",
    "initialDtmf": "6589",
    "transferOptions": {
      "phoneNumber": "+15555555555",
      "message": "Please hold while I transfer you to a live agent.",
      "timeout": 30000
    },
    "idleOptions": {
      "message": "Are you still there?",
      "timeout": 10000,
      "maxTimeoutCount": 3
    }
  },
  "languageModel": {
    "provider": "openai",
    "model": "gpt-4o-mini",
    "maxTokens": 250,
    "temperature": 0.7,
    "knowledgeBase": [],
    "tools": []
  }
}
```

要运行"自动驾驶",可以使用以下命令: 1

```sh-session
$ AGENT=$(pwd)/agents.json OPEN_API_KEY=your-key autopilot
```

你会看到这样的信息:

```sh-session
2024-09-06 11:32:16.584 [info]: (voice) started voice server @ 0.0.0.0, port=50061 {}
```

这意味着"自动驾驶"正在运行,准备接听电话.

由于您正在本地运行自动驾驶, 您必须让端口 50061 上互联网 。 为了暴露端口,你可以使用这样的服务 [无](https://ngrok.com/)

```sh-session
$ ngrok tcp 50061
```

在您的长老账户中配置 ngrok 提供的终点 。 你可以找到更多的信息 如何做到这一点 [长老会议文件](https://fonoster.com/docs)。 。 。 .

## 语言模型提供者

Autopilot支持多种语言模型提供者. 以下是所支持的提供者列表:

| 提供者 | 说明 | 支持的模型 |
| --- | --- | --- |
| 开放AI | OpenAI 为对话AI提供各种GPT模型 | `gpt-4o`, (中文(简体) ), `gpt-4o-mini`, (中文(简体) ), `gpt-3.5-turbo`, (中文(简体) ), `gpt-4-turbo` |
| 格罗克 | Groq 提供了高性能的AI型号,优化了速度 | `llama-3.1-8b-instant`, (中文(简体) ), `llama-3.3-70b-specdec` |
| 奥拉玛 | 自办的Ollama模型 | `llama3-groq-tool-use` |

> 我们正在不断更新支助提供者和模式清单。 如果你有你想要使用的具体模型 请告诉我们.

## 增加知识库

知识库向语文模式提供信息,如工作时间、服务或产品等.

目前,我们支持从一桶S3取回文件.

为了增加一个知识库,在表格中列入一个新的条目 `knowledgeBase` 配置文件中的数组。 以下是菜单PDF知识的例子.

```json
{
  "conversationSettings": { ... },
  "languageModel": {
    "provider": "openai",
    "model": "gpt-4o-mini",
    "apiKey": "your-api-key",
    "maxTokens": 100,
    "temperature": 0.4,
    "knowledgeBase": [{
      "type": "s3",
      "title": "Menu PDF",
      "document": "sample.pdf"
    }],
    "tools": []
  }
}
```

## 添加工具

Autopilot中的一个工具是和外部服务互动以获取信息或执行动作的一种方式. 例如,您可以使用一个工具来获取天气,最新消息,或者一个短消息.

您可以通过在 `tools` 配置文件中的数组。 以下是获得特定日期可用任命时间的示例工具.

```json
{
  "conversationSettings": { ... },
  "languageModel": {
    "provider": "openai",
    "model": "gpt-4o-mini",
    "apiKey": "your-api-key",
    "maxTokens": 100,
    "temperature": 0.4,
    "knowledgeBase": [],
    "tools": [
      {
        "name": "getAvailableTimes",
        "description": "Get available appointment times for a specific date.",
        "parameters": {
          "type": "object",
          "properties": {
            "date": {
              "type": "string",
              "format": "date"
            }
          },
          "required": [
            "date"
          ]
        },
        "operation": {
          "type": "get",
          "url": "https://api.example.com/appointment-times",
          "headers": {
            "x-api-key": "your-api-key"
          }
        }
      }
    ]
  }
}
```

计外 `get` 操作类型,您可以使用 `post` 操作类型。 这个 `post` 向工具发送数据时使用操作类型。 发送邮件时, 您可以选择设置 `waitForResponse` 假的,那会"火并忘记"的要求。 默认行为是等待回应.

如果您的工具需要呼叫器的号码或接收到的号码,可以使用保留变量 `ingressNumber` 财务报告和审定财务报表 `callerNumber`。类似地,您可以使用保留变量 `callReceivedAt` 以获取接到电话的日期和时间 `ISO 8601` 格式和样式 `callDirection` 变量来检查该调用是否来自 PSTN.

响应的预期格式是一个JSON对象,其结构如下:

```json
{ "result": "text to pass to the language model" }
```

例如:

```json
{ "result": "The available appointment times are 9:00 AM, 10:00 AM, and 11:00 AM." }
```

## 配置

自动驾驶读取 `autopilot-session.yaml`,通过 `--config <path>`,则 `AUTOPILOT_SESSION_CONFIG` 变量或 `./config/autopilot-session.yaml`它命名了签名 秘密 AppBridge 用于 Autopilot apps, 应用程序和代理商来自哪里, 注册 编目,通过认证参考和知识设置的平台密钥. 见 `config/autopilot-session.example.yaml` 每一个键.

音频过滤器是应用程序配置的一部分(AppBridge运行它们),而不是代理设备.

## 常见问题

### @fonoster/autopilot 是什么？

长老会平台之声AI

### 如何安装 @fonoster/autopilot？

在项目目录运行 npm install @fonoster/autopilot，或使用 pnpm add / yarn add / bun add。

### @fonoster/autopilot 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @fonoster/autopilot 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @fonoster/autopilot 可以商用吗？

@fonoster/autopilot 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @fonoster/autopilot 的下载量有多少？

根据 npm 官方下载统计，@fonoster/autopilot 在 2026/10/15 – 2026/11/13 这 30 天内被下载 7,332 次，日均约 244 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @fonoster/autopilot 还在维护吗？

最新版本 0\.62\.0 发布于 2026/11/16（今天）；至今共发布 289 个版本，其中过去 12 个月发布了 75 个；首次发布于 2024/03/17。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

