Add version

This commit is contained in:
2026-02-20 09:55:21 -05:00
parent 442406628a
commit 5e0def99c1
5 changed files with 55 additions and 5 deletions

View File

@@ -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}.")

View File

@@ -37,6 +37,10 @@ login_manager.init_app(app)
def load_user(user_id):
return db.session.get(User, int(user_id))
@app.context_processor
def inject_globals():
return dict(app_version=config.VERSION)
# --- SETUP ---
with app.app_context():
db.create_all()