feat: v3.2 나머지 미완성 기능 구현
[Instagram Reels] Phase 2 완성 - instagram_bot.py: publish_reels() 추가 (MP4 → Reels API) - upload_video_container(), wait_for_video_ready() 구현 - 로컬 경로 → 공개 URL 자동 변환 (image_host.get_public_video_url()) - scheduler.py: job_distribute_instagram_reels() 추가 (10:30) - image_host.py: get_public_video_url() + 로컬 비디오 서버 추가 - VIDEO_HOST_BASE_URL 환경변수 지원 (Tailscale/CDN) [writer_bot.py] 신규 — 독립 실행형 글쓰기 봇 - api_content.py manual-write 엔드포인트에서 subprocess 호출 가능 - run_pending(): 오늘 날짜 미처리 글감 자동 처리 - run_from_topic(): 직접 주제 지정 - run_from_file(): JSON 파일 지정 - CLI: python bots/writer_bot.py [--topic "..." | --file path.json | --limit N] [보조 시스템 신규] v3.1 CLI + Assist 모드 - blog.cmd: venv Python 경유 Windows 런처 - blog_runtime.py + runtime_guard.py: 실행 진입점 + venv 검증 - blog_engine_cli.py: 대시보드 API 기반 CLI (blog status, blog review 등) - bots/assist_bot.py: URL 기반 수동 어시스트 파이프라인 - dashboard/backend/api_assist.py + frontend/Assist.jsx: 수동모드 탭 [engine_loader.py] v3.1 개선 - OpenClawWriter: --json 플래그 + payloads 파싱 + plain text 폴백 - ClaudeWebWriter: Playwright 쿠키 세션 (Cloudflare 차단으로 현재 비활성) - GeminiWebWriter: gemini-webapi 비공식 클라이언트 [scheduler.py] v3.1 개선 - _call_openclaw(): 플레이스홀더 → EngineLoader 실제 호출 - _build_openclaw_prompt(): 구조화된 HTML 원고 프롬프트 - data/originals/: 원본 article JSON 저장 경로 추가 [설정/환경] 정비 - .env.example: SEEDANCE/ELEVENLABS/GEMINI/RUNWAY 복원 + VIDEO_HOST_BASE_URL, GEMINI_WEB_* , REMOTE_CLAUDE_POLLING_ENABLED 추가 - scripts/setup.bat: data/originals, outputs, assist, novels, config/novels 디렉토리 생성 + 폰트 다운로드 + blog.cmd 기반 Task Scheduler 등록 - requirements.txt: fastapi, uvicorn, python-multipart 추가 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,13 +4,14 @@ Content 탭 API — 칸반 보드, 승인/거부, 수동 트리거
|
||||
"""
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from pydantic import BaseModel
|
||||
|
||||
from runtime_guard import project_python_path, run_with_project_python
|
||||
|
||||
BASE_DIR = Path(__file__).parent.parent.parent
|
||||
DATA_DIR = BASE_DIR / "data"
|
||||
|
||||
@@ -115,8 +116,17 @@ async def reject_content(item_id: str):
|
||||
@router.post("/manual-write")
|
||||
async def manual_write(req: WriteRequest):
|
||||
"""collector_bot + writer_bot 수동 트리거"""
|
||||
python = sys.executable
|
||||
bots_dir = BASE_DIR / "bots"
|
||||
python = project_python_path()
|
||||
|
||||
if not python.exists():
|
||||
raise HTTPException(
|
||||
status_code=500,
|
||||
detail=(
|
||||
f"프로젝트 가상환경 Python이 없습니다: {python}. "
|
||||
"venv 생성 후 requirements.txt를 설치하세요."
|
||||
),
|
||||
)
|
||||
|
||||
results = []
|
||||
|
||||
@@ -124,8 +134,8 @@ async def manual_write(req: WriteRequest):
|
||||
collector = bots_dir / "collector_bot.py"
|
||||
if collector.exists():
|
||||
try:
|
||||
result = subprocess.run(
|
||||
[python, str(collector)],
|
||||
result = run_with_project_python(
|
||||
[str(collector)],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=120,
|
||||
@@ -135,22 +145,23 @@ async def manual_write(req: WriteRequest):
|
||||
results.append({
|
||||
"step": "collector",
|
||||
"success": result.returncode == 0,
|
||||
"python": str(python),
|
||||
"output": result.stdout[-500:] if result.stdout else "",
|
||||
"error": result.stderr[-300:] if result.stderr else "",
|
||||
})
|
||||
except subprocess.TimeoutExpired:
|
||||
results.append({"step": "collector", "success": False, "error": "타임아웃"})
|
||||
results.append({"step": "collector", "success": False, "python": str(python), "error": "타임아웃"})
|
||||
except Exception as e:
|
||||
results.append({"step": "collector", "success": False, "error": str(e)})
|
||||
results.append({"step": "collector", "success": False, "python": str(python), "error": str(e)})
|
||||
else:
|
||||
results.append({"step": "collector", "success": False, "error": "파일 없음"})
|
||||
results.append({"step": "collector", "success": False, "python": str(python), "error": "파일 없음"})
|
||||
|
||||
# writer_bot 실행
|
||||
writer = bots_dir / "writer_bot.py"
|
||||
if writer.exists():
|
||||
try:
|
||||
result = subprocess.run(
|
||||
[python, str(writer)],
|
||||
result = run_with_project_python(
|
||||
[str(writer)],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=300,
|
||||
@@ -160,14 +171,15 @@ async def manual_write(req: WriteRequest):
|
||||
results.append({
|
||||
"step": "writer",
|
||||
"success": result.returncode == 0,
|
||||
"python": str(python),
|
||||
"output": result.stdout[-500:] if result.stdout else "",
|
||||
"error": result.stderr[-300:] if result.stderr else "",
|
||||
})
|
||||
except subprocess.TimeoutExpired:
|
||||
results.append({"step": "writer", "success": False, "error": "타임아웃"})
|
||||
results.append({"step": "writer", "success": False, "python": str(python), "error": "타임아웃"})
|
||||
except Exception as e:
|
||||
results.append({"step": "writer", "success": False, "error": str(e)})
|
||||
results.append({"step": "writer", "success": False, "python": str(python), "error": str(e)})
|
||||
else:
|
||||
results.append({"step": "writer", "success": False, "error": "파일 없음"})
|
||||
results.append({"step": "writer", "success": False, "python": str(python), "error": "파일 없음"})
|
||||
|
||||
return {"results": results}
|
||||
return {"python": str(python), "results": results}
|
||||
|
||||
Reference in New Issue
Block a user