Clean reasoning from classify response - If a reasoning model is used (via LLM, or R1 distill via webLLM), it'll likely return reasoning. That should not be used for the search of classification inside the response

a8899f7d81bd535a26b67a30c30e5452a361175a

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +4 -0Ignore whitespace
public/scripts/extensions/expressions/index.js+4 -0
@@ -17,6 +17,7 @@ import { slashCommandReturnHelper } from '../../slash-commands/SlashCommandRetur
1717import { generateWebLlmChatPrompt, isWebLlmSupported } from '../shared.js';
1818import { Popup, POPUP_RESULT } from '../../popup.js';
1919import { t } from '../../i18n.js';
20+import { removeReasoningFromString } from '../../reasoning.js';
2021export { MODULE_NAME };
2122
2223/**
@@ -928,6 +929,9 @@ function parseLlmResponse(emotionResponse, labels) {
928929
929930 return response;
930931 } catch {
932+ // Clean possible reasoning from response
933+ emotionResponse = removeReasoningFromString(emotionResponse);
934+
931935 const fuse = new Fuse(labels, { includeScore: true });
932936 console.debug('Using fuzzy search in labels:', labels);
933937 const result = fuse.search(emotionResponse);