-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ feat: Add Message Feedback with Tag Options #5878
base: main
Are you sure you want to change the base?
Conversation
TODO: - needs some refactoring. - needs some UI animations.
positive
and 'negative'positive
and negative
positive
and negative
positive
and negative
positive
and negative
<div className="min-h-[96px] w-full"> | ||
<div className="relative mt-2 flex w-full flex-col gap-3 rounded-lg border border-token-border-light p-4"> | ||
<div className="flex justify-between items-center"> | ||
<div className="text-sm text-token-text-secondary">Tell us more:</div> |
Check failure
Code scanning / ESLint
disallow literal string Error
<OGDialogTitle className="text-lg font-semibold leading-6 text-token-text-primary"> | ||
Provide additional feedback | ||
</OGDialogTitle> |
Check failure
Code scanning / ESLint
disallow literal string Error
Provide additional feedback
<span className="absolute -top-1 -right-1 flex h-4 w-4 items-center justify-center rounded-full bg-blue-500 text-white text-xs"> | ||
✓ | ||
</span> |
Check failure
Code scanning / ESLint
disallow literal string Error
✓
> | ||
Submit | ||
</button> |
Check failure
Code scanning / ESLint
disallow literal string Error
type="button"
onClick={handleSubmit}
className={cn('btn btn-primary', !selectedTag && 'opacity-50 cursor-not-allowed')}
disabled={!selectedTag}
>
Submit
Nice work. Is the feedback I send stored somewhere? |
@walbercardoso yes this is stored on the message object. |
Summary
This PR introduces an enhanced message feedback system that allows users to rate responses with either a thumbs up or thumbs down. For negative feedback (thumbs down), users can now provide additional context through a set of predefined feedback tags and an optional text comment. This additional feedback helps us better understand and improve our responses.
Closes: #901
Changes Overview
Backend Updates
Message Schema Enhancements:
messageSchema
inapi/models/schema/messageSchema.js
to include a structuredratingContent
object withtags
,tagChoices
, andtext
.New Feedback API Route:
api/server/routes/messages.js
(PUT /:conversationId/:messageId/feedback
) that handles feedback updates.Data Provider & Types:
packages/data-provider/src/api-endpoints.ts
to include a feedback endpoint.packages/data-provider/src/data-service.ts
with anupdateFeedback
function.useUpdateFeedbackMutation
) inpackages/data-provider/src/react-query/react-query-service.ts
.packages/data-provider/src/schemas.ts
) and types (packages/data-provider/src/types.ts
) to reflect the new feedback properties.Frontend Updates
New Feedback UI Component:
FeedbackTagOptions.tsx
to display a list of predefined feedback tags for users to select when providing negative feedback.Enhanced Message Interaction:
HoverButtons.tsx
to include new thumbs up/down icons and to correctly handle feedback submission.MessageRender.tsx
to integrate the feedback component and display a thank-you message once feedback is submitted.SVG Icon Additions:
ThumbUpIcon.tsx
andThumbDownIcon.tsx
for better visual feedback representation.client/src/components/svg/index.ts
for consistent exports.Hook Updates:
useMessageActions
hook to include the new feedback mutation, ensuring the UI reflects feedback changes immediately.Localization & Miscellaneous
client/src/locales/en/translation.json
for positive ("Good response") and negative ("Bad response") feedback messages.Change Type
Testing
Test Configuration:
Backend:
/feedback
API endpoint using Postman to ensure proper handling of feedback submissions, including defaulting tag choices for thumbs-down ratings.Frontend:
FeedbackTagOptions
component renders with predefined tags.General:
Checklist