Skip to content

Conversation

@BAIKEMARK
Copy link
Owner

This pull request updates the logic in the get_model_filenames_from_db_cached_only function in utils.py to improve the user experience when loading models in the UI. The main change ensures that if the database cache is empty, the function will gracefully fall back to displaying all models found in the relevant folders, rather than returning an empty list.

Model loading logic improvements:

  • Updated the docstring in get_model_filenames_from_db_cached_only to clarify that the function now falls back to showing all models from the folder if the database is empty.
  • Added logic to return all models from folder_paths and print a message if there are no database entries for the requested model_type.

Copilot AI review requested due to automatic review settings October 18, 2025 01:24
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the user experience when the model database cache is empty by implementing a fallback mechanism. Instead of returning an empty list when no database entries exist, the function now returns all models found in the configured folders.

Key Changes:

  • Updated the get_model_filenames_from_db_cached_only function to fallback to folder-based model discovery when the database is empty
  • Added a user-facing message to inform when the fallback is triggered

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

db_relative_paths.append(relative_path)

if not db_relative_paths:
print(f"[Civitai Toolkit] No DB entries for {model_type}, showing all models from folder_paths")
Copy link

Copilot AI Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using a proper logging framework instead of print statements for better log management and configurability. This allows users to control log levels and output destinations.

Copilot uses AI. Check for mistakes.
@BAIKEMARK BAIKEMARK merged commit 9e24f3d into main Oct 18, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants