betterbot/instance.py
Andre K e68c84424f
Some checks failed
Deploy BetterBot / deploy (push) Failing after 3s
Deploy BetterBot / notify (push) Successful in 3s
feat: fork from CodeAnywhere framework
Replace standalone Telegram bot with full CodeAnywhere framework fork.
BetterBot shares all framework code and customizes only:
- instance.py: BetterBot identity, system prompt, feature flags
- tools/site_editing/: list_files, read_file, write_file with auto git push
- .env: model defaults and site directory paths
- compose/: Docker setup with betterlifesg + memoraiz mounts
- deploy script: RackNerd with Infisical secrets
2026-04-19 08:01:27 +08:00

90 lines
3.6 KiB
Python

"""BetterBot instance configuration.
BetterBot is a fork of CodeAnywhere tailored for editing the Better Life SG
website and Memoraiz frontend via Telegram. This file is the only
customization point — everything else is shared framework code.
"""
from __future__ import annotations
# ── Identity ─────────────────────────────────────────────────────
BOT_NAME = "BetterBot"
BOT_DESCRIPTION = "Telegram bot for editing Better Life SG website and Memoraiz"
FASTAPI_TITLE = "BetterBot"
# ── System prompt ────────────────────────────────────────────────
BASE_CONTEXT = """\
You are BetterBot, a helpful assistant that manages two projects:
1. **Better Life SG website** (project: "betterlifesg")
- Static HTML site using Tailwind CSS (loaded via CDN)
- Key files: index.html, fresh-grads.html, prenatal.html, retirement.html, \
legacy.html, team.html, contact.html, images/ folder
- Brand color: teal (#00b49a)
- Changes go live immediately after writing
2. **Memoraiz app** (project: "memoraiz")
- React 19 + Vite 6 + Tailwind CSS 4 frontend
- Source code is under frontend/src/ (pages in frontend/src/pages/, \
components in frontend/src/components/)
- Changes require a rebuild to go live (handled automatically after you write)
When the user asks you to change something:
1. Ask which project if unclear (default to betterlifesg for website questions)
2. First read the relevant file(s) to understand the current state
3. Make the requested changes
4. Write the updated file back
5. Confirm what you changed
When writing a file, always write the COMPLETE file content — never partial.
Keep your responses concise and friendly. Always confirm changes after making them.
Do NOT change the overall page structure unless explicitly asked.
"""
SKILLS_CONTEXT = ""
# ── Skill directories ────────────────────────────────────────────
def skill_directories() -> list[str]:
"""BetterBot does not use skill directories."""
return []
# ── Tool registration ────────────────────────────────────────────
def register_tools() -> None:
"""Register BetterBot's site-editing tools."""
from tool_registry import registry
from tools.site_editing import site_editing_toolset
registry.register(site_editing_toolset)
# ── Telegram ─────────────────────────────────────────────────────
TELEGRAM_START_MESSAGE = (
"Hi! I'm BetterBot 🤖\n\n"
"I manage two projects:\n"
"• **Better Life SG** website\n"
"• **Memoraiz** app\n\n"
"Just tell me what you'd like to change!\n\n"
"Examples:\n"
'"Change the WhatsApp number to 91234567"\n'
'"Update Hendri\'s title to Senior Consultant"\n'
'"Update the login page text in Memoraiz"\n\n'
"/reset — start a fresh conversation\n"
"/model <name> — switch LLM model\n"
"/current — show current model\n"
"Send a photo with an optional caption to ask about an image."
)
# ── Features ─────────────────────────────────────────────────────
ENABLE_WEB_UI = False
ENABLE_TELEGRAM = True
ENABLE_CHATKIT = False
ENABLE_BACKGROUND_AGENTS = False