diff --git a/README.md b/README.md index 8f2fd38..2208cd0 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,7 @@ plugins = [ | 配置项 | 必填 | 默认值 | 说明 | | :-------------------: | :--: | :-----: | :-------------------------------------: | +| `PROXY` | 否 | `None` | 插件请求 API 使用的代理地址 | | `RIFFUSION_TIMEOUT` | 否 | `30` | 插件请求接口超时,单位秒 | | `RIFFUSION_BREAK_URL` | 否 | `False` | 是否破坏插件消息中的 URL 以降低风控概率 | @@ -143,6 +144,10 @@ Telegram:[@lgc2333](https://t.me/lgc2333) ## 📝 更新日志 +### 0.1.2 + +- 添加 `PROXY` 配置项 + ### 0.1.1 - 修复 `-h` 参数无效的问题 diff --git a/nonebot_plugin_riffusion/__init__.py b/nonebot_plugin_riffusion/__init__.py index 79187a4..2e0cf60 100644 --- a/nonebot_plugin_riffusion/__init__.py +++ b/nonebot_plugin_riffusion/__init__.py @@ -5,7 +5,7 @@ from . import __main__ as __main__ # noqa: E402 from .config import ConfigModel # noqa: E402 -__version__ = "0.1.1" +__version__ = "0.1.2" __plugin_meta__ = PluginMetadata( name="Riffusion", description="你给歌词,AI 作曲", diff --git a/nonebot_plugin_riffusion/config.py b/nonebot_plugin_riffusion/config.py index 30a095b..87af651 100644 --- a/nonebot_plugin_riffusion/config.py +++ b/nonebot_plugin_riffusion/config.py @@ -1,8 +1,12 @@ +from typing import Optional + from nonebot import get_driver from pydantic import BaseModel class ConfigModel(BaseModel): + proxy: Optional[str] = None + riffusion_timeout: float = 30 riffusion_break_url: bool = False diff --git a/nonebot_plugin_riffusion/data_source.py b/nonebot_plugin_riffusion/data_source.py index 4a10838..e512463 100644 --- a/nonebot_plugin_riffusion/data_source.py +++ b/nonebot_plugin_riffusion/data_source.py @@ -143,7 +143,7 @@ def get_random_lyrics() -> str: async def generate_single(lyrics: str, prompt: str, tag: str) -> SingleGeneratedResult: - async with AsyncClient() as cli: + async with AsyncClient(proxies=config.proxy) as cli: resp = await cli.post( "https://www.riffusion.com/api/trpc/inference.singleTextToAudio", headers={