diff --git a/build_util/make_docs.py b/build_util/make_docs.py index 75dd867aa..e9c42cb32 100644 --- a/build_util/make_docs.py +++ b/build_util/make_docs.py @@ -6,6 +6,7 @@ from voicevox_engine.core.core_initializer import CoreManager from voicevox_engine.dev.core.mock import MockCoreWrapper from voicevox_engine.dev.tts_engine.mock import MockTTSEngine +from voicevox_engine.engine_manifest.EngineManifest import load_manifest from voicevox_engine.preset.PresetManager import PresetManager from voicevox_engine.setting.Setting import USER_SETTING_PATH, SettingHandler from voicevox_engine.tts_pipeline.tts_engine import TTSEngineManager @@ -51,6 +52,7 @@ def generate_api_docs_html(schema: str) -> str: preset_path=engine_root() / "presets.yaml", ), user_dict=UserDictionary(), + engine_manifest=load_manifest(engine_root() / "engine_manifest.json"), ) api_schema = json.dumps(app.openapi()) diff --git a/run.py b/run.py index 5b6364813..41fd04d1d 100644 --- a/run.py +++ b/run.py @@ -14,6 +14,7 @@ from voicevox_engine.app.application import generate_app from voicevox_engine.cancellable_engine import CancellableEngine from voicevox_engine.core.core_initializer import initialize_cores +from voicevox_engine.engine_manifest.EngineManifest import load_manifest from voicevox_engine.preset.PresetManager import PresetManager from voicevox_engine.setting.Setting import ( USER_SETTING_PATH, @@ -322,6 +323,8 @@ def main() -> None: use_dict = UserDictionary() + engine_manifest = load_manifest(engine_root() / "engine_manifest.json") + if arg_disable_mutable_api: disable_mutable_api = True else: @@ -335,6 +338,7 @@ def main() -> None: setting_loader, preset_manager, use_dict, + engine_manifest, cancellable_engine, root_dir, cors_policy_mode, diff --git a/test/e2e/conftest.py b/test/e2e/conftest.py index 0de2bfc2d..af055e1a6 100644 --- a/test/e2e/conftest.py +++ b/test/e2e/conftest.py @@ -8,10 +8,12 @@ from voicevox_engine.app.application import generate_app from voicevox_engine.core.core_initializer import initialize_cores +from voicevox_engine.engine_manifest.EngineManifest import load_manifest from voicevox_engine.preset.PresetManager import PresetManager from voicevox_engine.setting.Setting import SettingHandler from voicevox_engine.tts_pipeline.tts_engine import make_tts_engines_from_cores from voicevox_engine.user_dict.user_dict import UserDictionary +from voicevox_engine.utility.path_utility import engine_root @pytest.fixture() @@ -26,7 +28,9 @@ def app_params(tmp_path: Path) -> dict[str, Any]: preset_path = tmp_path / "presets.yaml" shutil.copyfile(original_preset_path, preset_path) preset_manager = PresetManager(preset_path) + user_dict = UserDictionary() + engine_manifest = load_manifest(engine_root() / "engine_manifest.json") return { "tts_engines": tts_engines, @@ -35,6 +39,7 @@ def app_params(tmp_path: Path) -> dict[str, Any]: "setting_loader": setting_loader, "preset_manager": preset_manager, "user_dict": user_dict, + "engine_manifest": engine_manifest, } diff --git a/voicevox_engine/app/application.py b/voicevox_engine/app/application.py index 235663237..05134a135 100644 --- a/voicevox_engine/app/application.py +++ b/voicevox_engine/app/application.py @@ -17,7 +17,7 @@ from voicevox_engine.app.routers.user_dict import generate_user_dict_router from voicevox_engine.cancellable_engine import CancellableEngine from voicevox_engine.core.core_initializer import CoreManager -from voicevox_engine.engine_manifest.EngineManifest import load_manifest +from voicevox_engine.engine_manifest.EngineManifest import EngineManifest from voicevox_engine.library_manager import LibraryManager from voicevox_engine.metas.MetasStore import MetasStore from voicevox_engine.preset.PresetManager import PresetManager @@ -34,6 +34,7 @@ def generate_app( setting_loader: SettingHandler, preset_manager: PresetManager, user_dict: UserDictionary, + engine_manifest: EngineManifest, cancellable_engine: CancellableEngine | None = None, root_dir: Path | None = None, cors_policy_mode: CorsPolicyMode = CorsPolicyMode.localapps, @@ -44,11 +45,9 @@ def generate_app( if root_dir is None: root_dir = engine_root() - engine_manifest_data = load_manifest(engine_root() / "engine_manifest.json") - app = FastAPI( - title=engine_manifest_data.name, - description=f"{engine_manifest_data.brand_name} の音声合成エンジンです。", + title=engine_manifest.name, + description=f"{engine_manifest.brand_name} の音声合成エンジンです。", version=__version__, ) app = configure_middlewares(app, cors_policy_mode, allow_origin) @@ -58,10 +57,10 @@ def generate_app( library_manager = LibraryManager( get_save_dir() / "installed_libraries", - engine_manifest_data.supported_vvlib_manifest_version, - engine_manifest_data.brand_name, - engine_manifest_data.name, - engine_manifest_data.uuid, + engine_manifest.supported_vvlib_manifest_version, + engine_manifest.brand_name, + engine_manifest.name, + engine_manifest.uuid, ) metas_store = MetasStore(root_dir / "speaker_info") @@ -74,14 +73,12 @@ def generate_app( app.include_router(generate_morphing_router(tts_engines, core_manager, metas_store)) app.include_router(generate_preset_router(preset_manager)) app.include_router(generate_speaker_router(core_manager, metas_store, root_dir)) - if engine_manifest_data.supported_features.manage_library: - app.include_router( - generate_library_router(engine_manifest_data, library_manager) - ) + if engine_manifest.supported_features.manage_library: + app.include_router(generate_library_router(engine_manifest, library_manager)) app.include_router(generate_user_dict_router(user_dict)) - app.include_router(generate_engine_info_router(core_manager, engine_manifest_data)) - app.include_router(generate_setting_router(setting_loader, engine_manifest_data)) - app.include_router(generate_portal_page_router(engine_manifest_data)) + app.include_router(generate_engine_info_router(core_manager, engine_manifest)) + app.include_router(generate_setting_router(setting_loader, engine_manifest)) + app.include_router(generate_portal_page_router(engine_manifest)) app = configure_openapi_schema(app)