From 23d2142ded0905e3d85d7c4cdf765d3446ffe119 Mon Sep 17 00:00:00 2001 From: touale <136764239@qq.com> Date: Tue, 6 Jan 2026 18:30:42 +0800 Subject: [PATCH] fix: update version handling and environment variable support --- src/framex/driver/application.py | 4 +++- src/framex/plugin/on.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/framex/driver/application.py b/src/framex/driver/application.py index 3416c04..95573c0 100644 --- a/src/framex/driver/application.py +++ b/src/framex/driver/application.py @@ -1,6 +1,7 @@ """Module containing FastAPI instance related functions and classes.""" import json +import os from collections.abc import Callable from contextlib import asynccontextmanager from datetime import UTC, datetime @@ -27,6 +28,7 @@ FRAME_START_TIME = datetime.now(tz=UTC) SHANGHAI_TZ = ZoneInfo("Asia/Shanghai") +REVERSION = settings.server.reversion or os.getenv("REVERSION") def build_openapi_description() -> str: @@ -42,7 +44,7 @@ def build_openapi_description() -> str: |--------|-------| | Started At | `{started_at}` | | Uptime | `{uptime}` | -| Service-Version | `v{settings.server.reversion}` | +| Service-Version | `v{REVERSION}` | | FrameX-Version | `v{VERSION}` | --- diff --git a/src/framex/plugin/on.py b/src/framex/plugin/on.py index 09df20c..cb874a5 100644 --- a/src/framex/plugin/on.py +++ b/src/framex/plugin/on.py @@ -37,7 +37,7 @@ def decorator(cls: type) -> type: params = extract_method_params(func) version: str = plugin.module.__plugin_meta__.version - version = f"v{version}" if version.startswith("v") else version + version = f"v{version}" if not version.startswith("v") else version plugin_apis.append( PluginApi( api=path,