Add version
This commit is contained in:
@@ -80,7 +80,9 @@ def get_optimal_model(base_type="pro"):
|
||||
if "latest" in n: return 50
|
||||
return 100
|
||||
return sorted(candidates, key=score, reverse=True)[0]
|
||||
except: return f"models/gemini-1.5-{base_type}"
|
||||
except Exception as e:
|
||||
utils.log("SYSTEM", f"⚠️ Error finding optimal model: {e}")
|
||||
return f"models/gemini-1.5-{base_type}"
|
||||
|
||||
def get_default_models():
|
||||
return {
|
||||
@@ -116,7 +118,12 @@ def select_best_models(force_refresh=False):
|
||||
|
||||
try:
|
||||
utils.log("SYSTEM", "Refreshing AI model list from API...")
|
||||
models = [m.name for m in genai.list_models() if 'generateContent' in m.supported_generation_methods and 'gemini' in m.name.lower()]
|
||||
all_models = list(genai.list_models())
|
||||
raw_model_names = [m.name for m in all_models]
|
||||
utils.log("SYSTEM", f"Found {len(all_models)} raw models from Google API.")
|
||||
|
||||
models = [m.name for m in all_models if 'generateContent' in m.supported_generation_methods and 'gemini' in m.name.lower()]
|
||||
utils.log("SYSTEM", f"Identified {len(models)} compatible Gemini models: {models}")
|
||||
|
||||
bootstrapper = get_optimal_model("flash")
|
||||
utils.log("SYSTEM", f"Bootstrapping model selection with: {bootstrapper}")
|
||||
@@ -160,7 +167,12 @@ def select_best_models(force_refresh=False):
|
||||
|
||||
if not os.path.exists(config.DATA_DIR): os.makedirs(config.DATA_DIR)
|
||||
with open(cache_path, 'w') as f:
|
||||
json.dump({"timestamp": int(time.time()), "models": selection, "available_at_time": models}, f, indent=2)
|
||||
json.dump({
|
||||
"timestamp": int(time.time()),
|
||||
"models": selection,
|
||||
"available_at_time": models,
|
||||
"raw_models": raw_model_names
|
||||
}, f, indent=2)
|
||||
return selection
|
||||
except Exception as e:
|
||||
utils.log("SYSTEM", f"AI Model Selection failed: {e}.")
|
||||
|
||||
Reference in New Issue
Block a user