mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'staging' into persona-lorebook
This commit is contained in:
@@ -1863,32 +1863,38 @@ export async function deleteGroupChat(groupId, chatId) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function importGroupChat(formData) {
|
||||
await jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: '/api/chats/group/import',
|
||||
data: formData,
|
||||
beforeSend: function () {
|
||||
},
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: async function (data) {
|
||||
if (data.res) {
|
||||
const chatId = data.res;
|
||||
const group = groups.find(x => x.id == selected_group);
|
||||
|
||||
if (group) {
|
||||
group.chats.push(chatId);
|
||||
await editGroup(selected_group, true, true);
|
||||
await displayPastChats();
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
$('#create_button').removeAttr('disabled');
|
||||
},
|
||||
/**
|
||||
* Imports a group chat from a file and adds it to the group.
|
||||
* @param {FormData} formData Form data to send to the server
|
||||
* @param {EventTarget} eventTarget Element that triggered the import
|
||||
*/
|
||||
export async function importGroupChat(formData, eventTarget) {
|
||||
const headers = getRequestHeaders();
|
||||
delete headers['Content-Type'];
|
||||
const fetchResult = await fetch('/api/chats/group/import', {
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: formData,
|
||||
cache: 'no-cache',
|
||||
});
|
||||
|
||||
if (fetchResult.ok) {
|
||||
const data = await fetchResult.json();
|
||||
if (data.res) {
|
||||
const chatId = data.res;
|
||||
const group = groups.find(x => x.id == selected_group);
|
||||
|
||||
if (group) {
|
||||
group.chats.push(chatId);
|
||||
await editGroup(selected_group, true, true);
|
||||
await displayPastChats();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (eventTarget instanceof HTMLInputElement) {
|
||||
eventTarget.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
export async function saveGroupBookmarkChat(groupId, name, metadata, mesId) {
|
||||
|
@@ -1812,6 +1812,7 @@ async function sendOpenAIRequest(type, messages, signal) {
|
||||
const isPerplexity = oai_settings.chat_completion_source == chat_completion_sources.PERPLEXITY;
|
||||
const isGroq = oai_settings.chat_completion_source == chat_completion_sources.GROQ;
|
||||
const is01AI = oai_settings.chat_completion_source == chat_completion_sources.ZEROONEAI;
|
||||
const isNano = oai_settings.chat_completion_source == chat_completion_sources.NANOGPT;
|
||||
const isTextCompletion = isOAI && textCompletionModels.includes(oai_settings.openai_model);
|
||||
const isQuiet = type === 'quiet';
|
||||
const isImpersonate = type === 'impersonate';
|
||||
@@ -1971,7 +1972,7 @@ async function sendOpenAIRequest(type, messages, signal) {
|
||||
delete generate_data.stop;
|
||||
}
|
||||
|
||||
if ((isOAI || isOpenRouter || isMistral || isCustom || isCohere) && oai_settings.seed >= 0) {
|
||||
if ((isOAI || isOpenRouter || isMistral || isCustom || isCohere || isNano) && oai_settings.seed >= 0) {
|
||||
generate_data['seed'] = oai_settings.seed;
|
||||
}
|
||||
|
||||
|
@@ -269,7 +269,7 @@ export function initDefaultSlashCommands() {
|
||||
}),
|
||||
SlashCommandNamedArgument.fromProps({
|
||||
name: 'at',
|
||||
description: 'position to insert the message (index-based, corresponding to message id). If not set, the message will be inserted at the end of the chat.\nNegative values are accepted and will work similarly to how \'depth\' usually works. For example, -1 will insert the message right before the last message in chat.',
|
||||
description: 'position to insert the message (index-based, corresponding to message id). If not set, the message will be inserted at the end of the chat.\nNegative values (including -0) are accepted and will work similarly to how \'depth\' usually works. For example, -1 will insert the message right before the last message in chat.',
|
||||
typeList: [ARGUMENT_TYPE.NUMBER],
|
||||
enumProvider: commonEnumProviders.messages({ allowIdAfter: true }),
|
||||
}),
|
||||
@@ -325,7 +325,7 @@ export function initDefaultSlashCommands() {
|
||||
),
|
||||
SlashCommandNamedArgument.fromProps({
|
||||
name: 'at',
|
||||
description: 'position to insert the message (index-based, corresponding to message id). If not set, the message will be inserted at the end of the chat.\nNegative values are accepted and will work similarly to how \'depth\' usually works. For example, -1 will insert the message right before the last message in chat.',
|
||||
description: 'position to insert the message (index-based, corresponding to message id). If not set, the message will be inserted at the end of the chat.\nNegative values (including -0) are accepted and will work similarly to how \'depth\' usually works. For example, -1 will insert the message right before the last message in chat.',
|
||||
typeList: [ARGUMENT_TYPE.NUMBER],
|
||||
enumProvider: commonEnumProviders.messages({ allowIdAfter: true }),
|
||||
}),
|
||||
@@ -388,7 +388,7 @@ export function initDefaultSlashCommands() {
|
||||
),
|
||||
SlashCommandNamedArgument.fromProps({
|
||||
name: 'at',
|
||||
description: 'position to insert the message (index-based, corresponding to message id). If not set, the message will be inserted at the end of the chat.\nNegative values are accepted and will work similarly to how \'depth\' usually works. For example, -1 will insert the message right before the last message in chat.',
|
||||
description: 'position to insert the message (index-based, corresponding to message id). If not set, the message will be inserted at the end of the chat.\nNegative values (including -0) are accepted and will work similarly to how \'depth\' usually works. For example, -1 will insert the message right before the last message in chat.',
|
||||
typeList: [ARGUMENT_TYPE.NUMBER],
|
||||
enumProvider: commonEnumProviders.messages({ allowIdAfter: true }),
|
||||
}),
|
||||
@@ -606,7 +606,7 @@ export function initDefaultSlashCommands() {
|
||||
),
|
||||
SlashCommandNamedArgument.fromProps({
|
||||
name: 'at',
|
||||
description: 'position to insert the message (index-based, corresponding to message id). If not set, the message will be inserted at the end of the chat.\nNegative values are accepted and will work similarly to how \'depth\' usually works. For example, -1 will insert the message right before the last message in chat.',
|
||||
description: 'position to insert the message (index-based, corresponding to message id). If not set, the message will be inserted at the end of the chat.\nNegative values (including -0) are accepted and will work similarly to how \'depth\' usually works. For example, -1 will insert the message right before the last message in chat.',
|
||||
typeList: [ARGUMENT_TYPE.NUMBER],
|
||||
enumProvider: commonEnumProviders.messages({ allowIdAfter: true }),
|
||||
}),
|
||||
@@ -3025,7 +3025,7 @@ async function sendUserMessageCallback(args, text) {
|
||||
let insertAt = Number(args?.at);
|
||||
|
||||
// Convert possible depth parameter to index
|
||||
if (!isNaN(insertAt) && (insertAt < 0 || insertAt === Number(-0))) {
|
||||
if (!isNaN(insertAt) && (insertAt < 0 || Object.is(insertAt, -0))) {
|
||||
// Negative value means going back from current chat length. (E.g.: 8 messages, Depth 1 means insert at index 7)
|
||||
insertAt = chat.length + insertAt;
|
||||
}
|
||||
@@ -3399,7 +3399,7 @@ export async function sendMessageAs(args, text) {
|
||||
let insertAt = Number(args.at);
|
||||
|
||||
// Convert possible depth parameter to index
|
||||
if (!isNaN(insertAt) && (insertAt < 0 || insertAt === Number(-0))) {
|
||||
if (!isNaN(insertAt) && (insertAt < 0 || Object.is(insertAt, -0))) {
|
||||
// Negative value means going back from current chat length. (E.g.: 8 messages, Depth 1 means insert at index 7)
|
||||
insertAt = chat.length + insertAt;
|
||||
}
|
||||
@@ -3453,7 +3453,7 @@ export async function sendNarratorMessage(args, text) {
|
||||
let insertAt = Number(args.at);
|
||||
|
||||
// Convert possible depth parameter to index
|
||||
if (!isNaN(insertAt) && (insertAt < 0 || insertAt === Number(-0))) {
|
||||
if (!isNaN(insertAt) && (insertAt < 0 || Object.is(insertAt, -0))) {
|
||||
// Negative value means going back from current chat length. (E.g.: 8 messages, Depth 1 means insert at index 7)
|
||||
insertAt = chat.length + insertAt;
|
||||
}
|
||||
@@ -3542,7 +3542,7 @@ async function sendCommentMessage(args, text) {
|
||||
let insertAt = Number(args.at);
|
||||
|
||||
// Convert possible depth parameter to index
|
||||
if (!isNaN(insertAt) && (insertAt < 0 || insertAt === Number(-0))) {
|
||||
if (!isNaN(insertAt) && (insertAt < 0 || Object.is(insertAt, -0))) {
|
||||
// Negative value means going back from current chat length. (E.g.: 8 messages, Depth 1 means insert at index 7)
|
||||
insertAt = chat.length + insertAt;
|
||||
}
|
||||
|
@@ -4,8 +4,17 @@
|
||||
<div id="copyPromptToClipboard" class="fa-solid fa-copy menu_button" title="Copy Prompt" data-i18n="[title]Copy Prompt"></div>
|
||||
<div id="diffPrevPrompt" class="fa-solid fa-code-compare menu_button" title="Show Prompt Differences" data-i18n="[title]Show Prompt Differences"></div>
|
||||
</h3>
|
||||
API/Model Used: {{mainApiFriendlyName}} {{#if apiUsed}}({{apiUsed}}){{/if}} {{#if modelUsed}}– {{modelUsed}}{{/if}}<br>
|
||||
Tokenizer: {{selectedTokenizer}}<br>
|
||||
<div>
|
||||
<div>
|
||||
API/Model: {{mainApiFriendlyName}} {{#if apiUsed}}({{apiUsed}}){{/if}} {{#if modelUsed}}– {{modelUsed}}{{/if}}
|
||||
</div>
|
||||
<div>
|
||||
<small>Preset: {{presetName}}</small>
|
||||
<span>|</span>
|
||||
<small>Tokenizer: {{selectedTokenizer}}</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span class="tokenItemizingSubclass">
|
||||
Only the white numbers really matter. All numbers are estimates.
|
||||
Grey color items may not have been included in the context due to certain prompt format settings.
|
||||
|
@@ -4,8 +4,17 @@
|
||||
<div id="copyPromptToClipboard" class="fa-solid fa-copy menu_button" title="Copy Prompt" data-i18n="[title]Copy Prompt"></div>
|
||||
<div id="diffPrevPrompt" class="fa-solid fa-code-compare menu_button" title="Show Prompt Differences" data-i18n="[title]Show Prompt Differences"></div>
|
||||
</h3>
|
||||
API/Model Used: {{mainApiFriendlyName}} {{#if apiUsed}}({{apiUsed}}){{/if}} {{#if modelUsed}}– {{modelUsed}}{{/if}}<br>
|
||||
Tokenizer: {{selectedTokenizer}}<br>
|
||||
<div>
|
||||
<div>
|
||||
API/Model: {{mainApiFriendlyName}} {{#if apiUsed}}({{apiUsed}}){{/if}} {{#if modelUsed}}– {{modelUsed}}{{/if}}
|
||||
</div>
|
||||
<div>
|
||||
<small>Preset: {{presetName}}</small>
|
||||
<span>|</span>
|
||||
<small>Tokenizer: {{selectedTokenizer}}</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span class="tokenItemizingSubclass">
|
||||
Only the white numbers really matter. All numbers are estimates.
|
||||
Grey color items may not have been included in the context due to certain prompt format settings.
|
||||
|
@@ -1340,6 +1340,9 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
|
||||
'dry_sequence_breakers': sequenceBreakers,
|
||||
};
|
||||
params = Object.assign(params, llamaCppParams);
|
||||
if (!Array.isArray(sequenceBreakers) || sequenceBreakers.length === 0) {
|
||||
delete params.dry_sequence_breakers;
|
||||
}
|
||||
}
|
||||
|
||||
eventSource.emitAndWait(event_types.TEXT_COMPLETION_SETTINGS_READY, params);
|
||||
|
Reference in New Issue
Block a user