diff --git a/src/components/ChatSetting.vue b/src/components/ChatSetting.vue
index b4d9414963..e469a2f41e 100644
--- a/src/components/ChatSetting.vue
+++ b/src/components/ChatSetting.vue
@@ -15,24 +15,7 @@
style="margin: 10px"
>
-
- {{ $t("proxy.fullSet") }}
-
-
-
-
+
{
- const reader = new FileReader();
- reader.onload = (evt) => {
- const value = JSON.parse(evt.target.result);
- jsonData.value = value;
- reload(value);
- };
- reader.readAsText(event.target.files[0]);
-};
-async function reload(value) {
- const load = i18n.global.t("proxy.saveAndApply");
- const result = await confirmModal.value.showModal("", `${load}?`);
- if (result) {
- Object.keys(value).map((d) => (localStorage[d] = value[d]));
- await ipcRenderer.invoke("restart-app");
- }
-}
// This function downloads the chat history as a JSON file.
@@ -122,62 +88,26 @@ function get_messages() {
} else {
const botClassname = message.className;
const bot = bots.getBotByClassName(botClassname);
- const botName = bot.getFullname();
- arr.at(-1).responses.push({
- content,
- botName,
- botClassname,
- botModel: message.model,
- highlight: message.highlight,
- });
+ if (bot) {
+ const botName = bot.getFullname();
+ arr.at(-1).responses.push({
+ content,
+ botName,
+ botClassname,
+ botModel: message.model,
+ highlight: message.highlight,
+ });
+ }
}
return arr;
}, []),
}));
return messages;
} catch (e) {
- // debugger;
+ // eslint-disable-next-line no-debugger
+ debugger;
}
}
-const downloadDataJson = () => {
- const content = "data";
- const messages = localStorage;
- download_by_link(messages, content);
-};
-// Create a blob that contains the JSON data.
-// The space parameter specifies the indentation of nested objects in the string representation.
-function download_by_link(messages, name) {
- const blob = new Blob([JSON.stringify(messages, null, 2)], {
- // The type of the blob.
- type: "application/json",
- });
-
- const url = URL.createObjectURL(blob);
-
- // Create a file name for the JSON file.
- const date = new Date();
- const year = date.getFullYear();
- const month = String(date.getMonth() + 1).padStart(2, "0"); // months are 0-based in JavaScript
- const day = String(date.getDate()).padStart(2, "0");
- const hour = String(date.getHours()).padStart(2, "0");
- const minute = String(date.getMinutes()).padStart(2, "0");
- const second = String(date.getSeconds()).padStart(2, "0");
- const fileName = `chatall-${name}-${year}${month}${day}-${hour}${minute}${second}`;
-
- const a = document.createElement("a");
- a.href = url;
- a.download = `${fileName}.json`;
- document.body.appendChild(a);
-
- // Click the anchor element to download the file.
- a.click();
-
- // Remove the anchor element from the document body.
- document.body.removeChild(a);
-
- // Revoke the URL for the blob.
- URL.revokeObjectURL(url);
-}
async function deleteChats() {
const confirm = await confirmModal.value.showModal(
diff --git a/src/components/SettingsModal.vue b/src/components/SettingsModal.vue
index 3268dc05c2..419f82e8be 100644
--- a/src/components/SettingsModal.vue
+++ b/src/components/SettingsModal.vue
@@ -59,6 +59,26 @@
@update:model-value="setCurrentMode($event)"
>
+
+ {{
+ $t("proxy.fullSet")
+ }}
+
+
+
+
@@ -81,16 +101,19 @@
+