Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

整理: 設定にモデルモジュールを追加 #1345

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build_util/make_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from voicevox_engine.dev.tts_engine.mock import MockTTSEngine
from voicevox_engine.engine_manifest import load_manifest
from voicevox_engine.preset.Preset import PresetManager
from voicevox_engine.setting.Setting import USER_SETTING_PATH, SettingHandler
from voicevox_engine.setting.setting_manager import USER_SETTING_PATH, SettingHandler
from voicevox_engine.tts_pipeline.tts_engine import TTSEngineManager
from voicevox_engine.user_dict.user_dict import UserDictionary
from voicevox_engine.utility.path_utility import engine_manifest_path, engine_root
Expand Down
7 changes: 2 additions & 5 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@
from voicevox_engine.core.core_initializer import initialize_cores
from voicevox_engine.engine_manifest import load_manifest
from voicevox_engine.preset.Preset import PresetManager
from voicevox_engine.setting.Setting import (
USER_SETTING_PATH,
CorsPolicyMode,
SettingHandler,
)
from voicevox_engine.setting.model import CorsPolicyMode
from voicevox_engine.setting.setting_manager import USER_SETTING_PATH, 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_manifest_path, engine_root
Expand Down
2 changes: 1 addition & 1 deletion test/benchmark/engine_preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from voicevox_engine.core.core_initializer import initialize_cores
from voicevox_engine.engine_manifest import load_manifest
from voicevox_engine.preset.PresetManager import PresetManager
from voicevox_engine.setting.Setting import SettingHandler
from voicevox_engine.setting.setting_manager 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.core_version_utility import get_latest_version
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from voicevox_engine.core.core_initializer import initialize_cores
from voicevox_engine.engine_manifest import load_manifest
from voicevox_engine.preset.Preset import PresetManager
from voicevox_engine.setting.Setting import SettingHandler
from voicevox_engine.setting.setting_manager 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_manifest_path
Expand Down
3 changes: 2 additions & 1 deletion test/setting/test_setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import pytest
from pydantic import ValidationError

from voicevox_engine.setting.Setting import CorsPolicyMode, Setting, SettingHandler
from voicevox_engine.setting.model import CorsPolicyMode
from voicevox_engine.setting.setting_manager import Setting, SettingHandler


def test_setting_handler_load_not_exist_file() -> None:
Expand Down
3 changes: 2 additions & 1 deletion voicevox_engine/app/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
from voicevox_engine.library_manager import LibraryManager
from voicevox_engine.metas.MetasStore import MetasStore
from voicevox_engine.preset.Preset import PresetManager
from voicevox_engine.setting.Setting import CorsPolicyMode, SettingHandler
from voicevox_engine.setting.model import CorsPolicyMode
from voicevox_engine.setting.setting_manager import SettingHandler
from voicevox_engine.tts_pipeline.tts_engine import TTSEngineManager
from voicevox_engine.user_dict.user_dict import UserDictionary
from voicevox_engine.utility.path_utility import engine_root, get_save_dir
Expand Down
2 changes: 1 addition & 1 deletion voicevox_engine/app/middlewares.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from fastapi.responses import JSONResponse
from starlette.middleware.errors import ServerErrorMiddleware

from voicevox_engine.setting.Setting import CorsPolicyMode
from voicevox_engine.setting.model import CorsPolicyMode


def configure_middlewares(
Expand Down
3 changes: 2 additions & 1 deletion voicevox_engine/app/routers/setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from fastapi.templating import Jinja2Templates

from voicevox_engine.engine_manifest import BrandName
from voicevox_engine.setting.Setting import CorsPolicyMode, Setting, SettingHandler
from voicevox_engine.setting.model import CorsPolicyMode
from voicevox_engine.setting.setting_manager import Setting, SettingHandler
from voicevox_engine.utility.path_utility import resource_root

from ..dependencies import check_disabled_mutable_api
Expand Down
15 changes: 15 additions & 0 deletions voicevox_engine/setting/model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
エンジン設定機能に関して API と ENGINE 内部実装が共有するモデル
「API と ENGINE 内部実装が共有するモデル」については `voicevox_engine/model.py` の module docstring を確認すること。
"""

from enum import Enum


class CorsPolicyMode(str, Enum):
"""
CORSの許可モード
"""

all = "all" # 全てのオリジンからのリクエストを許可
localapps = "localapps" # ローカルアプリケーションからのリクエストを許可
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,7 @@
from pydantic import BaseModel, Field

from ..utility.path_utility import get_save_dir


class CorsPolicyMode(str, Enum):
"""
CORSの許可モード
"""

all = "all" # 全てのオリジンからのリクエストを許可
localapps = "localapps" # ローカルアプリケーションからのリクエストを許可
from .model import CorsPolicyMode


class Setting(BaseModel):
Expand Down