Add a new model path to the configuration.
(self, path: str)
| 240 | return [Path(DEFAULT_MODELS_DIR)] |
| 241 | |
| 242 | def add_model_path(self, path: str) -> None: |
| 243 | """Add a new model path to the configuration.""" |
| 244 | models_config = self.get("paths.models", DEFAULT_MODELS_DIR) |
| 245 | |
| 246 | # Convert to list if it's a string |
| 247 | if isinstance(models_config, str): |
| 248 | paths = [models_config] |
| 249 | elif isinstance(models_config, list): |
| 250 | paths = list(models_config) |
| 251 | else: |
| 252 | paths = [] |
| 253 | |
| 254 | # Add new path if not already present |
| 255 | if path not in paths: |
| 256 | paths.append(path) |
| 257 | self.set("paths.models", paths) |
| 258 | |
| 259 | def remove_model_path(self, path: str) -> bool: |
| 260 | """Remove a model path from the configuration. |