Merge pull request #3726 from SillyTavern/feat/expressions-remove-reasoning Clean reasoning from LLM/webLLM classify response on expression classification

7784b71c557334874d3aad2fd8bea1ae3a3dc698

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
1 files changed, +4 -0Ignore whitespace
public/scripts/extensions/expressions/index.js+4 -0
@@ -17,6 +17,7 @@ import { slashCommandReturnHelper } from '../../slash-commands/SlashCommandRetur
17import { generateWebLlmChatPrompt, isWebLlmSupported } from '../shared.js';17import { generateWebLlmChatPrompt, isWebLlmSupported } from '../shared.js';
18import { Popup, POPUP_RESULT } from '../../popup.js';18import { Popup, POPUP_RESULT } from '../../popup.js';
19import { t } from '../../i18n.js';19import { t } from '../../i18n.js';
20import { removeReasoningFromString } from '../../reasoning.js';
20export { MODULE_NAME };21export { MODULE_NAME };
2122
22/**23/**
@@ -928,6 +929,9 @@ function parseLlmResponse(emotionResponse, labels) {
928929
929 return response;930 return response;
930 } catch {931 } catch {
932 // Clean possible reasoning from response
933 emotionResponse = removeReasoningFromString(emotionResponse);
934
931 const fuse = new Fuse(labels, { includeScore: true });935 const fuse = new Fuse(labels, { includeScore: true });
932 console.debug('Using fuzzy search in labels:', labels);936 console.debug('Using fuzzy search in labels:', labels);
933 const result = fuse.search(emotionResponse);937 const result = fuse.search(emotionResponse);