summaryrefslogtreecommitdiffstats
path: root/g4f/gui/client/js
diff options
context:
space:
mode:
authorabc <98614666+xtekky@users.noreply.github.com>2023-10-19 20:37:56 +0200
committerabc <98614666+xtekky@users.noreply.github.com>2023-10-19 20:37:56 +0200
commit5b52d5a2ee8c8e9142320ea72e3e5880429a4900 (patch)
treea1d8f03e4a17ff7ed4fd5af1bb4cb0f3c13652c8 /g4f/gui/client/js
parent~ | g4f v-0.1.6.7 (diff)
downloadgpt4free-5b52d5a2ee8c8e9142320ea72e3e5880429a4900.tar
gpt4free-5b52d5a2ee8c8e9142320ea72e3e5880429a4900.tar.gz
gpt4free-5b52d5a2ee8c8e9142320ea72e3e5880429a4900.tar.bz2
gpt4free-5b52d5a2ee8c8e9142320ea72e3e5880429a4900.tar.lz
gpt4free-5b52d5a2ee8c8e9142320ea72e3e5880429a4900.tar.xz
gpt4free-5b52d5a2ee8c8e9142320ea72e3e5880429a4900.tar.zst
gpt4free-5b52d5a2ee8c8e9142320ea72e3e5880429a4900.zip
Diffstat (limited to 'g4f/gui/client/js')
-rw-r--r--g4f/gui/client/js/chat.v2.js18
1 files changed, 12 insertions, 6 deletions
diff --git a/g4f/gui/client/js/chat.v2.js b/g4f/gui/client/js/chat.v2.js
index 03c3a87a..5c1cbca8 100644
--- a/g4f/gui/client/js/chat.v2.js
+++ b/g4f/gui/client/js/chat.v2.js
@@ -597,15 +597,21 @@ observer.observe(message_input, { attributes: true });
const load_models = async () => {
- response = await fetch('/backend-api/v2/models')
- models = await response.json()
+ models = localStorage.getItem('_models')
- var MODELS_SELECT = document.getElementById('model');
+ if (models === null) {
+ response = await fetch('/backend-api/v2/models')
+ models = await response.json()
+ localStorage.setItem('_models', JSON.stringify(models))
+
+ } else {
+ models = JSON.parse(models)
+ }
- for (model of models) {
+ let MODELS_SELECT = document.getElementById('model');
- // Create new option elements
- var model_info = document.createElement('option');
+ for (model of models) {
+ let model_info = document.createElement('option');
model_info.value = model
model_info.text = model