mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2025-12-26 06:28:56 +08:00
fix
This commit is contained in:
parent
4810393923
commit
2b3004c80e
@ -116,7 +116,6 @@ export const processImage = async (url: string, tracker: TokenTracker): Promise<
|
||||
|
||||
const canvas = fitImageToSquareBox(img, 256);
|
||||
const base64Data = (await canvasToDataUrl(canvas)).split(',')[1];
|
||||
img.src = ''; // Clear the image source to free memory
|
||||
|
||||
const { embeddings } = await getEmbeddings([{ image: base64Data }], tracker, {
|
||||
dimensions: 512,
|
||||
|
||||
@ -572,9 +572,8 @@ export async function processURLs(
|
||||
// Process images
|
||||
if (withImages && data.images) {
|
||||
const imageEntries = Object.entries(data.images || {});
|
||||
let imageObject: any;
|
||||
imageEntries.forEach(async ([alt, url]) => {
|
||||
imageObject = await processImage(url, context.tokenTracker);
|
||||
const imageObject = await processImage(url, context.tokenTracker);
|
||||
if (imageObject && !imageObjects.find(i => i.url === imageObject.url)) {
|
||||
imageObjects.push(imageObject);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user