Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 9, 2026

Applied code review feedback from PR #356. Fire detection logic was checking backend == "auto" but _get_detection_backend() only returns "local", "huggingface", or None, causing fire detection to be skipped when local backend was selected even with HF fallback available.

Changes:

  • Fixed backend condition to backend == "huggingface" or (backend == "local" and ENABLE_HF_FALLBACK) to properly enable HF fallback from local mode
  • Removed 15 lines of unnecessary type branching since detect_fire_clip consistently returns List[Dict]
# Before: checked for "auto" that never occurs, complex type handling
if backend == "huggingface" or backend == "auto":
    result = await detect_fire_clip(image)
    if isinstance(result, list): return result
    if isinstance(result, dict) and "detections" in result: ...
    # 10+ more lines of branching

# After: correct backend check, direct return
if backend == "huggingface" or (backend == "local" and ENABLE_HF_FALLBACK):
    if await self._check_hf_available():
        return await detect_fire_clip(image)

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


Summary by cubic

Fixes SPA navigation glitches and corrects fire detection backend selection with HF fallback. Streamlines backend flow to make page transitions smooth and reduce server work.

  • Bug Fixes

    • Keep navigation client-side and fix back/forward + active state for nested routes.
    • Use HF for fire detection when selected or when local with fallback; handle unavailable backends gracefully.
  • Refactors

    • Consolidated handlers with early returns; batched common DB reads to cut redundant queries.
    • Simplified detect_fire to return List[Dict] directly from detect_fire_clip.

Written for commit 8b8d281. Summary will update on new commits.

Co-authored-by: RohanExploit <178623867+RohanExploit@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix frontend navigation issues and optimize backend logic Fix fire detection backend selection and simplify return type handling Feb 9, 2026
Copilot AI requested a review from RohanExploit February 9, 2026 08:13
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