Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a0709a4
feat: add web admin dashboard with cookie import, logs viewer, and co…
leolionart Feb 18, 2026
8eb4469
ci: add GitHub Actions workflow to build and push Docker image to GHCR
leolionart Feb 18, 2026
70e07e9
Merge feature/admin-dashboard: Admin UI + CI/CD
leolionart Feb 18, 2026
8443741
feat: add favicon and API Reference section to dashboard
leolionart Feb 18, 2026
1f86435
fix: persist config across Docker container restarts
leolionart Feb 18, 2026
a29e432
feat: add /v1/models endpoint and improve error handling
leolionart Feb 18, 2026
4062428
Merge feature/admin-dashboard: /v1/models endpoint + error handling
leolionart Feb 18, 2026
d7935c1
fix: show OpenAI Base URL with /v1 suffix for client compatibility
leolionart Feb 18, 2026
8e34993
Merge: show OpenAI Base URL with /v1
leolionart Feb 18, 2026
519e24b
refactor: clean up API Reference — show full URLs, remove noise
leolionart Feb 18, 2026
eef5a0b
Merge: clean up API Reference display
leolionart Feb 18, 2026
cddab61
feat: persist rotated Gemini cookies to config.conf on restart
leolionart Feb 18, 2026
aea0ef1
docs: simplify Docker deployment — no .env required
leolionart Feb 20, 2026
6390ba8
Merge branch 'feature/admin-dashboard'
leolionart Feb 20, 2026
d436380
docs: rewrite README focused on Docker Compose deployment flow
leolionart Feb 20, 2026
9495e28
docs: embed docker-compose.yml and config.conf inline — no clone needed
leolionart Feb 20, 2026
594946d
docs: bind mount config.conf to deploy folder, admin UI flow in README
leolionart Feb 20, 2026
c0f88fb
fix: redirect / to /admin
leolionart Feb 20, 2026
238e51e
fix: sync model names with gemini-webapi library
leolionart Feb 20, 2026
b9d6b58
fix: upgrade gemini-webapi to 1.19.2, update model names to Gemini 3.0
leolionart Feb 20, 2026
815a512
fix: simplify requirements.txt, fix pydantic/orjson conflict with gem…
leolionart Feb 20, 2026
9be1198
feat: redesign admin UI with Material Design 3 × Gemini theme
leolionart Feb 20, 2026
ca7b9ca
fix: retry transient Gemini errors (zombie stream / parse failure)
leolionart Feb 20, 2026
c172cb4
feat: multimodal support, /v1/responses, file upload, HA guide
leolionart Feb 22, 2026
e0b71c1
chore: bump version to 0.5.0
leolionart Feb 23, 2026
4aeb5da
docs: update README and replace server run assets
leolionart Feb 23, 2026
863c49a
chore: bump version to 0.5.1
leolionart Feb 23, 2026
3ae9f07
feat: add Telegram error notification system
leolionart Feb 23, 2026
8e96276
chore: bump version to 0.6.0
leolionart Feb 23, 2026
e6f96cc
fix: consistent Telegram UI layout + detect directory-as-config error
leolionart Feb 23, 2026
bbb003f
fix: auto-remove Docker-created directory at config path
leolionart Feb 23, 2026
e2857fb
chore: bump version to 0.6.1
leolionart Feb 23, 2026
660fe07
fix: use directory volume mount to prevent Docker creating config dir
leolionart Feb 23, 2026
6e03b84
chore: bump version to 0.6.2
leolionart Feb 23, 2026
9d3b194
feat: configurable Telegram notification error types
leolionart Feb 25, 2026
03b078c
chore: bump version to 0.7.0
leolionart Feb 25, 2026
ddc5f16
chore: add .playwright-mcp/ to .gitignore
leolionart Feb 28, 2026
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
54 changes: 54 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build & Push Docker Image

on:
push:
branches: [master]
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=sha,prefix=,format=short

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ __pycache__
.idea
config.conf
generated_media
har_and_cookies
har_and_cookies
# Playwright MCP
.playwright-mcp/
117 changes: 71 additions & 46 deletions Docker.md
Original file line number Diff line number Diff line change
@@ -1,86 +1,111 @@
## 🐳 Docker Deployment Guide
# 🐳 Docker Deployment Guide

### Prerequisites

Ensure you have the following installed on your system:
## Prerequisites

