fix: base64 image (#3238)

* fix: base64 image

* perf: quote qa
This commit is contained in:
Archer
2024-11-26 13:28:51 +08:00
committed by GitHub
parent cf1a90c596
commit a75036b626
5 changed files with 51 additions and 34 deletions

View File

@@ -118,6 +118,11 @@ export const loadRequestMessages = async ({
return item.image_url.url;
})();
// base64 image
if (imgUrl.startsWith('data:image/')) {
return item;
}
try {
// If imgUrl is a local path, load image from local, and set url to base64
if (imgUrl.startsWith('/')) {

View File

@@ -129,7 +129,11 @@ export const valueTypeFormat = (value: any, type?: WorkflowIOValueTypeEnum) => {
return value;
};
export const checkQuoteQAValue = (quoteQA: SearchDataResponseItemType[] = []) => {
export const checkQuoteQAValue = (quoteQA?: SearchDataResponseItemType[]) => {
if (!quoteQA) return undefined;
if (quoteQA.length === 0) {
return [];
}
if (quoteQA.some((item) => !item.q || !item.datasetId)) {
return undefined;
}