Merge branch 'release' of https://github.com/SillyTavern/SillyTavern into release

This commit is contained in:
Cohee 2023-09-19 14:08:57 +03:00
commit 3d4054f10e
3 changed files with 42 additions and 28 deletions

View File

@ -73,6 +73,7 @@
"#@markdown Enables ChromaDB for Infinity Context plugin\n",
"\n",
"import subprocess\n",
"import secrets\n",
"\n",
"# ---\n",
"# SillyTavern extras\n",
@ -131,6 +132,13 @@
"!wget https://github.com/cloudflare/cloudflared/releases/download/2023.5.0/cloudflared-linux-amd64 -O /tmp/cloudflared-linux-amd64\n",
"!chmod +x /tmp/cloudflared-linux-amd64\n",
"\n",
"# Generate a random API key\n",
"api_key = secrets.token_hex(5)\n",
"\n",
"# Write the API key to api_key.txt\n",
"with open('./api_key.txt', 'w') as f:\n",
" f.write(api_key)\n",
"print(f\"API Key generated: {api_key}\")\n",
"\n",
"cmd = f\"python server.py {' '.join(params)}\"\n",
"print(cmd)\n",

View File

@ -5172,7 +5172,8 @@ export async function getChatsFromFiles(data, isGroupChat) {
let chat_dict = {};
let chat_list = Object.values(data).sort((a, b) => a["file_name"].localeCompare(b["file_name"])).reverse();
for (const { file_name } of chat_list) {
let chat_promise = chat_list.map(({ file_name}) => {
return new Promise(async (res, rej) => {
try {
const endpoint = isGroupChat ? '/getgroupchat' : '/getchat';
const requestBody = isGroupChat
@ -5191,7 +5192,8 @@ export async function getChatsFromFiles(data, isGroupChat) {
});
if (!chatResponse.ok) {
continue;
return res();
// continue;
}
const currentChat = await chatResponse.json();
@ -5204,7 +5206,12 @@ export async function getChatsFromFiles(data, isGroupChat) {
} catch (error) {
console.error(error);
}
}
return res();
})
})
await Promise.all(chat_promise)
return chat_dict;
}

View File

@ -192,7 +192,6 @@ async function doExtrasFetch(endpoint, args) {
}
Object.assign(args.headers, {
'Authorization': `Bearer ${extension_settings.apiKey}`,
'Bypass-Tunnel-Reminder': 'bypass'
});
const response = await fetch(endpoint, args);