useFeedback
useFeedback(options: UseFeedbackOptions): UseFeedbackResult
The useFeedback() hook makes it easy to attach feedback to a message.
Basic example
Hook API
UseFeedbackOptions
| Prop | Type | Description |
|---|---|---|
| feedbackOptions | Omit<SubmitFeedbackOptions, 'signal'> | Enable and configure feedback functionality |
| projectKey | string | Markprompt project key |
| apiUrl | string | The base API URL |
UseFeedbackResult
| Prop | Type | Description |
|---|---|---|
| abort | () => void | Abort any pending feedback submission |
| submitFeedback | ( feedback: PromptFeedback, messageId?: string, ) => Promise<void> | Submit feedback for the current message |
| submitThreadCSAT | (threadId: string, csat: CSAT) => Promise<void> | Submit CSAT for a thread |
| submitThreadCSATReason | (threadId: string, reason: string) => Promise<void> | Submit CSAT reason for a thread |