Azure-Samples / Azure-Samples/chat-with-your-data-solution-accelerator

Enable feedback to cosmos DB

Open
#1,620 5 comments 0 reactions 0 assignees View on GitHub
enhancement
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?

![image](https://i.giphy.com/hXDrTueJWAscK3xWQ2.webp)

# Requirements

Looking to the typescript models:

![image](https://github.com/user-attachments/assets/25b00404-c443-42b3-b010-71a2c01d80fd)

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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.