- [Docker](https://docs.docker.com/get-docker/)
- [Docker Compose v2.24+](https://docs.docker.com/compose/)
- GNU Make (optional but recommended)
- [Docker Compose v2](https://docs.docker.com/compose/) (included with Docker Desktop)

---

### 🛠️ Docker Environment Configuration

This project uses a `.env` file for environment-specific settings like development or production mode on docker.
## Quick Start

#### Example `.env`
### 1. Clone the repository

```env
# Set the environment mode
ENVIRONMENT=development
```bash
git clone https://github.com/leolionart/WebAI-to-API.git
cd WebAI-to-API
```

- `ENVIRONMENT=development`: Runs the server in **development** mode with auto-reload and debug logs.
- Change to `ENVIRONMENT=production` to enable **multi-worker production** mode with detached execution (`make up`).
### 2. Create your config file

> **Tip:** If this variable is not set, the default is automatically assumed to be `development`.
```bash
cp config.conf.example config.conf
```

---
Open `config.conf` and fill in your Gemini cookies:

### 🚀 Build & Run
```ini
[Cookies]
gemini_cookie_1psid = YOUR___Secure-1PSID_HERE
gemini_cookie_1psidts = YOUR___Secure-1PSIDTS_HERE
```

> Use `make` commands for simplified usage.
> **Where to get cookies:**
> 1. Log in to [gemini.google.com](https://gemini.google.com) in your browser
> 2. Open DevTools (`F12`) → **Application** → **Cookies** → `https://gemini.google.com`
> 3. Copy the values of `__Secure-1PSID` and `__Secure-1PSIDTS`

#### 🔧 Build the Docker image
### 3. Start the server

```bash
make build # Regular build
make build-fresh # Force clean build (no cache)
docker compose up -d
```

#### ▶️ Run the server
The API is now available at **`http://localhost:6969`**.

```bash
make up
```
---

## Cookie Persistence

Depending on the environment:
Config is stored in a Docker named volume (`webai_data`) mapped to `/app/data/config.conf` inside the container. This means:

- In **development**, the server runs in the foreground with hot-reloading.
- In **production**, the server runs in **detached mode** (`-d`) with multiple workers.
- Cookies survive container restarts and image updates
- The server automatically rotates `__Secure-1PSIDTS` every ~10 minutes and writes the updated value back to `config.conf` — so your session stays valid without manual intervention

#### ⏹ Stop the server
---

## Useful Commands

| Command | Description |
|---------|-------------|
| `docker compose up -d` | Start in background |
| `docker compose down` | Stop and remove containers |
| `docker compose logs -f` | Stream live logs |
| `docker compose pull && docker compose up -d` | Update to latest image |
| `docker compose restart` | Restart without recreating |

Or use the provided `Makefile` shortcuts:

```bash
make stop
make up # docker compose up -d
make down # docker compose down
make logs # docker compose logs -f
make pull # docker compose pull
make restart # down + up
```

---

### 🧠 Development Notes
## Building Locally

- **Reloading**: In development, the server uses `uvicorn --reload` for live updates.
- **Logging**: On container start, it prints the current environment with colors (🟡 dev / ⚪ production).
- **Watch Mode (optional)**: Docker Compose v2.24+ supports file watching via the `compose watch` feature. If enabled, press `w` to toggle.
If you want to build the image from source instead of pulling from GHCR:

```bash
docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build
```

Or edit `docker-compose.yml` directly: comment out the `image:` line and uncomment `build: .`.

---

### 📦 File Structure for Docker
## Changing the Port

Key files:
Edit `docker-compose.yml` and update the port mapping:

```plaintext
.
├── Dockerfile # Base image and command logic
├── docker-compose.yml # Shared config (network, ports, env)
├── .env # Defines ENVIRONMENT (development/production)
├── Makefile # Simplifies Docker CLI usage
```yaml
ports:
- "8080:6969" # expose on host port 8080 instead of 6969
```

---

### ✅ Best Practices
## File Overview

- Don't use `ENVIRONMENT=development` in **production**.
- Avoid bind mounts (`volumes`) in production to ensure image consistency.
```
.
├── Dockerfile # Image build instructions
├── docker-compose.yml # Main compose config (production)
├── docker-compose.dev.yml # Local build override
├── config.conf # Your config — cookies, model, proxy (gitignored)
└── config.conf.example # Template to copy from
```
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM python:3.11-slim

# Install build dependencies for native extensions (lz4, cffi, etc.)
RUN apt-get update && apt-get install -y --no-install-recommends gcc g++ && rm -rf /var/lib/apt/lists/*

# Install Requirements
WORKDIR /app
COPY requirements.txt .
Expand Down
34 changes: 15 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
# Makefile

# Load .env file if it exists
include .env
export $(shell sed 's/=.*//' .env)
# Makefile — convenience shortcuts for Docker operations

build:
docker build -t cornatul/webai.ai:latest .
docker compose build

build-fresh:
docker build --no-cache -t cornatul/webai.ai:latest .
docker compose build --no-cache

up:
@if [ "$(ENVIRONMENT)" = "development" ]; then \
printf "\033[1;33m🧪 Running in DEVELOPMENT mode...\033[0m\n"; \
docker-compose up; \
else \
printf "\033[0;37m🚀 Running in PRODUCTION mode...\033[0m\n"; \
docker-compose up -d; \
fi
docker compose up -d

stop:
docker-compose down
up-dev:
docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build

down:
docker-compose down
docker compose down

logs:
docker compose logs -f

pull:
docker compose pull

push:
docker push cornatul/webai.ai:latest
restart:
docker compose down && docker compose up -d
Loading