SimpleChatTCRV:InputFileDialog:AcceptList:Images:Jpeg and Png

Allow passing the accept list for file type input element helper.

Inturn given that currently it is used for the image selection
for vision models, set it to jpeg and png in the caller for the
same.
This commit is contained in:
hanishkvc 2025-11-12 05:17:29 +05:30
parent ca8e6ab1a6
commit 18b94482c5
2 changed files with 7 additions and 4 deletions

View File

@ -992,7 +992,7 @@ class MultiChatUI {
// Save any placeholder set by default like through html, to restore where needed // Save any placeholder set by default like through html, to restore where needed
this.elInUser.dataset.placeholder = this.elInUser.placeholder this.elInUser.dataset.placeholder = this.elInUser.placeholder
// Setup Image loading button and flow // Setup Image loading button and flow
this.elInFileX = ui.el_creatediv_inputfileimgbtn('image', 'image', '', ()=>{ this.elInFileX = ui.el_creatediv_inputfileimgbtn('image', 'image', '', ".jpg, .jpeg, .png", ()=>{
let f0 = this.elInFileX.el.files?.item(0); let f0 = this.elInFileX.el.files?.item(0);
if (!f0) { if (!f0) {
return return

View File

@ -242,12 +242,14 @@ export function el_creatediv_input(id, label, type, defaultValue, cb, className=
* @param {string} id * @param {string} id
* @param {string} label * @param {string} label
* @param {any} defaultValue * @param {any} defaultValue
* @param {string} acceptable
* @param {(arg0: any) => void} cb * @param {(arg0: any) => void} cb
* @param {string} className * @param {string} className
*/ */
export function el_creatediv_inputfilebtn(id, label, defaultValue, cb, className) { export function el_creatediv_inputfilebtn(id, label, defaultValue, acceptable, cb, className) {
let elX = el_creatediv_input(id, label, "file", defaultValue, cb, className) let elX = el_creatediv_input(id, label, "file", defaultValue, cb, className)
elX.el.hidden = true elX.el.hidden = true
elX.el.accept = acceptable
let idB = `${id}-button` let idB = `${id}-button`
let elB = el_create_button(idB, (mev) => { let elB = el_create_button(idB, (mev) => {
elX.el.click() elX.el.click()
@ -262,11 +264,12 @@ export function el_creatediv_inputfilebtn(id, label, defaultValue, cb, className
* @param {string} id * @param {string} id
* @param {string} label * @param {string} label
* @param {any} defaultValue * @param {any} defaultValue
* @param {string} acceptable
* @param {(arg0: any) => void} cb * @param {(arg0: any) => void} cb
* @param {string} className * @param {string} className
*/ */
export function el_creatediv_inputfileimgbtn(id, label, defaultValue, cb, className) { export function el_creatediv_inputfileimgbtn(id, label, defaultValue, acceptable, cb, className) {
let elX = el_creatediv_inputfilebtn(id, label, defaultValue, cb, className); let elX = el_creatediv_inputfilebtn(id, label, defaultValue, acceptable, cb, className);
let elImg = document.createElement('img') let elImg = document.createElement('img')
elImg.classList.add(`${className}-img`) elImg.classList.add(`${className}-img`)
elX.elB.appendChild(elImg) elX.elB.appendChild(elImg)