From e983a425c6bdb30c8180a982984c94a182592b1e Mon Sep 17 00:00:00 2001 From: Isaac Johnson Date: Fri, 30 Oct 2026 09:24:30 -0500 Subject: [PATCH] 0.3, fix perf issues by having static canned on first launch --- app.py | 13 ++++++++++++- version.ini | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 0510fda..f3c6310 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,5 @@ import os +import random import configparser import requests from flask import Flask, render_template_string, jsonify, send_from_directory @@ -10,6 +11,16 @@ OLLAMA_MODEL = os.environ.get("OLLAMA_MODEL", "gemma4:e4b") PROMPT = os.environ.get("JOKE_PROMPT", "tell me a dad joke about programming") PORT = int(os.environ.get("PORT", "80")) +PRESET_JOKES = [ + "What do you call parenting with a software engineer? Pair programming (or O-pair programming).", + "My kids were rolling on the floor and screaming. My wife asked what was happening, and I told her it was a version conflict.", + "When I wrote this code, only God and I knew how it worked. Now, only God knows.", + "A programmer is sent to the store by his wife: “Get a gallon of milk, and if they have eggs, get a dozen.” The programmer returns home with 13 gallons of milk and says, “They had eggs”.", + "Where do coder dads store all their projects? In a dad-abase.", + "Why don't programmers like going outside into nature? Too many bugs.", + "Why did the programmer die taking a shower? The shampoo bottle instructions said: Lather. Rinse. Repeat." +] + def get_app_version(): config = configparser.ConfigParser() version_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "version.ini") @@ -696,7 +707,7 @@ def request_joke(): @app.route("/") def index(): - joke = request_joke() + joke = random.choice(PRESET_JOKES) version = get_app_version() return render_template_string( HTML_TEMPLATE, diff --git a/version.ini b/version.ini index e20caa7..a61563f 100644 --- a/version.ini +++ b/version.ini @@ -1,2 +1,2 @@ [metadata] -version = 0.2 +version = 0.3