microsoft / sample-app-aoai-chatGPT

Sample code for a simple web chat experience through Azure OpenAI, including Azure OpenAI On Your Data.
MIT License
1.42k stars 2.13k forks source link

usamazbr/embedding image upload #925

Open Usamazbr opened 2 weeks ago

Usamazbr commented 2 weeks ago

Motivation and Context

The current frontend functionality of this app limits users to uploading text only. However, the backend API and server are fully capable of integrating images with text. Implementing image uploads on the frontend would provide users with the extra option to enrich their content with visuals.

Description

In this pull request, I've made changes to Chat.tsx, QuestionInput.tsx and api.ts along with few changes in respective CSS files and model.ts, all this ensuring no break in dom elements. In order to facilitate image upload functionality. Here's a more detailed breakdown of my approach:

Contribution Checklist

Usamazbr commented 2 weeks ago

@microsoft-github-policy-service agree

iseabock commented 1 week ago

@Usamazbr I have pulled your branch, but I'm currently not able to get it to work. When I attach an image in the chat I get a 400:

Error code: 400 - {'error': {'requestid': '40d557bd-06b3-45e9-a1cd-1e66e07e1b7c', 'code': 400, 'message': 'Invalid chat message detected: message content must be string'}}

Am I missing something needed for this to work?

Usamazbr commented 1 week ago

@Usamazbr I have pulled your branch, but I'm currently not able to get it to work. When I attach an image in the chat I get a 400:

Error code: 400 - {'error': {'requestid': '40d557bd-06b3-45e9-a1cd-1e66e07e1b7c', 'code': 400, 'message': 'Invalid chat message detected: message content must be string'}}

Am I missing something needed for this to work?

Since it is working fine on my end, I suspect I'm using gpt-4o instead of 3.5, could be the problem. And there are no such validators on backend side since content can either be string or an array of different types of contents.

image

Usamazbr commented 1 week ago

@iseabock Have you tried using gpt-4o for this to run?

AZURE_OPENAI_MODEL=gpt-4o