Gemini inline video (#4078)

* Add inline video attachment support for Gemini 2.5 Pro

* file formatting

* removed redundant function for saving video to message

* removed other redundant function for saving video to message

* Seperate inlining check for video

* Edit video token cost to be a conservative estimate of 10000 tokens

* fixed missing semicolon

* Adds seperate ui toggle for video inlining.

* Move mes_video out of img_container

* Remove title from video element for now

* Better visibilty of video with controls

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
This commit is contained in:
Nikolas Brown
2025-06-01 08:04:16 -04:00
committed by GitHub
parent 3ec9b1a099
commit c4d89b2067
7 changed files with 159 additions and 3 deletions

View File

@@ -211,6 +211,12 @@ export async function populateFileAttachment(message, inputId = 'file_form_input
const imageUrl = await saveBase64AsFile(base64Data, name2, fileNamePrefix, extension);
message.extra.image = imageUrl;
message.extra.inline_image = true;
}
// If file is video
else if (file.type.startsWith('video/')) {
const extension = file.type.split('/')[1];
const videoUrl = await saveBase64AsFile(base64Data, name2, fileNamePrefix, extension);
message.extra.video = videoUrl;
} else {
const uniqueFileName = `${fileNamePrefix}.txt`;
@@ -1240,7 +1246,7 @@ async function openAttachmentManager() {
return () => {
modalButtonData.forEach(p => {
const { popper,bodyListener } = p;
const { popper, bodyListener } = p;
popper.destroy();
document.body.removeEventListener('click', bodyListener);
});