fix(blog-lab): AI 생성 콘텐츠에 현재 날짜 컨텍스트 추가

Claude API 호출 시 시스템 프롬프트에 현재 날짜를 포함하여
2024년이 아닌 실제 날짜 기준으로 콘텐츠가 생성되도록 수정.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-07 02:09:49 +09:00
parent 74891eaa60
commit 14674c4e9a
3 changed files with 10 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
import json
import logging
from datetime import date
from typing import Any, Dict, Optional
import anthropic
@@ -22,11 +23,13 @@ def _get_client() -> anthropic.Anthropic:
def _call_claude(prompt: str, max_tokens: int = 4096) -> str:
"""Claude API 호출. 단일 user 메시지."""
"""Claude API 호출. 단일 user 메시지. 현재 날짜 시스템 프롬프트 포함."""
client = _get_client()
today = date.today().isoformat()
resp = client.messages.create(
model=CLAUDE_MODEL,
max_tokens=max_tokens,
system=f"현재 날짜는 {today}입니다. 모든 콘텐츠는 이 날짜 기준으로 작성하세요.",
messages=[{"role": "user", "content": prompt}],
)
return resp.content[0].text