Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import logging
import sys

from agent_core import OpenAIAgent
from agents import enable_verbose_stdout_logging

from bot.agents import OpenAIAgent
from bot.auth import add_group
from bot.auth import allow_user
from bot.auth import confirm_pairing
Expand Down
292 changes: 0 additions & 292 deletions bot/agents.py

This file was deleted.

18 changes: 3 additions & 15 deletions bot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,13 @@
import os
from typing import Any

from agent_core.env import env_flag
from dotenv import find_dotenv
from dotenv import load_dotenv

logger = logging.getLogger(__name__)

_FALSY_ENV_VALUES = frozenset({"", "0", "false", "no", "off"})

__all__ = ["Configuration", "env_flag"]

def env_flag(name: str) -> bool:
"""Return True if env var ``name`` is set to a truthy value.

Common falsy spellings (empty, "0", "false", "no", "off") are treated as
disabled so that ``FOO=0`` behaves as users intuitively expect rather than
as Python's default "non-empty string is truthy" rule.
"""
raw = os.getenv(name)
if raw is None:
return False
return raw.strip().lower() not in _FALSY_ENV_VALUES
logger = logging.getLogger(__name__)


class Configuration:
Expand Down
2 changes: 1 addition & 1 deletion bot/telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging
from collections import deque

from agent_core import OpenAIAgent
from telegram import Message
from telegram import Update
from telegram.constants import ChatAction
Expand All @@ -14,7 +15,6 @@
from telegram.ext import MessageHandler
from telegram.ext import filters

from .agents import OpenAIAgent
from .auth import create_pairing_code
from .auth import get_dm_policy
from .auth import get_group_config
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = "Add your description here"
readme = "README.md"
requires-python = ">=3.14"
dependencies = [
"agent-core @ git+https://github.com/John-Lin/agent-core.git",
"mistune-telegram>=0.5.0",
"openai-agents>=0.13.0",
"python-dotenv>=1.1.0",
Expand Down Expand Up @@ -60,5 +61,8 @@ log_file_level = "INFO"
log_format = "%(asctime)s %(levelname)s %(message)s"
log_date_format = "%Y-%m-%d %H:%M:%S"

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = ["bot"]
Loading
Loading