Skip to content

Commit bdec072

Browse files
committed
修复:空路径显示
1 parent ef14526 commit bdec072

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

model_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ModelManager:
3939
def __init__(self, config_file="config.json"):
4040
self.config_file = config_file
4141
self.config = self.load_config()
42-
self.models_path = Path(self.config.get("models_path", ""))
42+
self.models_path = Path(self.config.get("models_path", "")) if self.config.get("models_path") else None
4343
self.api_base_url = "https://civitai.com/api/v1"
4444
self.models_info: Dict[str, Any] = {}
4545
self.images_path = Path("static/images") # 添加图片保存路径
@@ -304,7 +304,7 @@ async def scan_models_endpoint():
304304
async def get_config():
305305
"""获取当前配置"""
306306
return {
307-
"models_path": str(manager.models_path),
307+
"models_path": str(manager.models_path) if manager.models_path else "",
308308
"is_path_valid": os.path.exists(manager.models_path) if manager.models_path else False
309309
}
310310

templates/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@
5555
<div class="row mb-4">
5656
<div class="col">
5757
<div class="mb-3">
58-
<label for="pathInput" class="form-label">选择模型目录</label>
5958
<div class="input-group">
60-
<input type="text" class="form-control" id="pathInput" readonly placeholder="请选择模型目录">
59+
<input type="text" class="form-control text-muted" id="pathInput" readonly placeholder="请选择模型目录">
6160
<button class="btn btn-outline-secondary" id="selectPath" type="button">
6261
<i class="bi bi-folder2-open"></i> 浏览
6362
</button>

0 commit comments

Comments
 (0)