From 23b08173ff0601212796f70072f2d3b3ab83cfc2 Mon Sep 17 00:00:00 2001 From: Xrystal Date: Sun, 17 Sep 2023 13:41:36 +0800 Subject: [PATCH 1/2] Asynchronously fetch chats --- public/script.js | 61 +++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/public/script.js b/public/script.js index e6f3a67ef..6db1a56d6 100644 --- a/public/script.js +++ b/public/script.js @@ -5172,39 +5172,46 @@ 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) { - try { - const endpoint = isGroupChat ? '/getgroupchat' : '/getchat'; - const requestBody = isGroupChat - ? JSON.stringify({ id: file_name }) - : JSON.stringify({ - ch_name: characters[context.characterId].name, - file_name: file_name.replace('.jsonl', ''), - avatar_url: characters[context.characterId].avatar + let chat_promise = chat_list.map(({ file_name}) => { + return new Promise(async (res, rej) => { + try { + const endpoint = isGroupChat ? '/getgroupchat' : '/getchat'; + const requestBody = isGroupChat + ? JSON.stringify({ id: file_name }) + : JSON.stringify({ + ch_name: characters[context.characterId].name, + file_name: file_name.replace('.jsonl', ''), + avatar_url: characters[context.characterId].avatar + }); + + const chatResponse = await fetch(endpoint, { + method: 'POST', + headers: getRequestHeaders(), + body: requestBody, + cache: 'no-cache', }); - const chatResponse = await fetch(endpoint, { - method: 'POST', - headers: getRequestHeaders(), - body: requestBody, - cache: 'no-cache', - }); + if (!chatResponse.ok) { + return res(); + // continue; + } - if (!chatResponse.ok) { - continue; + const currentChat = await chatResponse.json(); + if (!isGroupChat) { + // remove the first message, which is metadata, only for individual chats + currentChat.shift(); + } + chat_dict[file_name] = currentChat; + + } catch (error) { + console.error(error); } - const currentChat = await chatResponse.json(); - if (!isGroupChat) { - // remove the first message, which is metadata, only for individual chats - currentChat.shift(); - } - chat_dict[file_name] = currentChat; + return res(); + }) + }) - } catch (error) { - console.error(error); - } - } + await Promise.all(chat_promise) return chat_dict; } From 66911160c04567611da53aab40876ec153472b07 Mon Sep 17 00:00:00 2001 From: majick <125657+majick@users.noreply.github.com> Date: Sun, 17 Sep 2023 06:39:02 -0700 Subject: [PATCH 2/2] The popular mirostat "Gold/Silver/Bronze" community settings (#1146) * The popular mirostat "Gold/Silver/Bronze" community settings These settings have been popular in the community and are good candidates for defaults. * Update Miro Bronze.json * Update Miro Gold.json * Update Miro Bronze.json * Update Miro Silver.json * Rename Kobold presets * Update textgen presets --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com> --- public/KoboldAI Settings/Miro Bronze.settings | 25 +++++++++++++++++++ public/KoboldAI Settings/Miro Gold.settings | 25 +++++++++++++++++++ public/KoboldAI Settings/Miro Silver.settings | 25 +++++++++++++++++++ public/TextGen Settings/Miro Bronze.settings | 24 ++++++++++++++++++ public/TextGen Settings/Miro Gold.settings | 24 ++++++++++++++++++ public/TextGen Settings/Miro Silver.settings | 24 ++++++++++++++++++ 6 files changed, 147 insertions(+) create mode 100644 public/KoboldAI Settings/Miro Bronze.settings create mode 100644 public/KoboldAI Settings/Miro Gold.settings create mode 100644 public/KoboldAI Settings/Miro Silver.settings create mode 100644 public/TextGen Settings/Miro Bronze.settings create mode 100644 public/TextGen Settings/Miro Gold.settings create mode 100644 public/TextGen Settings/Miro Silver.settings diff --git a/public/KoboldAI Settings/Miro Bronze.settings b/public/KoboldAI Settings/Miro Bronze.settings new file mode 100644 index 000000000..7e24455f4 --- /dev/null +++ b/public/KoboldAI Settings/Miro Bronze.settings @@ -0,0 +1,25 @@ +{ + "temp": 1.06, + "rep_pen": 1, + "rep_pen_range": 0, + "top_p": 1, + "top_a": 0, + "top_k": 0, + "typical": 1, + "tfs": 1, + "rep_pen_slope": 0.9, + "single_line": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "mirostat": 2, + "mirostat_tau": 9.61, + "mirostat_eta": 1, + "use_default_badwordsids": true +} diff --git a/public/KoboldAI Settings/Miro Gold.settings b/public/KoboldAI Settings/Miro Gold.settings new file mode 100644 index 000000000..d5d37b079 --- /dev/null +++ b/public/KoboldAI Settings/Miro Gold.settings @@ -0,0 +1,25 @@ +{ + "temp": 1.17, + "rep_pen": 1, + "rep_pen_range": 0, + "top_p": 1, + "top_a": 0, + "top_k": 0, + "typical": 1, + "tfs": 1, + "rep_pen_slope": 0.9, + "single_line": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "mirostat": 2, + "mirostat_tau": 9.91, + "mirostat_eta": 1, + "use_default_badwordsids": true +} diff --git a/public/KoboldAI Settings/Miro Silver.settings b/public/KoboldAI Settings/Miro Silver.settings new file mode 100644 index 000000000..2f2ee8633 --- /dev/null +++ b/public/KoboldAI Settings/Miro Silver.settings @@ -0,0 +1,25 @@ +{ + "temp": 1.17, + "rep_pen": 1, + "rep_pen_range": 0, + "top_p": 1, + "top_a": 0, + "top_k": 0, + "typical": 1, + "tfs": 1, + "rep_pen_slope": 0.9, + "single_line": false, + "sampler_order": [ + 6, + 0, + 1, + 3, + 4, + 2, + 5 + ], + "mirostat": 2, + "mirostat_tau": 9.62, + "mirostat_eta": 1, + "use_default_badwordsids": true +} diff --git a/public/TextGen Settings/Miro Bronze.settings b/public/TextGen Settings/Miro Bronze.settings new file mode 100644 index 000000000..96ce62afd --- /dev/null +++ b/public/TextGen Settings/Miro Bronze.settings @@ -0,0 +1,24 @@ +{ + "temp": 1.06, + "top_p": 1, + "top_k": 0, + "typical_p": 1, + "top_a": 0, + "tfs": 1, + "epsilon_cutoff": 0, + "eta_cutoff": 0, + "rep_pen": 1, + "rep_pen_range": 0, + "no_repeat_ngram_size": 0, + "penalty_alpha": 0, + "num_beams": 1, + "length_penalty": 1, + "min_length": 0, + "encoder_rep_pen": 1, + "do_sample": true, + "early_stopping": false, + "mirostat_mode": 2, + "mirostat_tau": 9.61, + "mirostat_eta": 1, + "rep_pen_size": 0 +} diff --git a/public/TextGen Settings/Miro Gold.settings b/public/TextGen Settings/Miro Gold.settings new file mode 100644 index 000000000..4a423d39e --- /dev/null +++ b/public/TextGen Settings/Miro Gold.settings @@ -0,0 +1,24 @@ +{ + "temp": 1.17, + "top_p": 1, + "top_k": 0, + "typical_p": 1, + "top_a": 0, + "tfs": 1, + "epsilon_cutoff": 0, + "eta_cutoff": 0, + "rep_pen": 1, + "rep_pen_range": 0, + "no_repeat_ngram_size": 0, + "penalty_alpha": 0, + "num_beams": 1, + "length_penalty": 1, + "min_length": 0, + "encoder_rep_pen": 1, + "do_sample": true, + "early_stopping": false, + "mirostat_mode": 2, + "mirostat_tau": 9.91, + "mirostat_eta": 1, + "rep_pen_size": 0 +} diff --git a/public/TextGen Settings/Miro Silver.settings b/public/TextGen Settings/Miro Silver.settings new file mode 100644 index 000000000..d04526dc4 --- /dev/null +++ b/public/TextGen Settings/Miro Silver.settings @@ -0,0 +1,24 @@ +{ + "temp": 1.17, + "top_p": 1, + "top_k": 0, + "typical_p": 1, + "top_a": 0, + "tfs": 1, + "epsilon_cutoff": 0, + "eta_cutoff": 0, + "rep_pen": 1, + "rep_pen_range": 0, + "no_repeat_ngram_size": 0, + "penalty_alpha": 0, + "num_beams": 1, + "length_penalty": 1, + "min_length": 0, + "encoder_rep_pen": 1, + "do_sample": true, + "early_stopping": false, + "mirostat_mode": 2, + "mirostat_tau": 9.62, + "mirostat_eta": 1, + "rep_pen_size": 0 +}