Merge pull request #3726 from SillyTavern/feat/expressions-remove-reasoning

Clean reasoning from LLM/webLLM classify response on expression classification
This commit is contained in:
Cohee
2025-03-19 09:44:05 +02:00
committed by GitHub

View File

@@ -17,6 +17,7 @@ import { slashCommandReturnHelper } from '../../slash-commands/SlashCommandRetur
import { generateWebLlmChatPrompt, isWebLlmSupported } from '../shared.js'; import { generateWebLlmChatPrompt, isWebLlmSupported } from '../shared.js';
import { Popup, POPUP_RESULT } from '../../popup.js'; import { Popup, POPUP_RESULT } from '../../popup.js';
import { t } from '../../i18n.js'; import { t } from '../../i18n.js';
import { removeReasoningFromString } from '../../reasoning.js';
export { MODULE_NAME }; export { MODULE_NAME };
/** /**
@@ -928,6 +929,9 @@ function parseLlmResponse(emotionResponse, labels) {
return response; return response;
} catch { } catch {
// Clean possible reasoning from response
emotionResponse = removeReasoningFromString(emotionResponse);
const fuse = new Fuse(labels, { includeScore: true }); const fuse = new Fuse(labels, { includeScore: true });
console.debug('Using fuzzy search in labels:', labels); console.debug('Using fuzzy search in labels:', labels);
const result = fuse.search(emotionResponse); const result = fuse.search(emotionResponse);