Merge branch 'staging' into feat/slash-commands-missing-args

This commit is contained in:
Cohee
2023-12-07 13:19:15 +02:00
12 changed files with 803 additions and 731 deletions

View File

@@ -251,7 +251,7 @@ async function convertSoloToGroupChat() {
const metadata = Object.assign({}, chat_metadata);
delete metadata.main_chat;
const createGroupResponse = await fetch('/creategroup', {
const createGroupResponse = await fetch('/api/groups/create', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({
@@ -320,7 +320,7 @@ async function convertSoloToGroupChat() {
}
// Save group chat
const createChatResponse = await fetch('/savegroupchat', {
const createChatResponse = await fetch('/api/chats/group/save', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ id: chatName, chat: groupChat }),

View File

@@ -116,7 +116,7 @@ setInterval(groupChatAutoModeWorker, 5000);
const saveGroupDebounced = debounce(async (group, reload) => await _save(group, reload), 500);
async function _save(group, reload = true) {
await fetch('/editgroup', {
await fetch('/api/groups/edit', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify(group),
@@ -152,7 +152,7 @@ async function regenerateGroup() {
}
async function loadGroupChat(chatId) {
const response = await fetch('/getgroupchat', {
const response = await fetch('/api/chats/group/get', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ id: chatId }),
@@ -401,7 +401,7 @@ async function saveGroupChat(groupId, shouldSaveGroup) {
const group = groups.find(x => x.id == groupId);
const chat_id = group.chat_id;
group['date_last_chat'] = Date.now();
const response = await fetch('/savegroupchat', {
const response = await fetch('/api/chats/group/save', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ id: chat_id, chat: [...chat] }),
@@ -455,7 +455,7 @@ export async function renameGroupMember(oldAvatar, newAvatar, newName) {
}
if (hadChanges) {
const saveChatResponse = await fetch('/savegroupchat', {
const saveChatResponse = await fetch('/api/chats/group/save', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ id: chatId, chat: [...messages] }),
@@ -476,7 +476,7 @@ export async function renameGroupMember(oldAvatar, newAvatar, newName) {
}
async function getGroups() {
const response = await fetch('/getgroups', {
const response = await fetch('/api/groups/all', {
method: 'POST',
headers: getRequestHeaders(),
});
@@ -968,7 +968,7 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i
async function deleteGroup(id) {
const group = groups.find((x) => x.id === id);
const response = await fetch('/deletegroup', {
const response = await fetch('/api/groups/delete', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ id: id }),
@@ -1521,7 +1521,7 @@ async function createGroup() {
const chatName = humanizedDateTime();
const chats = [chatName];
const createGroupResponse = await fetch('/creategroup', {
const createGroupResponse = await fetch('/api/groups/create', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({
@@ -1659,7 +1659,7 @@ export async function deleteGroupChat(groupId, chatId) {
delete group.past_metadata[chatId];
updateChatMetadata(group.chat_metadata, true);
const response = await fetch('/deletegroupchat', {
const response = await fetch('/api/chats/group/delete', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ id: chatId }),
@@ -1679,7 +1679,7 @@ export async function deleteGroupChat(groupId, chatId) {
export async function importGroupChat(formData) {
await jQuery.ajax({
type: 'POST',
url: '/importgroupchat',
url: '/api/chats/group/import',
data: formData,
beforeSend: function () {
},
@@ -1720,7 +1720,7 @@ export async function saveGroupBookmarkChat(groupId, name, metadata, mesId) {
await editGroup(groupId, true, false);
await fetch('/savegroupchat', {
await fetch('/api/chats/group/save', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ id: name, chat: [...trimmed_chat] }),

View File

@@ -813,6 +813,7 @@ async function CreateZenSliders(elmnt) {
if (numVal === offVal) { handle.text('Off').css('color', 'rgba(128,128,128,0.5'); }
else if (numVal === allVal) { handle.text('All'); }
else { handle.css('color', ''); }
numVal = steps[stepNumber];
}
//everything else uses the flat slider value
//also note: the above sliders are not custom inputtable due to the array aliasing

View File

@@ -424,7 +424,7 @@ async function loadWorldInfoData(name) {
return worldInfoCache[name];
}
const response = await fetch('/getworldinfo', {
const response = await fetch('/api/worldinfo/get', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ name: name }),
@@ -1402,7 +1402,7 @@ function createWorldInfoEntry(name, data, fromSlashCommand = false) {
}
async function _save(name, data) {
await fetch('/editworldinfo', {
await fetch('/api/worldinfo/edit', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ name: name, data: data }),
@@ -1464,7 +1464,7 @@ async function deleteWorldInfo(worldInfoName) {
return;
}
const response = await fetch('/deleteworldinfo', {
const response = await fetch('/api/worldinfo/delete', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ name: worldInfoName }),
@@ -2269,7 +2269,7 @@ export async function importWorldInfo(file) {
jQuery.ajax({
type: 'POST',
url: '/importworldinfo',
url: '/api/worldinfo/import',
data: formData,
beforeSend: () => { },
cache: false,