Commit 9f01de41 authored by Your Name's avatar Your Name

Fix model listing: remove duplicate 'image', remove vision: alias, filter URLs

- Remove duplicate 'image' entry in list_models()
- Remove vision: alias (user doesn't want it)
- Skip URLs in loaded models listing (they're download sources)
- Add full traceback to diffusers error for debugging
parent 57a7951b
...@@ -2725,7 +2725,6 @@ class MultiModelManager: ...@@ -2725,7 +2725,6 @@ class MultiModelManager:
# Add vision/image models # Add vision/image models
if self.image_models: if self.image_models:
models.append(ModelInfo(id="image")) # Alias for first image model models.append(ModelInfo(id="image")) # Alias for first image model
models.append(ModelInfo(id="image")) # Alias for first image model
# Add all image models - convert URLs to cached paths for display # Add all image models - convert URLs to cached paths for display
for image_id in self.image_models: for image_id in self.image_models:
# Check if image_id is a URL and try to get cached path # Check if image_id is a URL and try to get cached path
...@@ -2736,7 +2735,6 @@ class MultiModelManager: ...@@ -2736,7 +2735,6 @@ class MultiModelManager:
# Use the filename from cached path for display # Use the filename from cached path for display
display_id = os.path.basename(cached_path) display_id = os.path.basename(cached_path)
models.append(ModelInfo(id=f"image:{display_id}")) models.append(ModelInfo(id=f"image:{display_id}"))
models.append(ModelInfo(id=f"vision:{display_id}"))
# Add loaded models that aren't in the above categories # Add loaded models that aren't in the above categories
for key in self.models: for key in self.models:
...@@ -2746,6 +2744,9 @@ class MultiModelManager: ...@@ -2746,6 +2744,9 @@ class MultiModelManager:
# Skip short names (already added) # Skip short names (already added)
if self.default_model and key == self.default_model.split("/")[-1]: if self.default_model and key == self.default_model.split("/")[-1]:
continue continue
# Skip URLs - they are download sources, not model identifiers
if key.startswith("http://") or key.startswith("https://"):
continue
models.append(ModelInfo(id=key)) models.append(ModelInfo(id=key))
# Add custom model aliases # Add custom model aliases
...@@ -3818,8 +3819,11 @@ async def create_image_generation(request: ImageGenerationRequest, http_request: ...@@ -3818,8 +3819,11 @@ async def create_image_generation(request: ImageGenerationRequest, http_request:
print(f"diffusers not available: {diffusers_error}, trying stable-diffusion-cpp-python...") print(f"diffusers not available: {diffusers_error}, trying stable-diffusion-cpp-python...")
except Exception as e: except Exception as e:
# Other error with diffusers - record and try sd.cpp # Other error with diffusers - record and try sd.cpp
import traceback
diffusers_error = str(e) diffusers_error = str(e)
print(f"diffusers error: {diffusers_error}, trying stable-diffusion-cpp-python...") print(f"diffusers error: {diffusers_error}")
print(f"Traceback: {traceback.format_exc()}")
print(f"Trying stable-diffusion-cpp-python...")
# Try stable-diffusion-cpp-python (sd.cpp) as fallback # Try stable-diffusion-cpp-python (sd.cpp) as fallback
# First, check all available image models to find one loaded via sd.cpp # First, check all available image models to find one loaded via sd.cpp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment