mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Use performFuzzySearch
This commit is contained in:
@ -1,5 +1,4 @@
|
|||||||
import {
|
import {
|
||||||
Fuse,
|
|
||||||
moment,
|
moment,
|
||||||
} from '../lib.js';
|
} from '../lib.js';
|
||||||
import { chat, closeMessageEditor, event_types, eventSource, main_api, messageFormatting, saveChatConditional, saveChatDebounced, saveSettingsDebounced, substituteParams, syncMesToSwipe, updateMessageBlock } from '../script.js';
|
import { chat, closeMessageEditor, event_types, eventSource, main_api, messageFormatting, saveChatConditional, saveChatDebounced, saveSettingsDebounced, substituteParams, syncMesToSwipe, updateMessageBlock } from '../script.js';
|
||||||
@ -8,7 +7,7 @@ import { getCurrentLocale, t, translate } from './i18n.js';
|
|||||||
import { MacrosParser } from './macros.js';
|
import { MacrosParser } from './macros.js';
|
||||||
import { chat_completion_sources, getChatCompletionModel, oai_settings } from './openai.js';
|
import { chat_completion_sources, getChatCompletionModel, oai_settings } from './openai.js';
|
||||||
import { Popup } from './popup.js';
|
import { Popup } from './popup.js';
|
||||||
import { power_user } from './power-user.js';
|
import { performFuzzySearch, power_user } from './power-user.js';
|
||||||
import { SlashCommand } from './slash-commands/SlashCommand.js';
|
import { SlashCommand } from './slash-commands/SlashCommand.js';
|
||||||
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from './slash-commands/SlashCommandArgument.js';
|
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from './slash-commands/SlashCommandArgument.js';
|
||||||
import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';
|
import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';
|
||||||
@ -91,7 +90,7 @@ export function extractReasoningFromData(data, {
|
|||||||
mainApi = null,
|
mainApi = null,
|
||||||
ignoreShowThoughts = false,
|
ignoreShowThoughts = false,
|
||||||
textGenType = null,
|
textGenType = null,
|
||||||
chatCompletionSource = null
|
chatCompletionSource = null,
|
||||||
} = {}) {
|
} = {}) {
|
||||||
switch (mainApi ?? main_api) {
|
switch (mainApi ?? main_api) {
|
||||||
case 'textgenerationwebui':
|
case 'textgenerationwebui':
|
||||||
@ -781,8 +780,7 @@ function selectReasoningTemplateCallback(args, name) {
|
|||||||
let foundName = templateNames.find(x => x.toLowerCase() === name.toLowerCase());
|
let foundName = templateNames.find(x => x.toLowerCase() === name.toLowerCase());
|
||||||
|
|
||||||
if (!foundName) {
|
if (!foundName) {
|
||||||
const fuse = new Fuse(templateNames);
|
const result = performFuzzySearch('reasoning-templates', templateNames, [], name);
|
||||||
const result = fuse.search(name);
|
|
||||||
|
|
||||||
if (result.length === 0) {
|
if (result.length === 0) {
|
||||||
!quiet && toastr.warning(`Reasoning template "${name}" not found`);
|
!quiet && toastr.warning(`Reasoning template "${name}" not found`);
|
||||||
|
Reference in New Issue
Block a user