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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@ Thumbs.db
# Logs
*.log
data/logs/

# Python
__pycache__/
*.pyc
.venv/
venv/
.env.local

44 changes: 44 additions & 0 deletions AGENT_LOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# AGENT_LOG — CommandDesk

## Phase 0 — Intake
- Stack: Python 3.11 + FastAPI (agent_server), Redis (rate-limit/sessions), Docker Compose (10 services: llama.cpp, chroma, searxng, postgres, redis, n8n, nginx, email-fetcher).
- UI: static `admin/admin-dashboard.html` + `tools-ui/` chat widget. Ticket connectors in `ticket_platforms/`.
- Existing: README, Dockerfiles, compose (dev/prod/main), .env.example, LICENSE (MIT), CONTRIBUTING, SECURITY, issue templates, CI workflow.

## Phase 1 — Get It Running
- Local run needs `python3-venv` + `pip` (installed via apt). Created venv, installed core deps.
- **Bug: `requirements.txt` pinned `openai==1.59.0` which does not exist on PyPI** → `pip install` failed. `openai` is never imported by the app code. Removed the dead pin.
- **Bug: Dockerfile copied `scripts/*.py` to `/app/scripts/` but CMD runs `python -m uvicorn agent_server:app` from `/app`** → module not found in container. Fixed COPY target to `/app/`.
- Ran real API with Redis: `GET /health` → `{"status":"ok",...}` confirmed.

## Phase 2 — Fix & Harden
- **Real crash bug:** `rate_limiter.py:39` initialized `self._sessions` as a tuple `=()` instead of dict `={}` → every `/chat` and `/session` request raised `AttributeError: 'tuple' object has no attribute 'get'` (HTTP 500). Fixed to `= {}`. After fix, `/chat` works (graceful fallback when no LLM configured) and `/health` stable.
- Removed dead import `openai` dependency.
- Extended `.gitignore` (venv, \_\_pycache\_\_, .env.local).
- Secret scan: no committed secrets; `.env` not tracked; `.env.example` uses `change...n` placeholders. OK.

## Phase 3 — Dockerize
- Dockerfile already present; fixed module-path bug above. Full 10-service compose NOT executed end-to-end here: it requires a 7B GGUF model file (`./models/qwen2.5-7b-instruct-q4_k_m.gguf`) and pulling 7 auxiliary images — out of scope for this pass. The **core agent image + API was built/run and verified locally** (venv + Redis). Recorded as a known limitation.

## Phase 4 — Real Screenshots
- **Found fake screenshots:** the old `docs/screenshots/{dashboard,ai-assistant,costs}.png` were generated by `scripts/capture-screenshots.py`, which renders hardcoded HTML **mockups** (its own docstring admits "representative mockups, not screenshots from the running application"). Violates the no-fake-screenshot rule.
- Removed the 3 fake PNGs and deleted `capture-screenshots.py` and the root `dashboard-mockup.png` / `dashboard-realistic.png`.
- Captured **real** screenshots with Playwright against the running services:
- `docs/screenshots/api-health.png` — live `/health` JSON response
- `docs/screenshots/admin-dashboard.png` — the repo's actual `admin/admin-dashboard.html` UI
- `docs/screenshots/chat-widget.png` — the repo's actual `tools-ui/` widget UI

## Phase 5 — README
- Rewrote README to match reality:
- Replaced fake screenshot table with the 3 real captures.
- Corrected architecture: API-only server (`/health`, `/chat`, `/session`), not a server-rendered dashboard at :8080.
- Removed false claims: role-based auth (no auth code exists), default admin/agent credentials (none implemented), "analytics dashboard with live cost tracking" (not implemented).
- Fixed project-structure section to the actual layout.
- Added honest "Not yet implemented" warning box.
- Kept author credit (Jhonattan L. Jimenez / JorahOne LLC).

## Phase 7 — Commit & Push
- Branch: `agent/polish-pass`
- Commits: fix broken `_sessions` tuple init; remove unresolvable `openai` pin; fix Dockerfile module path; replace fake screenshots with real captures; rewrite README.

## Status: DONE (core API verified; full compose stack needs GGUF model + images)
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN pip install --no-cache-dir -r requirements.txt

# App code
COPY ticket_platforms /app/ticket_platforms
COPY scripts/*.py /app/scripts/
COPY scripts/*.py /app/
COPY config/ /app/config/

# Create data dirs
Expand Down
251 changes: 88 additions & 163 deletions README.md

Large diffs are not rendered by default.

Binary file removed dashboard-mockup.png
Binary file not shown.
Binary file removed dashboard-realistic.png
Binary file not shown.
Binary file added docs/screenshots/admin-dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/screenshots/ai-assistant.png
Binary file not shown.
Binary file added docs/screenshots/api-health.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/chat-widget.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/screenshots/costs.png
Binary file not shown.
Binary file removed docs/screenshots/dashboard.png
Binary file not shown.
3 changes: 0 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ psycopg2-binary==2.9.10
httpx==0.28.1
python-multipart==0.0.31

# LLM / OpenAI-compatible client
openai==1.59.0

# Knowledge base
chromadb==0.5.23

Expand Down
419 changes: 0 additions & 419 deletions scripts/capture-screenshots.py

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/rate_limiter.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class RateLimiter:
def __init__(self, config: RateLimitConfig, redis_client=None):
self.config = config
self.redis = redis_client
self._sessions: dict[str, SessionState] =()
self._sessions: dict[str, SessionState] = {}

def check_request(self, session_id: str, user_id: str, message_length: int = 0) -> dict:
"""
Expand Down
Loading