From 5e0def99c19c8c0caba3a103e2f7b29bbdb10a63 Mon Sep 17 00:00:00 2001 From: Mike Wichers Date: Fri, 20 Feb 2026 09:55:21 -0500 Subject: [PATCH] Add version --- config.py | 5 ++++- modules/ai.py | 18 +++++++++++++++--- modules/web_app.py | 4 ++++ templates/base.html | 2 +- templates/system_status.html | 31 +++++++++++++++++++++++++++++++ 5 files changed, 55 insertions(+), 5 deletions(-) diff --git a/config.py b/config.py index 7c4dfbd..099a13e 100644 --- a/config.py +++ b/config.py @@ -61,4 +61,7 @@ LENGTH_DEFINITIONS = { "3": {"label": "Novella", "words": "20,000 - 40,000", "chapters": 15, "depth": 2}, "4": {"label": "Novel", "words": "60,000 - 80,000", "chapters": 30, "depth": 3}, "5": {"label": "Epic", "words": "100,000+", "chapters": 50, "depth": 4} -} \ No newline at end of file +} + +# --- SYSTEM --- +VERSION = "1.1.0" \ No newline at end of file diff --git a/modules/ai.py b/modules/ai.py index dbeae7d..3dec6ba 100644 --- a/modules/ai.py +++ b/modules/ai.py @@ -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}.") diff --git a/modules/web_app.py b/modules/web_app.py index 7df309a..94bc652 100644 --- a/modules/web_app.py +++ b/modules/web_app.py @@ -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() diff --git a/templates/base.html b/templates/base.html index e198a0e..3f88024 100644 --- a/templates/base.html +++ b/templates/base.html @@ -33,7 +33,7 @@ {% endif %}