Local test sub#15
Open
lwx270901 wants to merge 5 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds end-to-end “user feedback” flows for mail analysis: client UI to collect feedback/corrections and server-side TRPC handlers that optionally re-run OpenAI analysis and persist updated results back into the DB.
Changes:
- Added TRPC mutations for submitting general feedback and for regenerating classification/action suggestions from user feedback (OpenAI + DB updates).
- Updated the mail display UI to submit priority-score corrections, collect action-suggestion feedback via a dialog, and provide a “move to label” submenu.
- Wired the feedback settings page to send feedback via TRPC with pending/error states.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| apps/server/src/trpc/routes/mail.ts | Adds feedback-related TRPC mutations, including OpenAI-backed regeneration and DB persistence of refreshed analysis. |
| apps/mail/components/mail/mail-display.tsx | Adds UI/UX to submit LLM feedback (priority + action) and label moves, plus local overrides for refreshed results. |
| apps/mail/app/(routes)/mail/feedback/page.tsx | Implements actual feedback submission via TRPC with toast notifications and loading state. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| timestamp: new Date().toISOString(), | ||
| }; | ||
|
|
||
| console.info('[feedback] received', feedbackEvent); |
Comment on lines
+101
to
+106
| z.object({ | ||
| threadId: z.string().min(1), | ||
| messageId: z.string().min(1), | ||
| correctedPriority: z.enum(['low', 'high']), | ||
| currentPriorityScore: z.number().min(0).max(100).optional(), | ||
| }), |
Comment on lines
+313
to
+317
| await db | ||
| .update(emailTable) | ||
| .set({ | ||
| categoryId: matchedCategory?.categoryId ?? null, | ||
| priorityScore: normalizedScore, |
Comment on lines
+569
to
+574
| await db | ||
| .update(emailTable) | ||
| .set({ | ||
| categoryId: matchedCategory?.categoryId ?? null, | ||
| priorityScore: normalizedScore, | ||
| }) |
Comment on lines
+1378
to
+1381
| <p className="text-muted-foreground text-sm"> | ||
| Provide feedback for this email and we will update the prompt, resend to OpenAI, | ||
| and refresh the analysis result. | ||
| </p> |
| @@ -18,12 +21,28 @@ export async function clientLoader({ request }: Route.ClientLoaderArgs) { | |||
| } | |||
|
|
|||
| export default function FeedbackPage() { | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
READ CAREFULLY THEN REMOVE
Remove bullet points that are not relevant.
PLEASE REFRAIN FROM USING AI TO WRITE YOUR CODE AND PR DESCRIPTION. IF YOU DO USE AI TO WRITE YOUR CODE PLEASE PROVIDE A DESCRIPTION AND REVIEW IT CAREFULLY. MAKE SURE YOU UNDERSTAND THE CODE YOU ARE SUBMITTING USING AI.
Description
Please provide a clear description of your changes.
Type of Change
Please delete options that are not relevant.
Areas Affected
Please check all that apply:
Testing Done
Describe the tests you've done:
Security Considerations
For changes involving data or authentication:
Checklist
Additional Notes
Add any other context about the pull request here.
Screenshots/Recordings
Add screenshots or recordings here if applicable.
By submitting this pull request, I confirm that my contribution is made under the terms of the project's license.