Cleanup
This commit is contained in:
+6
-17
@@ -1,18 +1,7 @@
|
||||
import tomllib
|
||||
import os
|
||||
from typing import Any, Dict, Union, List
|
||||
from tools.utils import ToolError
|
||||
|
||||
# Paths to config files
|
||||
MODEL_PRESETS_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), "model_presets.toml")
|
||||
RES_PRESETS_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), "resolution_presets.toml")
|
||||
|
||||
def load_toml(path: str) -> Dict[str, Any]:
|
||||
try:
|
||||
with open(path, "rb") as f:
|
||||
return tomllib.load(f)
|
||||
except Exception as e:
|
||||
raise ToolError(f"Failed to load config file {path}: {str(e)}")
|
||||
import requests
|
||||
from typing import Any, Dict, List
|
||||
import config
|
||||
from tools.utils import ToolError, load_toml
|
||||
|
||||
async def handle(args: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"""
|
||||
@@ -20,8 +9,8 @@ async def handle(args: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"""
|
||||
model_name = args.get("model_name")
|
||||
|
||||
models = load_toml(MODEL_PRESETS_PATH)
|
||||
res_presets = load_toml(RES_PRESETS_PATH)
|
||||
models = load_toml(config.MODEL_PRESETS_PATH)
|
||||
res_presets = load_toml(config.RES_PRESETS_PATH)
|
||||
|
||||
if not model_name:
|
||||
# Return a catalog of all models
|
||||
|
||||
Reference in New Issue
Block a user