This commit is contained in:
Cohee 2024-05-18 18:58:25 +03:00
parent 4219468e20
commit b93131ec7a
1 changed files with 3 additions and 3 deletions

View File

@ -1021,10 +1021,10 @@ function parseLlmResponse(emotionResponse, labels) {
return parsedEmotion?.emotion ?? fallbackExpression;
} catch {
const fuse = new Fuse(labels, { includeScore: true });
console.debug("Using fuzzy search in labels: " + labels.join(', '))
console.debug('Using fuzzy search in labels:', labels);
const result = fuse.search(emotionResponse);
if (result.length > 0) {
console.debug("fuzzy search found: " + result[0].item + " as closest for the LLM response: " + emotionResponse)
console.debug(`fuzzy search found: ${result[0].item} as closest for the LLM response:`, emotionResponse);
return result[0].item;
}
}