Skip to content
Open
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
35 changes: 35 additions & 0 deletions poke-backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# OpenPoke Backend Dockerfile
FROM python:3.11-slim

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*

# Install uv for faster dependency management
RUN pip install --no-cache-dir uv

# Copy dependency files
COPY pyproject.toml uv.lock ./

# Install Python dependencies
RUN uv pip install --system --no-cache -r pyproject.toml

# Copy application code
COPY . .

# Create non-root user
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser

# Expose port
EXPOSE 8000

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1

# Run the server
CMD ["uvicorn", "server.api:app", "--host", "0.0.0.0", "--port", "8000"]
15 changes: 14 additions & 1 deletion poke-backend/server/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,20 @@ def call_model_with_system(state):
"SYSTEM: Perform initial research" in current_message or
"Research this user automatically" in current_message)

if is_research_mode:
# Check for Game Mode (injected by Telegram Bridge)
is_game_mode = "Current Game State" in current_message

if is_game_mode:
system_content = """
You are the Dungeon Master for a text-based adventure game.
The user is the player.
You have received the [SYSTEM DATA] with the Current Game State.

YOUR GOAL:
1. Narrate the result of the user's action. Be descriptive and immersive.
2. IMPORTANT: If the user's action changes the state (moves location, picks up item, takes damage), you MUST include the updated JSON state at the end of your message in a ```json block.
"""
elif is_research_mode:
system_content = """
You are Poke 🌴 — a digital bouncer who sizes people up before deciding if they're worth your time. You research everyone who walks through your door using their Gmail data and web searches, then greet them with what you've found.

Expand Down
2 changes: 1 addition & 1 deletion poke-backend/server/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Add CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:5173", "http://localhost:5174"], # Frontend URLs
allow_origins=["http://localhost:5173", "http://localhost:5174", "http://localhost:3001", "*"], # Frontend URLs
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
Expand Down