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
| @@ -17,6 +17,7 @@ import { slashCommandReturnHelper } from '../../slash-commands/SlashCommandRetur | ||
| 17 | 17 | import { generateWebLlmChatPrompt, isWebLlmSupported } from '../shared.js'; |
| 18 | 18 | import { Popup, POPUP_RESULT } from '../../popup.js'; |
| 19 | 19 | import { t } from '../../i18n.js'; |
| 20 | +import { removeReasoningFromString } from '../../reasoning.js'; | |
| 20 | 21 | export { MODULE_NAME }; |
| 21 | 22 | |
| 22 | 23 | /** |
| @@ -928,6 +929,9 @@ function parseLlmResponse(emotionResponse, labels) { | ||
| 928 | 929 | |
| 929 | 930 | return response; |
| 930 | 931 | } catch { |
| 932 | + // Clean possible reasoning from response | |
| 933 | + emotionResponse = removeReasoningFromString(emotionResponse); | |
| 934 | + | |
| 931 | 935 | const fuse = new Fuse(labels, { includeScore: true }); |
| 932 | 936 | console.debug('Using fuzzy search in labels:', labels); |
| 933 | 937 | const result = fuse.search(emotionResponse); |