Azure-Samples / Azure-Samples/chat-with-your-data-solution-accelerator
Enable feedback to cosmos DB
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 648
- Avg merge
- 1d 30m
- Merged PRs (30d)
- 9
Description
# Motivation
Hi,
In order to enable post production deployment metrics it would be very nice to have the ability to collect feedback as in:
https://github.com/microsoft/sample-app-aoai-chatGPT/tree/main
# How would you feel if this feature request was implemented?

# Requirements
Looking to the typescript models:

Seems that this has been already taken care partially.
# Tasks
I have 0 experience with vite, javascript, typescript etc...
However it seems that adding to this file:
https://github.com/Azure-Samples/chat-with-your-data-solution-accelerator/blob/main/code/frontend/src/api/api.ts
Something similar to this:
```{javascript}
export const historyMessageFeedback = async (messageId: string, feedback: string): Promise => {
const response = await fetch('/history/message_feedback', {
method: 'POST',
body: JSON.stringify({
message_id: messageId,
message_feedback: feedback
}),
headers: {
'Content-Type': 'application/json'
}
})
.then(res => {
return res
})
.catch(_err => {
console.error('There was an issue logging feedback.')
const errRes: Response = {
...new Response(),
ok: false,
status: 500
}
return errRes
})
return response
}
```
Modifying this file: https://github.com/Azure-Samples/chat-with-your-data-solution-accelerator/blob/main/code/frontend/src/components/Answer/Answer.tsx
To add the feedback components from here:
https://github.com/microsoft/sample-app-aoai-chatGPT/blob/main/frontend/src/components/Answer/Answer.tsx
And finally adapt this code:
https://github.com/Azure-Samples/chat-with-your-data-solution-accelerator/blob/main/code/frontend/src/pages/chat/Chat.tsx
Should be a great start.
Contributor guide
Assessment
This issue has not been assessed yet.