From eaff01658c3a86cf9a8d95413457d4c9d942ea74 Mon Sep 17 00:00:00 2001 From: JOUNGWOOK KWON Date: Tue, 31 Mar 2026 21:17:55 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=85=94=EB=A0=88=EA=B7=B8=EB=9E=A8=20?= =?UTF-8?q?=EB=8C=80=ED=99=94=20Claude=20=ED=81=B4=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EC=96=B8=ED=8A=B8=EC=97=90=20cliproxy=20base=5Furl=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bots/scheduler.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bots/scheduler.py b/bots/scheduler.py index 8053eb0..4010f39 100644 --- a/bots/scheduler.py +++ b/bots/scheduler.py @@ -51,6 +51,7 @@ logger = logging.getLogger(__name__) TELEGRAM_BOT_TOKEN = os.getenv('TELEGRAM_BOT_TOKEN', '') TELEGRAM_CHAT_ID = os.getenv('TELEGRAM_CHAT_ID', '') ANTHROPIC_API_KEY = os.getenv('ANTHROPIC_API_KEY', '') +ANTHROPIC_BASE_URL = os.getenv('ANTHROPIC_BASE_URL', '') _claude_client: anthropic.Anthropic | None = None _conversation_history: dict[int, list] = {} @@ -1641,7 +1642,10 @@ async def handle_text(update: Update, context: ContextTypes.DEFAULT_TYPE): global _claude_client if _claude_client is None: - _claude_client = anthropic.Anthropic(api_key=ANTHROPIC_API_KEY) + kwargs = {'api_key': ANTHROPIC_API_KEY} + if ANTHROPIC_BASE_URL: + kwargs['base_url'] = ANTHROPIC_BASE_URL + _claude_client = anthropic.Anthropic(**kwargs) history = _conversation_history.setdefault(chat_id, []) history.append({"role": "user", "content": text})