> ## Documentation Index
> Fetch the complete documentation index at: https://dify-6c0370d8-docs-new-agent-experience.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 第三方集成

> 本文档由 AI 自动翻译。如有任何不准确之处，请参考 [英文原版](/en/self-host/deploy/troubleshooting/integrations)。

## Notion 集成

Notion OAuth 仅支持 HTTPS，因此本地部署必须使用内部集成。

### 配置环境变量

在 `.env` 中设置：

```
NOTION_INTEGRATION_TYPE=internal
NOTION_INTERNAL_SECRET=your_internal_secret_here
```

对于公共集成（仅限 HTTPS）：

```
NOTION_INTEGRATION_TYPE=public
NOTION_CLIENT_SECRET=oauth_client_secret
NOTION_CLIENT_ID=oauth_client_id
```

从 [Notion Integrations](https://www.notion.so/my-integrations) 获取凭证。

## 文本转语音 (TTS)

### FFmpeg 未安装错误

OpenAI 文本转语音需要 FFmpeg 进行音频流分段。

**macOS**:

```bash theme={null}
brew install ffmpeg
```

**Ubuntu**:

```bash theme={null}
sudo apt-get update
sudo apt-get install ffmpeg
```

**CentOS**:

```bash theme={null}
sudo yum install epel-release
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
sudo yum update
sudo yum install ffmpeg ffmpeg-devel
```

**Windows**:

1. 从 [FFmpeg 网站](https://ffmpeg.org/download.html) 下载
2. 解压并移动到 `C:\Program Files\`
3. 将 FFmpeg bin 目录添加到系统 PATH
4. 验证：`ffmpeg -version`

## 模型标记器

### 无法为 'gpt2' 加载标记器

错误：

```
Can't load tokenizer for 'gpt2'. If you were trying to load it from 'https://huggingface.co/models'...
```

在环境变量中配置 Hugging Face 镜像或代理。详细信息请参见[环境文档](https://docs.dify.ai/en/self-host/deploy/configuration/environments)。

## 安全策略

### 内容安全策略 (CSP)

启用 CSP 以减少 XSS 攻击。

在 `.env` 中：

```
CSP_WHITELIST=https://api.example.com,https://cdn.example.com
```

添加应用程序使用的所有域名（API、CDN、分析工具等）。

更多信息请参见 [MDN CSP 文档](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)。
