Skip to content

feat: search similar icons by image#581

Open
dgaponov wants to merge 17 commits intomainfrom
feat/search-icons
Open

feat: search similar icons by image#581
dgaponov wants to merge 17 commits intomainfrom
feat/search-icons

Conversation

@dgaponov
Copy link
Contributor

No description provided.

@dgaponov dgaponov force-pushed the feat/search-icons branch from a302413 to 23f7433 Compare March 7, 2026 19:31
@dgaponov dgaponov changed the title [WIP] feat: search similar icons by image feat: search similar icons by image Mar 7, 2026
dgaponov and others added 17 commits March 8, 2026 20:18
Backend microservice that accepts a base64-encoded image and returns
the most visually similar icons from @gravity-ui/icons using CLIP
embeddings and cosine similarity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use @huggingface/transformers to run CLIP model directly in the
Next.js API route, eliminating the need for a separate Python
FastAPI service at runtime.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Eliminates user-controlled topK parameter to prevent DoS via
unbounded result sizes. Always returns top 10 results.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- API now accepts raw binary body with Content-Type header
- Validates file type (png/jpeg only) and size (max 4MB)
- Client sends File/Blob directly, no base64 conversion
- Uses URL.createObjectURL for preview instead of data URLs
- Properly revokes object URLs to prevent memory leaks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Job-level permissions (pull-requests: write, contents: write)
are sufficient. Top-level write-all violated least privilege.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Return generic error message to client, keep detailed
error logging server-side only to prevent information disclosure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Allows the server to retry initialization on subsequent
requests instead of permanently caching the rejected promise.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prevents accidentally committing model cache, rendered PNGs,
or other artifacts produced during the embedding computation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Was only available as a transitive dependency, which is
fragile and could break on dependency tree changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Eliminates copy-paste of the same function across
icon-search-model.ts, evaluate.ts, and test-examples.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dgaponov dgaponov force-pushed the feat/search-icons branch from d3cbee5 to a29375f Compare March 8, 2026 17:20
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