🐛 Bug: Fix the bug where GitHub models cannot retrieve the model when the model field is not set.
Browse files
utils.py
CHANGED
@@ -205,9 +205,10 @@ def update_initial_model(api_url, api):
|
|
205 |
endpoint_models_url = endpoint.v1_models
|
206 |
if isinstance(api, list):
|
207 |
api = api[0]
|
|
|
208 |
response = httpx.get(
|
209 |
endpoint_models_url,
|
210 |
-
headers=
|
211 |
)
|
212 |
models = response.json()
|
213 |
if models.get("error"):
|
@@ -260,6 +261,16 @@ def update_config(config_data, use_config_url=False):
|
|
260 |
safe_get(provider, "preferences", "api_key_rate_limit", default={"default": "999999/min"})
|
261 |
)
|
262 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
if not provider.get("model"):
|
264 |
model_list = update_initial_model(provider['base_url'], provider['api'])
|
265 |
if model_list:
|
|
|
205 |
endpoint_models_url = endpoint.v1_models
|
206 |
if isinstance(api, list):
|
207 |
api = api[0]
|
208 |
+
headers = {"Authorization": f"Bearer {api}"}
|
209 |
response = httpx.get(
|
210 |
endpoint_models_url,
|
211 |
+
headers=headers,
|
212 |
)
|
213 |
models = response.json()
|
214 |
if models.get("error"):
|
|
|
261 |
safe_get(provider, "preferences", "api_key_rate_limit", default={"default": "999999/min"})
|
262 |
)
|
263 |
|
264 |
+
if "models.inference.ai.azure.com" in provider['base_url'] and not provider.get("model"):
|
265 |
+
provider['model'] = [
|
266 |
+
"gpt-4o",
|
267 |
+
"gpt-4o-mini",
|
268 |
+
"o1-mini",
|
269 |
+
"o1-preview",
|
270 |
+
"text-embedding-3-small",
|
271 |
+
"text-embedding-3-large",
|
272 |
+
]
|
273 |
+
|
274 |
if not provider.get("model"):
|
275 |
model_list = update_initial_model(provider['base_url'], provider['api'])
|
276 |
if model_list:
|