Skip to content

Conversation

@tushar1977
Copy link
Contributor

@tushar1977 tushar1977 commented Sep 23, 2025

This PR implements a new API route to search a tagged face and deleting the old file of routes/facetagging.py

Summary by CodeRabbit

  • New Features
    • Face Search: Upload a photo to find similar faces in your library. Results display in the gallery, with a streamlined search bar and dialog.
  • Refactor
    • Media viewer and gallery updated to render from provided image lists, enabling seamless display of search results.
  • Documentation
    • API docs updated with a new face search endpoint.
  • Chores
    • Removed issue templates, release-drafter config, and multiple CI/CD workflows.
    • Cleared .gitignore entries across repositories.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 23, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Removes multiple GitHub templates/workflows and .gitignore entries. Adds backend face search: config constant, DB embeddings fetch, updated detector signature, and a new POST /face-clusters/face-search route with models. Updates OpenAPI. Frontend adds search slice, API call, dialog, hook, and integrates search results into Home and MediaView (prop change).

Changes

Cohort / File(s) Summary
Issue templates removed
.github/ISSUE_TEMPLATE/bug.yml, .github/ISSUE_TEMPLATE/documentation.yml, .github/ISSUE_TEMPLATE/feature.yml
Deleted bug, documentation, and feature GitHub issue templates.
CI/CD workflows removed
.github/workflows/build-and-release.yml, .github/workflows/docs-deploy.yml, .github/workflows/pr-check-build.yml, .github/workflows/pr-check-tests.yml, .github/workflows/update-project-structure.yml, .github/workflows/update-release-drafter.yml
Deleted build/release, docs deploy, PR checks, project structure, and release-drafter workflows.
Release drafter config removed
.github/release-drafter-config.yml
Deleted release-drafter configuration.
Gitignore removals
.gitignore, sync-microservice/.gitignore
Emptied ignore files, removing all ignore patterns.
Backend config
backend/app/config/settings.py
Added constant CONFIDENCE_PERCENT = 0.6.
Database embeddings retrieval
backend/app/database/faces.py
Added get_all_face_embeddings() to return embeddings with image metadata and tags.
Face detector update
backend/app/models/FaceDetector.py
Updated detect_faces(image_id: str, image_path: str, forSearch: bool=False); returns None on load failure; conditionally persists embeddings when not forSearch.
Face search route and models
backend/app/routes/face_clusters.py
Added POST /face-search; introduced BoundingBox, ImageData, GetAllImagesResponse; integrates FaceDetector/FaceNet, threshold, cosine similarity, and DB embeddings.
Legacy routes removed
backend/app/routes/facetagging.py
Removed endpoints: /match, /clusters, /related-images.
Backend schemas
backend/app/schemas/images.py
Added AddSingleImageRequest and FaceTaggingResponse.
OpenAPI docs
docs/backend/backend_python/openapi.json
Documented new POST /face-clusters/face-search; added AddSingleImageRequest schema.
Frontend API
frontend/src/api/apiEndpoints.ts, frontend/src/api/api-functions/face_clusters.ts
Added endpoint searchForFaces and fetchSearchedFaces(request) with FetchSearchedFacesRequest.
Frontend state/store
frontend/src/features/searchSlice.ts, frontend/src/app/store.ts
Added search slice (startSearch, setResults, clearSearch); wired into store under search.
UI components
frontend/src/components/Dialog/FaceSearchDialog.tsx
New dialog to select image and trigger face search; dispatches search actions and handles results/errors.
Media viewer prop change
frontend/src/components/Media/MediaView.tsx, frontend/src/types/Media.ts
MediaView now requires images: Image[] prop; derives current image and totals from prop.
Navbar integration
frontend/src/components/Navigation/Navbar/Navbar.tsx
Replaced legacy dialog UI; integrated FaceSearchDialog and search state (query image display and clear action).
Hook
frontend/src/hooks/selectFile.ts
Added useFile hook to pick a single image file via Tauri dialog.
Pages updated
frontend/src/pages/Home/Home.tsx, frontend/src/pages/AITagging/AITagging.tsx
Home: search-aware data flow, displays search results, passes images to MediaView. AITagging: passes taggedImages to MediaView.
Selectors minor refactor
frontend/src/features/imageSelectors.ts
Refactored selectImages to block body; no behavior change.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant N as Navbar / FaceSearchDialog
  participant FE as Frontend API
  participant BE as /face-clusters/face-search
  participant FD as FaceDetector
  participant FN as FaceNet
  participant DB as DB (faces+images)

  U->>N: Open Face Search dialog and pick image path
  N->>FE: fetchSearchedFaces({ path })
  FE->>BE: POST /face-search (path)
  BE->>FD: detect_faces(image_id, path, forSearch=true)
  FD->>FN: Generate embedding(s)
  FD-->>BE: First face embedding or none
  BE->>DB: get_all_face_embeddings()
  DB-->>BE: Stored embeddings + metadata
  BE->>BE: Cosine similarity vs threshold
  BE-->>FE: 200 OK { data: matching images }
  FE-->>N: Results
  N->>N: Dispatch setResults / clearSearch
  Note over N,U: UI updates to show results grid in Home/MediaView
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

