[PR #2271] [MERGED] feat: add ai detection for recipients and fields #2172

Closed
opened 2026-02-26 20:32:44 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/2271
Author: @Mythie
Created: 12/3/2025
Status: Merged
Merged: 12/3/2025
Merged by: @Mythie

Base: mainHead: feat/ai-field-and-recipient-detection


📝 Commits (7)

  • efdf5ae feat: add ai detection for recipients and fields
  • bea7dbf fix: remove excessive use callbacks
  • a563bf7 fix: remove console logs
  • 5983b4b chore: npm audit
  • 2afb1ae fix: implement feedback
  • b966985 fix: more feedback
  • 6b723e1 fix: add patches to dockerfile

📊 Changes

51 files changed (+4201 additions, -67 deletions)

View changed files

📝 .env.example (+10 -1)
📝 .gitignore (+3 -0)
apps/remix/app/components/dialogs/ai-field-detection-dialog.tsx (+368 -0)
apps/remix/app/components/dialogs/ai-recipient-detection-dialog.tsx (+361 -0)
📝 apps/remix/app/components/forms/document-preferences-form.tsx (+61 -2)
apps/remix/app/components/general/animated-document-scanner.tsx (+78 -0)
📝 apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page.tsx (+74 -18)
📝 apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx (+126 -6)
📝 apps/remix/app/components/general/envelope/envelope-drop-zone-wrapper.tsx (+10 -8)
📝 apps/remix/app/components/general/envelope/envelope-upload-button.tsx (+3 -1)
📝 apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.document.tsx (+16 -3)
📝 apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.document.tsx (+16 -1)
apps/remix/server/api/ai/detect-fields.client.ts (+161 -0)
apps/remix/server/api/ai/detect-fields.ts (+150 -0)
apps/remix/server/api/ai/detect-fields.types.ts (+54 -0)
apps/remix/server/api/ai/detect-recipients.client.ts (+160 -0)
apps/remix/server/api/ai/detect-recipients.ts (+148 -0)
apps/remix/server/api/ai/detect-recipients.types.ts (+16 -0)
apps/remix/server/api/ai/route.ts (+9 -0)
📝 apps/remix/server/router.ts (+24 -1)

...and 31 more files

📄 Description

Use Gemini to handle detection of recipients and fields within documents.

Opt in using organisation or team settings.

Replaces #2128 since the branch was cursed and would include dependencies that weren't even in the lock file.

https://github.com/user-attachments/assets/e6cbb58f-62b9-4079-a9ae-7af5c4f2e4ec

Concerns

  • We had to use streaming responses for the requests which means the code is a little bit sloppy.
  • Gemini 3 is incredibly accurate for fields but incurs a latency penalty
  • We may need to request higher rate limits asap.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/documenso/documenso/pull/2271 **Author:** [@Mythie](https://github.com/Mythie) **Created:** 12/3/2025 **Status:** ✅ Merged **Merged:** 12/3/2025 **Merged by:** [@Mythie](https://github.com/Mythie) **Base:** `main` ← **Head:** `feat/ai-field-and-recipient-detection` --- ### 📝 Commits (7) - [`efdf5ae`](https://github.com/documenso/documenso/commit/efdf5ae75006db7df43931070ca24f4deb83bb2c) feat: add ai detection for recipients and fields - [`bea7dbf`](https://github.com/documenso/documenso/commit/bea7dbf32b8fc84d8c23eaf3e9c804ef10e1ef83) fix: remove excessive use callbacks - [`a563bf7`](https://github.com/documenso/documenso/commit/a563bf7177c830c4e60584f707726a281b4f3bc1) fix: remove console logs - [`5983b4b`](https://github.com/documenso/documenso/commit/5983b4bb2576bfe92d35d2a439c807b670e4bd04) chore: npm audit - [`2afb1ae`](https://github.com/documenso/documenso/commit/2afb1aece393c73eb640e746001f064d3c2ca034) fix: implement feedback - [`b966985`](https://github.com/documenso/documenso/commit/b96698555e13f11bd7154656a927a3f65eee1ed4) fix: more feedback - [`6b723e1`](https://github.com/documenso/documenso/commit/6b723e1c357c46755da3cb0d76c7e41b0c8e1edc) fix: add patches to dockerfile ### 📊 Changes **51 files changed** (+4201 additions, -67 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+10 -1) 📝 `.gitignore` (+3 -0) ➕ `apps/remix/app/components/dialogs/ai-field-detection-dialog.tsx` (+368 -0) ➕ `apps/remix/app/components/dialogs/ai-recipient-detection-dialog.tsx` (+361 -0) 📝 `apps/remix/app/components/forms/document-preferences-form.tsx` (+61 -2) ➕ `apps/remix/app/components/general/animated-document-scanner.tsx` (+78 -0) 📝 `apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page.tsx` (+74 -18) 📝 `apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx` (+126 -6) 📝 `apps/remix/app/components/general/envelope/envelope-drop-zone-wrapper.tsx` (+10 -8) 📝 `apps/remix/app/components/general/envelope/envelope-upload-button.tsx` (+3 -1) 📝 `apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.document.tsx` (+16 -3) 📝 `apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.document.tsx` (+16 -1) ➕ `apps/remix/server/api/ai/detect-fields.client.ts` (+161 -0) ➕ `apps/remix/server/api/ai/detect-fields.ts` (+150 -0) ➕ `apps/remix/server/api/ai/detect-fields.types.ts` (+54 -0) ➕ `apps/remix/server/api/ai/detect-recipients.client.ts` (+160 -0) ➕ `apps/remix/server/api/ai/detect-recipients.ts` (+148 -0) ➕ `apps/remix/server/api/ai/detect-recipients.types.ts` (+16 -0) ➕ `apps/remix/server/api/ai/route.ts` (+9 -0) 📝 `apps/remix/server/router.ts` (+24 -1) _...and 31 more files_ </details> ### 📄 Description Use Gemini to handle detection of recipients and fields within documents. Opt in using organisation or team settings. Replaces #2128 since the branch was cursed and would include dependencies that weren't even in the lock file. https://github.com/user-attachments/assets/e6cbb58f-62b9-4079-a9ae-7af5c4f2e4ec ## Concerns - We had to use streaming responses for the requests which means the code is a little bit sloppy. - Gemini 3 is incredibly accurate for fields but incurs a latency penalty - We may need to request higher rate limits asap. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 20:32:44 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#2172
No description provided.