lea-GEO / dify /README.md
hsmm's picture
feat: use public R2 URL for evidence
99d919e
# Dify Import/Export Baseline (Required)
This repo will generate a Dify-importable Workflow App JSON at `dify/geo-workflow.app.json`.
Because Dify export formats can vary by version/deployment, you must first export a minimal Workflow app from YOUR Dify instance and place it here:
- `dify/sample/dify-export.json`
## 1) Export sample (manual)
1. In Dify UI, create a minimal Workflow App (one node is fine).
2. Use the UI Export function to export JSON.
3. Save the exported JSON as `dify/sample/dify-export.json` in this repo.
## 2) Validate sample JSON (local)
Run:
`powershell -NoProfile -Command "Get-Content dify/sample/dify-export.json -Raw | ConvertFrom-Json > $null; 'OK'"`
Expected output: `OK`
## 3) Validate generated GEO workflow JSON
After `dify/sample/dify-export.json` exists, validate the generated file with:
`powershell -NoProfile -File scripts/verify-dify-app-json.ps1 -Path dify/geo-workflow.app.json -SamplePath dify/sample/dify-export.json -Strict`
## Repo DSL (source-of-truth)
This repo also includes a human-maintained workflow spec:
- `dify/dify_geo_checker_cn.dsl.yml`
It captures the intended nodes, variables, and data flow. Once we have a real Dify export baseline, we can generate an importable Dify app JSON from this DSL.
## Stack (recommended)
This repository includes a Docker Compose stack for:
- `runner_service/` (FastAPI + Playwright; stores evidence in MinIO)
- `db_service/` (FastAPI + Postgres; brand-pairs + persistence endpoints)
- `postgres` + `minio`
Quick start (manual):
- `cp .env.example .env`
- `docker compose up -d --build`
- Smoke check: `powershell -NoProfile -File scripts/smoke-local.ps1`
## Hugging Face Spaces (single FastAPI)
For Hugging Face Spaces (Docker), use the repo root `Dockerfile` which runs a single FastAPI app:
- Runner API under `/runner/*`
- DB API under `/db/*`
When running the Dify workflow (`dify/dify_geo_checker_cn.dsl.yml`), set:
- `runner_base_url` to `https://<space>.hf.space/runner`
- `db_service_base_url` to `https://<space>.hf.space/db`
Supabase + external MinIO config template: `.env.hf.example`
### Evidence URL (Cloudflare R2 public)
If you enabled Cloudflare R2 public access and your public URL works as:
- `https://pub-xxxx.r2.dev/<object-key>`
Set:
- `RUNNER_S3_PUBLIC_BASE_URL=https://pub-xxxx.r2.dev`
Then the Runner returns screenshot URLs using the public domain (clickable in dashboards).