Skip to content

Commit

Permalink
📝 更新 README 及修改一些内容以适配 README (#282)
Browse files Browse the repository at this point in the history
* 📝 更新 README 及修改一些内容以适配 README

* 🔖 更新版本号至 6.0.6
  • Loading branch information
Well2333 authored Jan 12, 2025
1 parent e6ff341 commit 3ac11f0
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 227 deletions.
275 changes: 59 additions & 216 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion nonebot_plugin_bilichat/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

nonebot_config = get_driver().config
try:
config_path = Path(nonebot_config.config_path)
config_path = Path(nonebot_config.bilichat_config_path)
except Exception as e:
config_path = CONFIG_DIR.joinpath("config.yaml")
logger.warning(f"用户未设置配置文件路径, 尝试默认配置文件路径 {config_path}")
Expand Down
7 changes: 3 additions & 4 deletions nonebot_plugin_bilichat/model/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
class LocalApiConfig(BaseModel):
enable: bool = False
"""是否启用本地 API"""
retry: int = 3
"""API 请求重试次数"""
playwright_download_host: str = ""
"""Playwright 下载服务地址镜像"""
api_path: str = "bilichatapi"
"""本地 API 挂载路径"""
api_access_token: str = ""
Expand All @@ -20,6 +16,9 @@ class LocalApiConfig(BaseModel):
"""动态订阅限速"""
api_sub_live_limit: str = "1800/hour"
"""直播订阅限速"""

class Config:
extra = "allow"


class NoneBotConfig(BaseModel):
Expand Down
4 changes: 3 additions & 1 deletion nonebot_plugin_bilichat/request_api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
from nonebot_plugin_bilichat.model.exception import RequestError
from nonebot_plugin_bilichat.model.request_api import Account, Content, Dynamic, LiveRoom, Note, SearchUp, VersionInfo

MINIMUM_API_VERSION = Version("0.2.1")
MINIMUM_API_VERSION = Version("0.2.2")


class RequestAPI:
def __init__(
self, api_base: URL, api_token: str, weight: int, note: str = "", *, skip_version_checking: bool = False
) -> None:
if ".example.com" in str(api_base):
raise ValueError(f"请设置正确的 API 地址 --> {api_base}")
self._api_base = api_base
self._api_token = api_token
self._weight = weight
Expand Down
2 changes: 1 addition & 1 deletion nonebot_plugin_bilichat/request_api/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
except ImportError as e:
raise ImportError("bilichat-request 未安装, 请先安装 bilichat-request") from e

bilichat_request_config = bilichat_request_config.model_validate(bilichat_config.api.local_api_config.model_dump())
bilichat_request_config = bilichat_request_config.model_validate(bilichat_config.api.local_api_config.model_dump(exclude={"enable"}))
bilichat_request_config.data_path = DATA_DIR.joinpath("bilichat_request").as_posix()

set_config(bilichat_request_config)
Expand Down
3 changes: 1 addition & 2 deletions nonebot_plugin_bilichat/static/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ api:
api_path: bilichatapi # 本地 API 挂载路径
api_sub_dynamic_limit: 720/hour # 动态订阅限速
api_sub_live_limit: 1800/hour # 直播订阅限速
playwright_download_host: "" # Playwright 下载服务地址镜像
retry: 3 # API 请求重试次数
# 其他配置请参考 bilichat-request 的配置文件
browser_shot_quality: 75 # 浏览器截图质量, 范围为 10-100

subs:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "nonebot-plugin-bilichat"

version = "6.0.5"
version = "6.0.6"

description = "全功能的 bilibili 内容解析器及订阅器"
authors = [
Expand Down Expand Up @@ -29,7 +29,7 @@ requires-python = ">=3.10,<4.0"
readme = "README.md"
license = { text = "AGPL3.0" }
[project.optional-dependencies]
extra = ["bilichat-request>=0.1.0"]
api = ["bilichat-request>=0.1.0"]

[build-system]
requires = ["pdm-backend"]
Expand Down

0 comments on commit 3ac11f0

Please sign in to comment.