python:3.8-slim is EOL (security support ended Oct 2024). Move to
python:3.12-slim and drop the pinned setuptools==59.5.0, which
predates 3.12 support; use the current setuptools instead.
Keep the ChatGPT class fallback model in sync with the new project
default. Callers always pass an explicit model, so this only affects
the no-argument fallback.
new_dialog_handle pins the model on every /new. Point it at the new
default gpt-4o-mini so starting a new dialog no longer drops users
back onto the outdated gpt-3.5-turbo.
The default model is taken from available_text_models[0] (used by
Database.add_new_user and the registration fallback). Move
gpt-4o-mini to the front so new users start on it; gpt-3.5-turbo is
outdated, while gpt-4o-mini is cheaper, smarter and supports vision.
This also makes it the first option in the /settings menu.
chatgpt_price_per_1000_tokens, gpt_price_per_1000_tokens and
whisper_price_per_1_min are not read by config.py; pricing is defined
per model in config/models.yml. Remove them from the example to avoid
implying they have any effect.
Replace the two bare 'except:' clauses (is_bot_mentioned and the
error handler fallback) with 'except Exception:' so they no longer
swallow KeyboardInterrupt, SystemExit or asyncio.CancelledError,
which must propagate for clean shutdown and task cancellation.
Exclude .git, Python bytecode caches, .DS_Store and the local
config.yml/config.env from the Docker build context so they are not
sent to the daemon or baked into the image.
Mount ./config into the bot container so config.yml / models.yml /
chat_modes.yml changes take effect with a simple restart instead of
a full image rebuild. Addresses #124.
Without unbuffered output the bot's stdout/stderr can sit in a
buffer, so 'docker logs' shows nothing until the buffer flushes.
Set PYTHONUNBUFFERED=1 so log lines appear in real time.
Follow-up to the openai 1.x migration: the legacy
openai.error.InvalidRequestError no longer exists in the 1.x SDK.
Catch openai.BadRequestError when DALL-E rejects a prompt.
gpt-4o and gpt-4o-mini use the o200k_base encoding, which tiktoken
only ships from 0.7.0 onwards. With the previous >=0.3.0 pin
tiktoken.encoding_for_model("gpt-4o") raises, breaking token
counting in streaming mode for those models.
logger.error(current_model) fired on every incoming message and
spammed the error log with the model name; the accompanying
'# What is this? ^^^' note was dead. Drop both; the vision
auto-switch logic is unchanged.
Wire gpt-4o-mini through the bot: register it in models.yml
(available list + pricing/scores entry) and add it to the model
sets in openai_utils (chat, streaming, vision and token counting).
gpt-4o-mini is cheaper and smarter than gpt-3.5-turbo and supports
images, so it is a good default-grade option. Addresses #474.
gpt-4-1106-preview, gpt-4-vision-preview and gpt-4o used lowercase
score keys (smart/fast/cheap) while the rest used capitalized ones.
These keys are shown verbatim as labels in /settings, so normalize
them for consistent display.