Metadata-Version: 2.4
Name: fancall
Version: 0.1.0
Summary: AI-powered video call with virtual companions
License: Apache-2.0
Keywords: kpop,idol,fancall,livekit,ai-companion,video-call
Author: AIoIA, Inc.
Author-email: devops@aioia.ai
Requires-Python: >=3.10,<3.13
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: aioia-core (>=2.0.0,<3.0.0)
Requires-Dist: alembic (>=1.13.0,<2.0.0)
Requires-Dist: fastapi (>=0.115.0,<0.116.0)
Requires-Dist: httpx (>=0.27.0,<0.28.0)
Requires-Dist: livekit-agents[fishaudio,hedra,openai] (>=1.0.0,<2.0.0)
Requires-Dist: livekit-api (>=1.0.0,<2.0.0)
Requires-Dist: openai (>=1.0.0)
Requires-Dist: pillow (>=10.0.0,<11.0.0)
Requires-Dist: psycopg2-binary (>=2.9.0,<3.0.0)
Requires-Dist: pydantic (>=2.5.0,<3.0.0)
Requires-Dist: pydantic-settings (>=2.1.0,<3.0.0)
Requires-Dist: pyhumps (>=3.8.0,<4.0.0)
Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
Requires-Dist: sqlalchemy (>=2.0.0,<3.0.0)
Requires-Dist: sqlalchemy-mixins (>=2.0.0,<3.0.0)
Description-Content-Type: text/markdown

# Fancall Backend

AI 아이돌과 실시간 영상 통화 Python 패키지

## 주요 기능

- LiveKit 기반 실시간 음성/영상 통화
- Fish Audio TTS 음성 합성
- Hedra 아바타 지원 (선택)
- 동적 설정 (voice_id, avatar_id, system_prompt)

## 설치

```bash
cd backend
poetry install
poetry run uvicorn main:app --reload
```

API 문서:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc

## LiveKit 설정

### 서버

```bash
brew install livekit
livekit-server --dev
```

서버: `ws://localhost:7880` (API Key: `devkey`, Secret: `secret`)

### Agent

```bash
cd backend
export OPENAI_API_KEY=sk-...
export FISH_API_KEY=...

# 개발 모드
python -m fancall.agent.worker dev

# 프로덕션 모드
python -m fancall.agent.worker start

# 특정 룸 연결
python -m fancall.agent.worker connect --room <room-name>
```

## 사용법

### FastAPI 통합

```python
from fancall.api.router import create_fancall_router
from fancall.factories import LiveRoomRepositoryFactory
from fancall.settings import LiveKitSettings

router = create_fancall_router(
    livekit_settings=LiveKitSettings(),
    jwt_settings=jwt_settings,
    db_session_factory=db_session_factory,
    repository_factory=LiveRoomRepositoryFactory(db_session_factory),
)
app.include_router(router, prefix="/api")
```

## 개발

```bash
poetry install
make lint
make type-check
make unit-test
make format
```

## 환경 변수

| 변수명 | 필수 | 설명 |
|--------|------|------|
| `LIVEKIT_URL` | O | LiveKit 서버 URL |
| `LIVEKIT_API_KEY` | O | LiveKit API 키 |
| `LIVEKIT_API_SECRET` | O | LiveKit API 시크릿 |
| `OPENAI_API_KEY` | O | OpenAI API 키 |
| `FISH_API_KEY` | O | Fish Audio API 키 |
| `DATABASE_URL` | O | PostgreSQL/SQLite URL |

## 의존성

- aioia-core (공통 인프라)
- FastAPI, SQLAlchemy, Pydantic
- livekit-api, livekit-agents

## 라이선스

Apache 2.0

