summaryrefslogtreecommitdiffstats
path: root/g4f/gui
diff options
context:
space:
mode:
Diffstat (limited to 'g4f/gui')
-rw-r--r--g4f/gui/client/index.html1
-rw-r--r--g4f/gui/client/static/js/chat.v1.js5
-rw-r--r--g4f/gui/server/api.py21
3 files changed, 16 insertions, 11 deletions
diff --git a/g4f/gui/client/index.html b/g4f/gui/client/index.html
index e650d7e0..63e47b3f 100644
--- a/g4f/gui/client/index.html
+++ b/g4f/gui/client/index.html
@@ -245,6 +245,7 @@
<select name="provider" id="provider">
<option value="">Provider: Auto</option>
<option value="OpenaiChat">OpenAI ChatGPT</option>
+ <option value="Copilot">Microsoft Copilot</option>
<option value="ChatGpt">ChatGpt</option>
<option value="Gemini">Gemini</option>
<option value="MetaAI">Meta AI</option>
diff --git a/g4f/gui/client/static/js/chat.v1.js b/g4f/gui/client/static/js/chat.v1.js
index 42ddb129..580cbf77 100644
--- a/g4f/gui/client/static/js/chat.v1.js
+++ b/g4f/gui/client/static/js/chat.v1.js
@@ -1367,7 +1367,8 @@ async function load_provider_models(providerIndex=null) {
modelProvider.classList.remove("hidden");
models.forEach((model) => {
let option = document.createElement('option');
- option.value = option.text = model.model;
+ option.value = model.model;
+ option.text = `${model.model}${model.image ? " (Image Generation)" : ""}${model.vision ? " (Image Upload)" : ""}`;
option.selected = model.default;
modelProvider.appendChild(option);
});
@@ -1381,7 +1382,7 @@ providerSelect.addEventListener("change", () => load_provider_models());
function save_storage() {
let filename = `chat ${new Date().toLocaleString()}.json`.replaceAll(":", "-");
let data = {"options": {"g4f": ""}};
- for (let i = 0; i < appStorage.length; i++){
+ for (let i = 0; i < appStorage.length; i++){label
let key = appStorage.key(i);
let item = appStorage.getItem(key);
if (key.startsWith("conversation:")) {
diff --git a/g4f/gui/server/api.py b/g4f/gui/server/api.py
index f03d2048..ed8454c3 100644
--- a/g4f/gui/server/api.py
+++ b/g4f/gui/server/api.py
@@ -42,7 +42,12 @@ class Api:
provider: ProviderType = __map__[provider]
if issubclass(provider, ProviderModelMixin):
return [
- {"model": model, "default": model == provider.default_model}
+ {
+ "model": model,
+ "default": model == provider.default_model,
+ "vision": getattr(provider, "default_vision_model", None) == model or model in getattr(provider, "vision_models", []),
+ "image": model in getattr(provider, "image_models", []),
+ }
for model in provider.get_models()
]
return []
@@ -65,7 +70,7 @@ class Api:
"url": parent.url,
"label": parent.label if hasattr(parent, "label") else None,
"image_model": model,
- "vision_model": parent.default_vision_model if hasattr(parent, "default_vision_model") else None
+ "vision_model": getattr(parent, "default_vision_model", None)
})
index.append(parent.__name__)
elif hasattr(provider, "default_vision_model") and provider.__name__ not in index:
@@ -82,13 +87,11 @@ class Api:
@staticmethod
def get_providers() -> list[str]:
return {
- provider.__name__: (
- provider.label if hasattr(provider, "label") else provider.__name__
- ) + (
- " (WebDriver)" if "webdriver" in provider.get_parameters() else ""
- ) + (
- " (Auth)" if provider.needs_auth else ""
- )
+ provider.__name__: (provider.label if hasattr(provider, "label") else provider.__name__)
+ + (" (Image Generation)" if hasattr(provider, "image_models") else "")
+ + (" (Image Upload)" if getattr(provider, "default_vision_model", None) else "")
+ + (" (WebDriver)" if "webdriver" in provider.get_parameters() else "")
+ + (" (Auth)" if provider.needs_auth else "")
for provider in __providers__
if provider.working
}