diff --git a/app.py b/app.py index aad2cd2b..3a85ebdd 100644 --- a/app.py +++ b/app.py @@ -57,6 +57,10 @@ class Gpt4AllWebUI: self.add_endpoint( "/list_models", "list_models", self.list_models, methods=["GET"] ) + self.add_endpoint( + "/list_personalities", "list_personalities", self.list_personalities, methods=["GET"] + ) + self.add_endpoint( "/list_discussions", "list_discussions", self.list_discussions, methods=["GET"] ) @@ -128,6 +132,11 @@ class Gpt4AllWebUI: models_dir = Path('./models') # replace with the actual path to the models folder models = [f.name for f in models_dir.glob('*.bin')] return jsonify(models) + + def list_personalities(self): + personalities_dir = Path('./personalities') # replace with the actual path to the models folder + personalities = [f.name for f in personalities_dir.glob('*.yaml')] + return jsonify(personalities) def list_discussions(self): discussions = self.db.get_discussions() diff --git a/static/images/reset_db.png b/static/images/reset_db.png new file mode 100644 index 00000000..29c311e9 Binary files /dev/null and b/static/images/reset_db.png differ diff --git a/static/js/discussions.js b/static/js/discussions.js index 71ea8f61..7406f467 100644 --- a/static/js/discussions.js +++ b/static/js/discussions.js @@ -200,7 +200,10 @@ const actionBtns = document.querySelector('#action-buttons'); actionBtns.appendChild(exportDiscussionButton); const newDiscussionBtn = document.querySelector('#new-discussion-btn'); +const resetDBButton = document.querySelector('#reset-discussions-btn'); +resetDBButton.addEventListener('click', () => { +}); newDiscussionBtn.addEventListener('click', () => { const chatWindow = document.getElementById('chat-window'); diff --git a/static/js/settings.js b/static/js/settings.js index e31048b2..acdb8beb 100644 --- a/static/js/settings.js +++ b/static/js/settings.js @@ -144,6 +144,30 @@ function populate_models(){ } }); + // Fetch the list of .yaml files from the models subfolder + fetch('/list_personalities') + .then(response => response.json()) + .then(data => { + if (Array.isArray(data)) { + // data is an array + const selectElement = document.getElementById('personalities'); + data.forEach(filename => { + const optionElement = document.createElement('option'); + optionElement.value = filename; + optionElement.textContent = filename; + selectElement.appendChild(optionElement); + }); + + // fetch('/get_args') + // .then(response=> response.json()) + // .then(data=>{ + + // }) + } else { + console.error('Expected an array, but received:', data); + } + }); + } populate_models() diff --git a/templates/extensions.html b/templates/extensions.html index c14f4d4e..4913a29a 100644 --- a/templates/extensions.html +++ b/templates/extensions.html @@ -1 +1,8 @@ -This section is under development. Stay tuned. \ No newline at end of file +This section is under development. Stay tuned.
+To have a glimpse of what extensions and options will be added, please look at my chatgpt-personality-selector google chrome extension:
+
+* https://chrome.google.com/webstore/detail/chatgpt-personality-selec/jdmpccdlifdkhniemenfmieffkdblahk?hl=en +
+
+After installing the extension, go to and the extension popup will apear.
+All personalities will be implemented to gpt4All and can be used with any llamacpp model. diff --git a/templates/main.html b/templates/main.html index 389ef339..edde9e06 100644 --- a/templates/main.html +++ b/templates/main.html @@ -4,6 +4,9 @@ + diff --git a/templates/settings.html b/templates/settings.html index e29088b0..7d24947d 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -5,6 +5,12 @@ +
+ + +
+
@@ -23,7 +29,7 @@
- +