:recycle: [Refactor] Re-organize and rename storage scripts
Browse files
components/buttons_binder.js
CHANGED
@@ -9,8 +9,8 @@ import {
|
|
9 |
} from "./chat_operator.js";
|
10 |
|
11 |
import { screen_scroller } from "./screen_scroller.js";
|
12 |
-
import {
|
13 |
-
import { endpoint_storage } from "../
|
14 |
|
15 |
export class ButtonsBinder {
|
16 |
constructor() {}
|
@@ -126,7 +126,7 @@ class NewChatButtonBinder {
|
|
126 |
const button = $("#new-chat-session");
|
127 |
button.attr("status", "new").attr("title", "New Chat");
|
128 |
button.click(() => {
|
129 |
-
|
130 |
create_new_chat_session();
|
131 |
});
|
132 |
}
|
@@ -249,7 +249,7 @@ class ClearChatHistoryButtonBinder {
|
|
249 |
button.attr("title", "Clear chat history");
|
250 |
button.click(() => {
|
251 |
if (confirm("Clear chat history?")) {
|
252 |
-
|
253 |
} else {
|
254 |
console.log("Clear chat history canceled.");
|
255 |
}
|
@@ -302,7 +302,7 @@ class ClearChatAgentsButtonBinder {
|
|
302 |
button.attr("title", "Clear agents");
|
303 |
button.click(() => {
|
304 |
if (confirm("Clear agents?")) {
|
305 |
-
//
|
306 |
} else {
|
307 |
console.log("Clear agents canceled.");
|
308 |
}
|
|
|
9 |
} from "./chat_operator.js";
|
10 |
|
11 |
import { screen_scroller } from "./screen_scroller.js";
|
12 |
+
import { chat_history_storage } from "../storages/chat_history_storage.js";
|
13 |
+
import { endpoint_storage } from "../storages/endpoint_storage.js";
|
14 |
|
15 |
export class ButtonsBinder {
|
16 |
constructor() {}
|
|
|
126 |
const button = $("#new-chat-session");
|
127 |
button.attr("status", "new").attr("title", "New Chat");
|
128 |
button.click(() => {
|
129 |
+
chat_history_storage.save_current_chat_session();
|
130 |
create_new_chat_session();
|
131 |
});
|
132 |
}
|
|
|
249 |
button.attr("title", "Clear chat history");
|
250 |
button.click(() => {
|
251 |
if (confirm("Clear chat history?")) {
|
252 |
+
chat_history_storage.clear_database();
|
253 |
} else {
|
254 |
console.log("Clear chat history canceled.");
|
255 |
}
|
|
|
302 |
button.attr("title", "Clear agents");
|
303 |
button.click(() => {
|
304 |
if (confirm("Clear agents?")) {
|
305 |
+
// chat_history_storage.clear_database();
|
306 |
} else {
|
307 |
console.log("Clear agents canceled.");
|
308 |
}
|
networks/llm_requester.js
CHANGED
@@ -10,15 +10,6 @@ import {
|
|
10 |
get_selected_temperature,
|
11 |
} from "../components/chat_operator.js";
|
12 |
|
13 |
-
function concat_urls(...urls) {
|
14 |
-
let new_url = urls
|
15 |
-
.map((url) => url.replace(/^\/|\/$/g, ""))
|
16 |
-
.filter((url) => url !== "")
|
17 |
-
.join("/");
|
18 |
-
console.log(new_url);
|
19 |
-
return new_url;
|
20 |
-
}
|
21 |
-
|
22 |
export class ChatCompletionsRequester {
|
23 |
constructor(
|
24 |
prompt,
|
|
|
10 |
get_selected_temperature,
|
11 |
} from "../components/chat_operator.js";
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
export class ChatCompletionsRequester {
|
14 |
constructor(
|
15 |
prompt,
|
networks/chat_history_storer.js β storages/chat_history_storage.js
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
class ChatStorageItem {
|
2 |
-
constructor(
|
3 |
-
this.
|
4 |
}
|
5 |
create_index() {
|
6 |
let datetime_string = moment().format("YYYY-MM-DD_HH-mm-ss_SSS");
|
@@ -31,7 +31,7 @@ class ChatStorageItem {
|
|
31 |
}
|
32 |
}
|
33 |
|
34 |
-
class
|
35 |
constructor() {
|
36 |
this.init_database();
|
37 |
this.render_chat_history_sidebar_items();
|
@@ -86,4 +86,4 @@ class ChatHistoryStorer {
|
|
86 |
}
|
87 |
}
|
88 |
|
89 |
-
export let
|
|
|
1 |
class ChatStorageItem {
|
2 |
+
constructor(chat_history_storage) {
|
3 |
+
this.chat_history_storage = chat_history_storage;
|
4 |
}
|
5 |
create_index() {
|
6 |
let datetime_string = moment().format("YYYY-MM-DD_HH-mm-ss_SSS");
|
|
|
31 |
}
|
32 |
}
|
33 |
|
34 |
+
class ChatHistoryStorage {
|
35 |
constructor() {
|
36 |
this.init_database();
|
37 |
this.render_chat_history_sidebar_items();
|
|
|
86 |
}
|
87 |
}
|
88 |
|
89 |
+
export let chat_history_storage = new ChatHistoryStorage();
|
{networks β storages}/endpoint_storage.js
RENAMED
File without changes
|