mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Ensure format supported before captioning
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { getBase64Async, isTrueBoolean, saveBase64AsFile } from '../../utils.js';
|
import { ensureImageFormatSupported, getBase64Async, isTrueBoolean, saveBase64AsFile } from '../../utils.js';
|
||||||
import { getContext, getApiUrl, doExtrasFetch, extension_settings, modules, renderExtensionTemplateAsync } from '../../extensions.js';
|
import { getContext, getApiUrl, doExtrasFetch, extension_settings, modules, renderExtensionTemplateAsync } from '../../extensions.js';
|
||||||
import { callPopup, getRequestHeaders, saveSettingsDebounced, substituteParamsExtended } from '../../../script.js';
|
import { callPopup, getRequestHeaders, saveSettingsDebounced, substituteParamsExtended } from '../../../script.js';
|
||||||
import { getMessageTimeStamp } from '../../RossAscends-mods.js';
|
import { getMessageTimeStamp } from '../../RossAscends-mods.js';
|
||||||
@@ -272,7 +272,7 @@ async function getCaptionForFile(file, prompt, quiet) {
|
|||||||
try {
|
try {
|
||||||
setSpinnerIcon();
|
setSpinnerIcon();
|
||||||
const context = getContext();
|
const context = getContext();
|
||||||
const fileData = await getBase64Async(file);
|
const fileData = await getBase64Async(await ensureImageFormatSupported(file));
|
||||||
const base64Format = fileData.split(',')[0].split(';')[0].split('/')[1];
|
const base64Format = fileData.split(',')[0].split(';')[0].split('/')[1];
|
||||||
const base64Data = fileData.split(',')[1];
|
const base64Data = fileData.split(',')[1];
|
||||||
const { caption } = await doCaptionRequest(base64Data, fileData, prompt);
|
const { caption } = await doCaptionRequest(base64Data, fileData, prompt);
|
||||||
|
Reference in New Issue
Block a user