Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usamazbr/embedding image upload #925

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Usamazbr
Copy link

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:

  • key implementation is converting the upload image to base64 string
  • then in api.ts it will add as array inside content field which backend is designed to handle
  • unnecessary update of dompurify package to v3.1.5 (this does not affect or break any functionality)

Contribution Checklist

  • I have built and tested the code locally and in a deployed app
  • For frontend changes, I have pulled the latest code from main, built the frontend, and committed all static files.
  • This is a change for all users of this app. No code or asset is specific to my use case or my organization.
  • I didn't break any existing functionality 😄

@Usamazbr
Copy link
Author

@microsoft-github-policy-service agree

@iseabock
Copy link
Contributor

@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
Copy link
Author

Usamazbr commented Jun 20, 2024

@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
Copy link
Author

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

AZURE_OPENAI_MODEL=gpt-4o

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants