feat: add multi model envs (#25)

pull/28/head
takatost 2023-11-13 20:26:46 +08:00 committed by GitHub
parent 1726b41abe
commit 185222b2dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 159 additions and 91 deletions

View File

@ -23,14 +23,10 @@ The backend URL of the console API, used to concatenate the authorization callba
The front-end URL of the console web, used to concatenate some front-end addresses and for CORS configuration use. If empty, it is the same domain. Example: `https://console.dify.ai`
> Starting from version `0.3.8`, `CONSOLE_URL` has been split into `CONSOLE_API_URL` and `CONSOLE_WEB_URL`, but `CONSOLE_URL` is still available.
#### SERVICE_API_URL
Service API Url, used to display Service API Base Url to the front-end. If empty, it is the same domain. Example: `https://api.dify.ai`
> Starting from version `0.3.8`, `API_URL` has been renamed to `SERVICE_API_URL`, but `API_URL` is still available.
#### APP_API_URL
WebApp API backend Url, used to declare the back-end URL for the front-end API. If empty, it is the same domain. Example: `https://app.dify.ai`
@ -39,7 +35,10 @@ WebApp API backend Url, used to declare the back-end URL for the front-end API.
WebApp Url, used to display WebAPP API Base Url to the front-end. If empty, it is the same domain. Example: `https://api.app.dify.ai`
> Starting from version `0.3.8`, `APP_URL` has been split into `APP_API_URL` and `APP_WEB_URL`, but `APP_URL` is still available.
#### FILES\_URL
File preview or download URL prefix, used to display the file preview or download URL to the front-end or as a multi-modal model input;
In order to prevent others from forging, the image preview URL is signed and has a 5-minute expiration time.
### Server
@ -157,28 +156,6 @@ This Redis configuration is used for caching and for pub/sub during conversation
* REDIS_PASSWORD: Redis password, default is empty. It is strongly recommended to set a password.
* REDIS_USE_SSL: Whether to use SSL protocol for connection, default is false
#### ~~Session Configuration~~
>⚠️ This configuration is no longer valid since v0.3.24.
~~Only used by the API service for interface identity verification.~~
* ~~SESSION_TYPE:~~
~~Session component type~~
* ~~redis (default)~~
~~If you choose this, you need to set the environment variables starting with SESSION_REDIS_ below.~~
* ~~sqlalchemy~~
~~If you choose this, the current database connection will be used and the sessions table will be used to read and write session records.~~
* ~~SESSION_REDIS_HOST: Redis host~~
* ~~SESSION_REDIS_PORT: Redis port, default is 6379~~
* ~~SESSION_REDIS_DB: Redis Database, default is 0. Please use a different Database from Redis and Celery Broker.~~
* ~~SESSION_REDIS_USERNAME: Redis username, default is empty~~
* ~~SESSION_REDIS_PASSWORD: Redis password, default is empty. It is strongly recommended to set a password.~~
* ~~SESSION_REDIS_USE_SSL: Whether to use SSL protocol for connection, default is false~~
#### Celery Configuration
* CELERY_BROKER_URL
@ -205,26 +182,6 @@ Used to set the front-end cross-domain access policy.
WebAPP CORS cross-domain policy, default is `*`, that is, all domains can access.
For detailed configuration, please refer to: [Cross-domain/identity related guide](https://avytux375gg.feishu.cn/wiki/HyX3wdF1YiejX3k3U2CcTcmQnjg)
#### ~~Cookie Policy Configuration~~
>⚠️ This configuration is no longer valid since v0.3.24.
~~Used to set the browser policy for session cookies used for identity verification.~~
* ~~COOKIE_HTTPONLY~~
~~Cookie HttpOnly configuration, default is true.~~
* ~~COOKIE_SAMESITE~~
~~Cookie SameSite configuration, default is Lax.~~
* ~~COOKIE_SECURE~~
~~Cookie Secure configuration, default is false.~~
~~For detailed configuration, please refer to: [Cross-domain/identity related guide](https://avytux375gg.feishu.cn/wiki/HyX3wdF1YiejX3k3U2CcTcmQnjg)~~
#### File Storage Configuration
Used to store uploaded data set files, team/tenant encryption keys, and other files.
@ -307,10 +264,24 @@ Used to store uploaded data set files, team/tenant encryption keys, and other fi
* UPLOAD_FILE_SIZE_LIMIT:
Upload file size limit, default 15M.
* UPLOAD_FILE_BATCH_LIMIT
The maximum number of files that can be uploaded at a time, default 5.
* TENANT_DOCUMENT_COUNT:
Number of files that can be uploaded per tenant, default 100.
#### Multi-modal Model Configuration
* MULTIMODAL_SEND_IMAGE_FORMAT
The format of the image sent when the multi-modal model is input, the default is `base64`, optional `url`.
The delay of the call in `url` mode will be lower than that in `base64` mode. It is generally recommended to use the more compatible `base64` mode.
If configured as `url`, you need to configure `FILES_URL` as an externally accessible address so that the multi-modal model can access the image.
* UPLOAD_IMAGE_FILE_SIZE_LIMIT
Upload image file size limit, default 10M.
#### Sentry Configuration
@ -389,3 +360,64 @@ Only available for cloud version, used for model hosting configuration.
#### SENTRY_DSN
Sentry DSN address, default is empty, when empty, all monitoring information is not reported to Sentry.
## Deprecated
#### CONSOLE\_URL
>⚠️ Modified in 0.3.8, will be deprecated in 0.4.0, replaced by: `CONSOLE_API_URL` and `CONSOLE_WEB_URL`.
Console URL, used to concatenate the authorization callback, console front-end address, and CORS configuration use. If empty, it is the same domain. Example: `https://console.dify.ai`.
#### API\_URL
>⚠️ Modified in 0.3.8, will be deprecated in 0.4.0, replaced by `SERVICE_API_URL`.
API URL, used to display Service API Base URL to the front-end. If empty, it is the same domain. Example: `https://api.dify.ai`
#### APP\_URL
>⚠️ Modified in 0.3.8, will be deprecated in 0.4.0, replaced by `APP_API_URL` and `APP_WEB_URL`.
WebApp Url, used to display WebAPP API Base Url to the front-end. If empty, it is the same domain. Example: `https://api.app.dify.ai`
#### Session Configuration
>⚠️ This configuration is no longer valid since v0.3.24, will be deprecated in 0.4.0.
Only used by the API service for interface identity verification.
* SESSION\_TYPE
Session component type
* redis (default)
If you choose this, you need to set the environment variables starting with SESSION_REDIS_ below.
* sqlalchemy
If you choose this, the current database connection will be used and the sessions table will be used to read and write session records.
* SESSION\_REDIS\_HOST: Redis host
* SESSION\_REDIS\_PORT: Redis port, default is 6379
* SESSION\_REDIS\_DB: Redis Database, default is 0. Please use a different Database from Redis and Celery Broker.
* SESSION\_REDIS\_USERNAME: Redis username, default is empty
* SESSION\_REDIS\_PASSWORD: Redis password, default is empty. It is strongly recommended to set a password.
* SESSION\_REDIS\_USE\_SSL: Whether to use SSL protocol for connection, default is false
#### Cookie Policy Configuration
>⚠️ This configuration is no longer valid since v0.3.24, will be deprecated in 0.4.0.
Used to set the browser policy for session cookies used for identity verification.
* COOKIE\_HTTPONLY
Cookie HttpOnly configuration, default is true.
* COOKIE\_SAMESITE
Cookie SameSite configuration, default is Lax.
* COOKIE\_SECURE
Cookie Secure configuration, default is false.

View File

@ -17,31 +17,28 @@
#### CONSOLE\_API\_URL
> 此变量单独作为控制台 API URL 配置,原 CONSOLE\_URL 依旧可用。
控制台 API 后端 URL用于拼接授权回调传空则为同域。范例`https://api.console.dify.ai`。
#### CONSOLE\_WEB\_URL
控制台 web **前端** URL用于拼接部分前端地址以及 CORS 配置使用,传空则为同域。范例:`https://console.dify.ai`
> 自 0.3.8 版本起,`CONSOLE_URL` 拆分为 `CONSOLE_API_URL``CONSOLE_WEB_URL``CONSOLE_URL` 依旧可用。
#### SERVICE\_API\_URL
Service API Url用于**给前端**展示 Service API Base Url传空则为同域。范例`https://api.dify.ai`
> 自 0.3.8 版本起,`API_URL` 更名为 `SERVICE_API_URL``API_URL` 依旧可用。
Service API URL用于**给前端**展示 Service API Base URL传空则为同域。范例`https://api.dify.ai`
#### APP\_API\_URL
WebApp API 后端 Url,用于声明**前端** API 后端地址,传空则为同域。范例:`https://app.dify.ai`
WebApp API 后端 URL,用于声明**前端** API 后端地址,传空则为同域。范例:`https://app.dify.ai`
#### APP\_WEB\_URL
WebApp Url用于**给前端**展示 WebAPP API Base Url,传空则为同域。范例:`https://api.app.dify.ai`
WebApp URL用于**给前端**展示 WebAPP API Base URL,传空则为同域。范例:`https://api.app.dify.ai`
> 自 0.3.8 版本起,`APP_URL` 拆分为 `APP_API_URL``APP_WEB_URL``APP_URL` 依旧可用。
#### FILES\_URL
文件预览或下载 URL 前缀,用于将文件预览或下载 URL 给前端展示或作为多模态模型输入;
为了防止他人伪造,图片预览 URL 是带有签名的,并且有 5 分钟过期时间。
***
@ -155,25 +152,6 @@ Flask 调试模式,开启可在接口输出 trace 信息,方便调试。
* REDIS\_PASSWORDRedis 密码,默认为空,强烈建议设置密码。
* REDIS\_USE\_SSL是否使用 SSL 协议进行连接,默认 false
#### ~~Session 配置~~
>⚠️ 该配置从 0.3.24 版本起已废弃。
~~仅 API 服务使用,用于验证接口身份。~~
* ~~SESSION\_TYPE Session 组件类型~~
* ~~redis默认~~
~~选择此项,则需要设置下方 SESSION\_REDIS\_ 开头的环境变量。~~
* ~~sqlalchemy~~
~~选择此项,则使用当前数据库连接,并使用 sessions 表进行读写 session 记录。~~
* ~~SESSION\_REDIS\_HOSTRedis host~~
* ~~SESSION\_REDIS\_PORTRedis port默认 6379~~
* ~~SESSION\_REDIS\_DBRedis Database默认为 0请和 Redis、Celery Broker 分开用不同 Database。~~
* ~~SESSION\_REDIS\_USERNAMERedis 用户名,默认为空~~
* ~~SESSION\_REDIS\_PASSWORDRedis 密码,默认为空,强烈建议设置密码。~~
* ~~SESSION\_REDIS\_USE\_SSL是否使用 SSL 协议进行连接,默认 false~~
#### Celery 配置
* CELERY\_BROKER\_URL
@ -202,21 +180,6 @@ Flask 调试模式,开启可在接口输出 trace 信息,方便调试。
详细配置可参考:[跨域/身份相关指南](https://avytux375gg.feishu.cn/wiki/HyX3wdF1YiejX3k3U2CcTcmQnjg)
#### ~~Cookie 策略配置~~
>⚠️ 该配置从 0.3.24 版本起已废弃。
~~用于设置身份校验的 Session Cookie 浏览器策略。~~
* ~~COOKIE\_HTTPONLY~~
~~Cookie HttpOnly 配置,默认为 true。~~
* ~~COOKIE\_SAMESITE~~
~~Cookie SameSite 配置,默认为 Lax。~~
* ~~COOKIE\_SECURE~~
~~Cookie Secure 配置,默认为 false。详细配置可参考[跨域/身份相关指南](https://avytux375gg.feishu.cn/wiki/HyX3wdF1YiejX3k3U2CcTcmQnjg)~~
#### 文件存储配置
用于存储数据集上传的文件、团队/租户的加密密钥等等文件。
@ -296,10 +259,26 @@ Flask 调试模式,开启可在接口输出 trace 信息,方便调试。
* UPLOAD_FILE_SIZE_LIMIT
上传文件大小限制,默认 15M。
* UPLOAD_FILE_BATCH_LIMIT
每次上传文件数上限,默认 5 个。
* TENANT_DOCUMENT_COUNT
租户可上传文件数,默认 100。
#### 多模态模型配置
* MULTIMODAL_SEND_IMAGE_FORMAT
多模态模型输入时,发送图片的格式,默认为 `base64`,可选 `url`
`url` 模式下,调用的延迟会比 `base64` 模式下低,一般建议使用兼容更好的 `base64` 模式。
若配置为 `url`,则需要将 `FILES_URL` 配置为外部可访问的地址,以便多模态模型可以访问到图片。
* UPLOAD_IMAGE_FILE_SIZE_LIMIT
上传图片文件大小限制,默认 10M。
#### Sentry 配置
用于应用监控和错误日志跟踪。
@ -377,3 +356,60 @@ Notion 集成配置,变量可通过申请 Notion integration 获取:[https:/
#### SENTRY\_DSN
Sentry DSN 地址,默认为空,为空时则所有监控信息均不上报 Sentry。
## 已废弃
#### CONSOLE\_URL
> 修改于 0.3.8,将于 0.4.0 废弃,替代为:`CONSOLE_API_URL` 和 `CONSOLE_WEB_URL`
控制台 URL用于拼接授权回调、控制台前端地址以及 CORS 配置使用,传空则为同域。范例:`https://console.dify.ai`。
#### API\_URL
> 修改于 0.3.8,将于 0.4.0 废弃,替代为 `SERVICE_API_URL`
API Url用于**给前端**展示 Service API Base Url传空则为同域。范例`https://api.dify.ai`
#### APP\_URL
> 修改于 0.3.8,将于 0.4.0 废弃,替代为 `APP_API_URL``APP_WEB_URL`
WebApp Url用于声明**前端** API 后端地址,传空则为同域。范例:`https://app.dify.ai`
#### Session 配置
>⚠️ 该配置从 0.3.24 版本起废弃。(将于 0.4.0 彻底移除)
仅 API 服务使用,用于验证接口身份。
* SESSION\_TYPE Session 组件类型
* redis默认
选择此项,则需要设置下方 SESSION\_REDIS\_ 开头的环境变量。
* sqlalchemy
选择此项,则使用当前数据库连接,并使用 sessions 表进行读写 session 记录。
* SESSION\_REDIS\_HOSTRedis host
* SESSION\_REDIS\_PORTRedis port默认 6379
* SESSION\_REDIS\_DBRedis Database默认为 0请和 Redis、Celery Broker 分开用不同 Database。
* SESSION\_REDIS\_USERNAMERedis 用户名,默认为空
* SESSION\_REDIS\_PASSWORDRedis 密码,默认为空,强烈建议设置密码。
* SESSION\_REDIS\_USE\_SSL是否使用 SSL 协议进行连接,默认 false
#### Cookie 策略配置
>⚠️ 该配置从 0.3.24 版本起废弃。 (将于 0.4.0 彻底移除)
用于设置身份校验的 Session Cookie 浏览器策略。
* COOKIE\_HTTPONLY
Cookie HttpOnly 配置,默认为 true。
* COOKIE\_SAMESITE
Cookie SameSite 配置,默认为 Lax。
* COOKIE\_SECURE
Cookie Secure 配置,默认为 false。