diff options
author | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-03-16 14:40:06 +0100 |
---|---|---|
committer | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-03-16 14:40:06 +0100 |
commit | f861f322aa0a688fa81df360129530b1e70519bc (patch) | |
tree | c9bb5dd70ec23c05c380e8abf9907b11e67d6a81 /g4f/gui/client/static/js | |
parent | Serverless webview gui (diff) | |
download | gpt4free-f861f322aa0a688fa81df360129530b1e70519bc.tar gpt4free-f861f322aa0a688fa81df360129530b1e70519bc.tar.gz gpt4free-f861f322aa0a688fa81df360129530b1e70519bc.tar.bz2 gpt4free-f861f322aa0a688fa81df360129530b1e70519bc.tar.lz gpt4free-f861f322aa0a688fa81df360129530b1e70519bc.tar.xz gpt4free-f861f322aa0a688fa81df360129530b1e70519bc.tar.zst gpt4free-f861f322aa0a688fa81df360129530b1e70519bc.zip |
Diffstat (limited to 'g4f/gui/client/static/js')
-rw-r--r-- | g4f/gui/client/static/js/chat.v1.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/g4f/gui/client/static/js/chat.v1.js b/g4f/gui/client/static/js/chat.v1.js index bfe641d5..6d45dfd7 100644 --- a/g4f/gui/client/static/js/chat.v1.js +++ b/g4f/gui/client/static/js/chat.v1.js @@ -811,7 +811,7 @@ async function on_api() { register_settings_storage(); - versions = await api('version') + versions = await api("version"); document.title = 'g4f - ' + versions["version"]; let text = "version ~ " if (versions["version"] != versions["latest_version"]) { @@ -825,19 +825,19 @@ async function on_api() { models = await api("models"); models.forEach((model) => { - let option = document.createElement('option'); + let option = document.createElement("option"); option.value = option.text = model; modelSelect.appendChild(option); }); - providers = await api('providers') + providers = await api("providers") providers.forEach((provider) => { - let option = document.createElement('option'); + let option = document.createElement("option"); option.value = option.text = provider; providerSelect.appendChild(option); }) - load_provider_models(); + await load_provider_models(appStorage.getItem("provider")); load_settings_storage() } @@ -965,8 +965,11 @@ async function read_response(response) { } } -async function load_provider_models() { - const provider = providerSelect.options[providerSelect.selectedIndex].value; +async function load_provider_models(providerIndex=null) { + if (!providerIndex) { + providerIndex = providerSelect.selectedIndex; + } + const provider = providerSelect.options[providerIndex].value; if (!provider) { return; } @@ -986,7 +989,7 @@ async function load_provider_models() { modelSelect.classList.remove("hidden"); } }; -providerSelect.addEventListener("change", load_provider_models) +providerSelect.addEventListener("change", () => load_provider_models()); function save_storage() { let filename = new Date().toLocaleString() |