# agent-project **Repository Path**: RRRRRDong/agent-project ## Basic Information - **Project Name**: agent-project - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-04 - **Last Updated**: 2026-06-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # AIGC Project React + Ant Design front end with a Python FastAPI LangGraph agent service. ## Stack - Frontend: Vite, React, TypeScript, Ant Design - Backend: FastAPI, LangGraph, LangChain OpenAI integration - Model gateway: NewAPI-compatible OpenAI API ## Implemented scenario This project now includes the "爆款视频复刻改造" workflow: - Create a replication project from a competitor viral video URL or uploaded video. - Add the merchant's own product images or describe the target product in natural language. - Analyze the viral structure with LangGraph agents. - Generate product-replacement, cross-border localization, audience, selling-point, style, or scene variants from the same workflow. - Submit a render job that creates per-shot video tasks through a configurable NewAPI video adapter. When `NEWAPI_VIDEO_MODE=mock`, render jobs produce JSON manifests under `/generated/...` so the full product flow can be tested without a real video model. It also includes the "爆款图文批量复刻" workflow: - Create a content replication project from a viral article, link, or topic. - Decompose the source into topic, title pattern, body pattern, emotion curve, and story angles. - Let the user assign custom counts per generated story angle, then generate exactly that many pieces. - Run large content pools as background jobs, batching generation in small chunks and exposing progress for polling. - Try to read public HTML from pasted links; if the source cannot be fetched, paste the article text instead. - Generate copy and image together in the same content job: copy uses `NEWAPI_MODEL` such as `deepseek-v4-pro`, and images use `NEWAPI_IMAGE_MODEL` such as `gpt-image-2`. When `NEWAPI_IMAGE_MODE=mock`, image tasks produce SVG previews under `/generated/...`. Set `NEWAPI_IMAGE_MODE` to a non-`mock` value and configure `NEWAPI_IMAGE_MODEL`/`NEWAPI_IMAGE_ENDPOINT` to call a real image model such as `gpt-image-2`. ## Agent framework choice This project uses LangGraph. It gives the Python agent an explicit state graph, so the product can grow from a planner into multi-step analysis, replacement strategy, compliance review, rendering, retry, and memory workflows without changing the service shape. ## Setup ```bash cp backend/.env.example backend/.env npm install npm --prefix frontend install python3 -m venv backend/.venv backend/.venv/bin/pip install -r backend/requirements.txt ``` Edit `backend/.env`: ```dotenv NEWAPI_DOMAIN=https://your-newapi-domain NEWAPI_API_KEY=sk-... NEWAPI_MODEL=deepseek-v4-pro NEWAPI_SCRIPT_MODEL=deepseek-v4-pro NEWAPI_QA_MODEL=deepseek-v4-pro NEWAPI_SOURCE_DIALOGUE_MODEL=doubao-seed-2-0-pro-260215 NEWAPI_SOURCE_DIALOGUE_ENDPOINT=/v1/responses NEWAPI_VIDEO_MODE=mock NEWAPI_VIDEO_PAYLOAD_MODE=generation NEWAPI_VIDEO_MODEL=doubao-seedance-2-0-fast-260128 NEWAPI_VIDEO_ENDPOINT= NEWAPI_VIDEO_RESULT_ENDPOINT= NEWAPI_IMAGE_MODEL=gpt-image-2 NEWAPI_IMAGE_MODE=mock NEWAPI_IMAGE_ENDPOINT=/v1/images/generations NEWAPI_IMAGE_SIZE=1024x1024 STORAGE_DIR=storage PUBLIC_BASE_URL= MYSQL_ENABLED=false MYSQL_HOST=127.0.0.1 MYSQL_PORT=3306 MYSQL_USER=root MYSQL_PASSWORD= MYSQL_DATABASE=aigc_project MYSQL_CHARSET=utf8mb4 ``` For a real video model, set `NEWAPI_VIDEO_MODE` to a non-`mock` value and configure: - `NEWAPI_VIDEO_MODEL`: model name used in the video request payload. - `NEWAPI_VIDEO_ENDPOINT`: absolute URL or path under `NEWAPI_DOMAIN`. - `NEWAPI_VIDEO_RESULT_ENDPOINT`: optional polling path, supports `{task_id}` replacement. - `NEWAPI_VIDEO_PAYLOAD_MODE`: `generation` sends a conservative text-to-video payload for remix/localization workflows; `reference_content` includes source video/product image references. The "仅换产品" mode always uses reference content and requires a video endpoint that supports source-video/product-image references. - `NEWAPI_SOURCE_DIALOGUE_ENDPOINT`: `/v1/responses` endpoint used by SourceDialogueAgent to extract audio text from a public source-video URL. - `PUBLIC_BASE_URL`: public base URL for `/generated/...` assets when the video model needs to fetch uploaded source videos or product images. Optional local MySQL mirror for generated content data: ```sql CREATE DATABASE IF NOT EXISTS aigc_project DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_unicode_ci; ``` Then set `MYSQL_ENABLED=true` in `backend/.env`. The backend keeps the existing JSON files as the primary local cache and mirrors content replication data into MySQL tables: - `content_projects`: latest project snapshot and history list fields. - `content_jobs`: latest background generation job snapshot. - `backend_data_events`: append-only project/job data event log. - `backend_api_logs`: request/response snapshots for `/api/*` and `/health` routes. Run both services: ```bash npm run dev ``` - Frontend: http://localhost:5173 - Backend: http://localhost:8100 (`backend/app` Python file changes hot reload automatically) - API docs: http://localhost:8100/docs