实现 services

This commit is contained in:
2025-11-02 03:41:36 +08:00
parent 723046a876
commit 5aee812ffc
5 changed files with 14 additions and 3 deletions

View File

@@ -7,11 +7,12 @@ import pathlib
from heurams.services.config import ConfigFile
root_dir = pathlib.Path(__file__).parent
working_dir = pathlib.Path.cwd()
config_var: ContextVar[ConfigFile] = ContextVar('config_var', default=ConfigFile(working_dir / "config" / "config.toml")) # 配置文件
runtime_var: ContextVar = ContextVar('runtime_var', default=None) # 运行时共享数据
runtime_var: ContextVar = ContextVar('runtime_var', default=dict()) # 运行时共享数据
class ConfigContext:
"""

View File

@@ -1 +1,6 @@
# 音频服务
from heurams.context import config_var
from heurams.providers.audio import players
from typing import Callable
player: Callable = players[config_var.get().get("player_provider")]

View File

@@ -1 +0,0 @@
# 缓存服务

View File

@@ -1 +1,6 @@
# 文本转语音服务
from heurams.context import config_var
from heurams.providers.tts import TTSs
from typing import Callable
convert: Callable = TTSs[config_var.get().get("tts_provider")]

View File

@@ -1,3 +1,4 @@
# 版本控制集成服务
ver = "0.4.0"
ver = "0.4.0"
stage = "prototype"