enhancement

Poem

I twitched my nose, then clicked “Search Face” — hop!
From pixels to vectors, I bounce and I bop.
Backend hums softly, cosine in place,
Results in a basket, a gallery of grace.
CI clouds drift off; new trails I trace.
Boop-beep, bunny logs: “Match found!” 🐇✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3779796 and 4a4032f.

⛔ Files ignored due to path filters (1)
  • frontend/public/photo.png is excluded by !**/*.png
📒 Files selected for processing (31)
  • .github/ISSUE_TEMPLATE/bug.yml (0 hunks)
  • .github/ISSUE_TEMPLATE/documentation.yml (0 hunks)
  • .github/ISSUE_TEMPLATE/feature.yml (0 hunks)
  • .github/release-drafter-config.yml (0 hunks)
  • .github/workflows/build-and-release.yml (0 hunks)
  • .github/workflows/docs-deploy.yml (0 hunks)
  • .github/workflows/pr-check-build.yml (0 hunks)
  • .github/workflows/pr-check-tests.yml (0 hunks)
  • .github/workflows/update-project-structure.yml (0 hunks)
  • .github/workflows/update-release-drafter.yml (0 hunks)
  • .gitignore (0 hunks)
  • backend/app/config/settings.py (1 hunks)
  • backend/app/database/faces.py (1 hunks)
  • backend/app/models/FaceDetector.py (2 hunks)
  • backend/app/routes/face_clusters.py (3 hunks)
  • backend/app/routes/facetagging.py (0 hunks)
  • backend/app/schemas/images.py (2 hunks)
  • docs/backend/backend_python/openapi.json (2 hunks)
  • frontend/src/api/api-functions/face_clusters.ts (2 hunks)
  • frontend/src/api/apiEndpoints.ts (1 hunks)
  • frontend/src/app/store.ts (2 hunks)
  • frontend/src/components/Dialog/FaceSearchDialog.tsx (1 hunks)
  • frontend/src/components/Media/MediaView.tsx (2 hunks)
  • frontend/src/components/Navigation/Navbar/Navbar.tsx (1 hunks)
  • frontend/src/features/imageSelectors.ts (1 hunks)
  • frontend/src/features/searchSlice.ts (1 hunks)
  • frontend/src/hooks/selectFile.ts (1 hunks)
  • frontend/src/pages/AITagging/AITagging.tsx (1 hunks)
  • frontend/src/pages/Home/Home.tsx (2 hunks)
  • frontend/src/types/Media.ts (1 hunks)
  • sync-microservice/.gitignore (0 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tushar1977 tushar1977 closed this Sep 23, 2025
@tushar1977 tushar1977 deleted the tushar branch September 23, 2025 12:57
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.

1 participant