mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2025-12-25 22:16:49 +08:00
fix empty input handling in embeddings
This commit is contained in:
parent
582292ac4b
commit
a4cb9139ed
@ -26,7 +26,7 @@ export async function getEmbeddings(
|
||||
}
|
||||
|
||||
// Handle empty input case
|
||||
if (texts.length === 0 || texts.every(text => !text || (typeof text === 'object' && !Object.values(text)?.[0]))) {
|
||||
if (texts.length === 0 || texts.every(text => (typeof text === 'object' && !Object.values(text)?.[0]?.trim() || typeof text === 'string' && !text.trim()))) {
|
||||
return { embeddings: [], tokens: 0 };
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user