Throw if couldn't classify

This commit is contained in:
Cohee
2024-04-14 20:02:34 +03:00
parent 0ff5d0b5f1
commit f5955bdd37

View File

@ -1006,7 +1006,6 @@ function parseLlmResponse(emotionResponse, labels) {
try { try {
const parsedEmotion = JSON.parse(emotionResponse); const parsedEmotion = JSON.parse(emotionResponse);
return parsedEmotion?.emotion ?? fallbackExpression; return parsedEmotion?.emotion ?? fallbackExpression;
} catch { } catch {
const fuse = new Fuse([emotionResponse]); const fuse = new Fuse([emotionResponse]);
for (const label of labels) { for (const label of labels) {
@ -1017,7 +1016,7 @@ function parseLlmResponse(emotionResponse, labels) {
} }
} }
return fallbackExpression; throw new Error('Could not parse emotion response ' + emotionResponse);
} }
function onTextGenSettingsReady(args) { function onTextGenSettingsReady(args) {