Merge branch 'staging' into swipe-nums-for-all-mes

This commit is contained in:
Cohee
2024-09-30 22:23:40 +03:00
12 changed files with 414 additions and 181 deletions

View File

@ -231,7 +231,7 @@ import { MacrosParser, evaluateMacros, getLastMessageId } from './scripts/macros
import { currentUser, setUserControls } from './scripts/user.js';
import { POPUP_RESULT, POPUP_TYPE, Popup, callGenericPopup, fixToastrForDialogs } from './scripts/popup.js';
import { renderTemplate, renderTemplateAsync } from './scripts/templates.js';
import { ScraperManager } from './scripts/scrapers.js';
import { initScrapers, ScraperManager } from './scripts/scrapers.js';
import { SlashCommandParser } from './scripts/slash-commands/SlashCommandParser.js';
import { SlashCommand } from './scripts/slash-commands/SlashCommand.js';
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from './scripts/slash-commands/SlashCommandArgument.js';
@ -960,6 +960,7 @@ async function firstLoadInit() {
initCfg();
initLogprobs();
initInputMarkdown();
await initScrapers();
doDailyExtensionUpdatesCheck();
await hideLoader();
await fixViewport();
@ -5439,6 +5440,7 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc
getMessage = getMessage.substring(0, getMessage.indexOf('<|endoftext|>'));
}
const isInstruct = power_user.instruct.enabled && main_api !== 'openai';
const isNotEmpty = (str) => str && str.trim() !== '';
if (isInstruct && power_user.instruct.stop_sequence) {
if (getMessage.indexOf(power_user.instruct.stop_sequence) != -1) {
getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.stop_sequence));
@ -5446,7 +5448,7 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc
}
// Hana: Only use the first sequence (should be <|model|>)
// of the prompt before <|user|> (as KoboldAI Lite does it).
if (isInstruct && power_user.instruct.input_sequence) {
if (isInstruct && isNotEmpty(power_user.instruct.input_sequence)) {
if (getMessage.indexOf(power_user.instruct.input_sequence) != -1) {
getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.input_sequence));
}
@ -8497,12 +8499,22 @@ const CONNECT_API_MAP = {
selected: 'novel',
button: '#api_button_novel',
},
'koboldcpp': {
selected: 'textgenerationwebui',
button: '#api_button_textgenerationwebui',
type: textgen_types.KOBOLDCPP,
},
// KoboldCpp alias
'kcpp': {
selected: 'textgenerationwebui',
button: '#api_button_textgenerationwebui',
type: textgen_types.KOBOLDCPP,
},
'openai': {
selected: 'openai',
button: '#api_button_openai',
source: chat_completion_sources.OPENAI,
},
// OpenAI alias
'oai': {
selected: 'openai',