Skip to content

Enable feedback to cosmos DB #1620

@edgBR

Description

@edgBR

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

Requirements

Looking to the typescript models:

image

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:

export const historyMessageFeedback = async (messageId: string, feedback: string): Promise<Response> => {
  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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions