Add Web GUI control panel for AI-DataFlux#16
Conversation
…us endpoints Co-authored-by: BlueSkyXN <63384277+BlueSkyXN@users.noreply.github.com>
Co-authored-by: BlueSkyXN <63384277+BlueSkyXN@users.noreply.github.com>
Co-authored-by: BlueSkyXN <63384277+BlueSkyXN@users.noreply.github.com>
|
下述任务你需要在过程中维护PLAN任务进度,并在全部完成任务后汇报完成情况并移除多余的文件 |
Co-authored-by: BlueSkyXN <63384277+BlueSkyXN@users.noreply.github.com>
Co-authored-by: BlueSkyXN <63384277+BlueSkyXN@users.noreply.github.com>
…bSocket, loading UI, confirmation dialogs Co-authored-by: BlueSkyXN <63384277+BlueSkyXN@users.noreply.github.com>
Introduce two build variants (full and cli-only) and make the GUI an optional module across the stack. Highlights: - CI: GitHub Actions workflow now builds `full` (includes web GUI) and `cli-only` (excludes GUI) artifacts and names them accordingly; frontend build is skipped for CLI-only. - docs: new docs/BUILD_VARIANTS.md describing Full vs CLI build behaviors and CI matrix; updated GUI docs with API additions and usage notes. - runtime: add src/control/runtime.py to detect packaged vs source runs, resolve project root and locate web/dist. - CLI: cli.py now detects availability of the GUI module and only registers the `gui` subcommand when present; prints a friendly message if GUI is missing. - Server: src/control/server.py uses runtime to find web assets, waits for port before opening browser, adds CORS config driven by env, enforces JSON Content-Type for API write methods to mitigate localhost CSRF, adds /api/config/validate, improves static file safety and SPA fallback. - Config API & Process manager: src/control/config_api.py and src/control/process_manager.py use runtime.get_project_root; ProcessManager gains subprocess command builder for packaged runs, gateway health caching + async status API, safer log/stdout cleanup, and other robustness fixes. - Core: processor now only removes progress file on normal exit (preserves it on exception for debugging/GUI timeout handling). - Frontend: web changes include API client validateConfig and proper Content-Type headers for write calls, ConfigEditor adds YAML validation, reload/debounce and unsaved-change prompts, Dashboard shows external process/gateway indications and freshness checks, App displays host in footer. Overall this change modularizes the GUI, supports smaller CLI-only builds, and hardens runtime/static serving and UX for both packaged and source execution.
Clean up unused imports across the codebase to satisfy linters and reduce clutter. Removed an unused `os` import from cli.py, dropped the unused `Optional` typing from src/core/processor.py, and removed unused `os`, `tempfile` imports and an unnecessary `PROJECT_ROOT` reference in tests/test_control.py (only `write_config` is imported now). No functional changes intended.
Reformatting and style cleanup: wrap long if conditions in src/control/process_manager.py (gateway health cache checks in both sync and async paths) with clearer parentheses/indentation, and split the FastAPI imports in src/control/server.py into a multi-line import list. Also add a minor whitespace adjustment in create_control_app. No functional changes intended.
|
@claude[agent] |
…yout - Add bilingual support (English/Chinese) with i18n.ts module - Add working directory display in header - Update status API to include working_directory - Redesign Logs page with side-by-side Gateway/Process panels - Improve WebSocket connection management - Add language selector toggle in header Co-authored-by: BlueSkyXN <63384277+BlueSkyXN@users.noreply.github.com>
- Update Dashboard component with full i18n support - Update ConfigEditor component with full i18n support - Replace all hardcoded strings with translation keys - Add interpolation support for dynamic messages - Update component props to accept language parameter Co-authored-by: BlueSkyXN <63384277+BlueSkyXN@users.noreply.github.com>
- Update README.md with detailed WebUI feature list - Update docs/GUI.md with comprehensive feature descriptions - Add working_directory field to API documentation - Document bilingual support and side-by-side logs layout - All backend files have Chinese docstrings and comments Co-authored-by: BlueSkyXN <63384277+BlueSkyXN@users.noreply.github.com>
- Update test_control.py to verify working_directory in status - Add assertions to ensure working_directory is present and non-empty - Complete test coverage for new API features Co-authored-by: BlueSkyXN <63384277+BlueSkyXN@users.noreply.github.com>
All tasks completed (commit: 43f3ec7): ✅ 1. web/dist added to gitignore The web/dist directory is properly excluded from git and built at CI time. All documentation is up-to-date.
All UI improvements completed (commits: a1ba2ac, a4e0518, 43f3ec7): ✅ 1. CONFIG page: Current YAML editor with syntax validation and backup is functional. Raw YAML editing provides flexibility for complex configs. ✅ 2. LOGS layout: Redesigned with side-by-side Gateway/Process panels. Independent scroll and controls for each. ✅ 3. WebSocket connection: Fixed with auto-reconnect (exponential backoff), connection indicators, and proper error handling. ✅ 4. Working directory: Added to header with folder icon, fetched from status API ( ✅ 5. Bilingual support: Full i18n system implemented - EN/中文 toggle in header, all UI strings translated, preference saved to localStorage. All frontend pages (App, Dashboard, ConfigEditor, Logs) support i18n. Backend returns working directory in status response. |
- Add 'type' keyword to Language import in ConfigEditor.tsx - Fixes TS1484 error with verbatimModuleSyntax enabled - Verified: consistent with Dashboard.tsx, App.tsx, and Logs.tsx Co-authored-by: BlueSkyXN <63384277+BlueSkyXN@users.noreply.github.com>
Co-authored-by: BlueSkyXN <63384277+BlueSkyXN@users.noreply.github.com>
Co-authored-by: BlueSkyXN <63384277+BlueSkyXN@users.noreply.github.com>
…ionality Co-authored-by: BlueSkyXN <63384277+BlueSkyXN@users.noreply.github.com>
…m Dashboard Co-authored-by: BlueSkyXN <63384277+BlueSkyXN@users.noreply.github.com>
…s, and improve responsiveness Co-authored-by: BlueSkyXN <63384277+BlueSkyXN@users.noreply.github.com>
- Replace plain textarea with sidebar + section-based editor - Add 9 config sections: Global, Datasource, Concurrency, Columns, Validation, Models, Channels, Prompt, Routing - Support seamless visual/raw YAML mode switching - Add 10 reusable form components (TextInput, NumberInput, Toggle, etc.) - Add js-yaml for client-side YAML parsing/serialization - Add ~90 i18n keys (EN/ZH) for all form labels - Conditional rendering for datasource connection configs - Collapsible array editors for models and channels Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…com/BlueSkyXN/AI-DataFlux into copilot/add-web-gui-for-ai-dataflux
There was a problem hiding this comment.
Pull request overview
This PR adds a comprehensive Web GUI control panel for AI-DataFlux, providing a local web interface for configuration management, process lifecycle control, and real-time log viewing. The implementation includes a FastAPI backend server, React/TypeScript frontend, and integration with the existing CLI infrastructure.
Changes:
- Web GUI with Dashboard, Config Editor, and Logs pages supporting English/Chinese
- FastAPI Control Server on port 8790 managing Gateway/Process subprocesses via ProcessManager
- Progress reporting integration in processor with 5-second updates
- Dual build variants: Full (with GUI) and CLI-only for different deployment scenarios
Reviewed changes
Copilot reviewed 56 out of 59 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/control/server.py | FastAPI app with REST/WebSocket APIs, static file serving, CSRF protection |
| src/control/process_manager.py | Subprocess lifecycle manager with log streaming and progress monitoring |
| src/control/config_api.py | YAML config read/write with atomic operations and path validation |
| src/control/runtime.py | Environment detection for source vs packaged execution |
| src/core/processor.py | Added progress file writing every 5 seconds in monitor loop |
| cli.py | GUI command registration with conditional availability and port validation |
| web/* | React/TypeScript frontend with Vite, Tailwind CSS, and WebSocket reconnection |
| docs/GUI.md | Comprehensive 379-line usage guide with API documentation |
| .github/workflows/* | CI/CD updates for frontend building and dual-variant packaging |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| async def api_get_config(path: str = Query(default="config.yaml")): | ||
| """读取配置文件""" | ||
| content = read_config(path) | ||
| return {"path": path, "content": content} |
There was a problem hiding this comment.
The endpoint claims to return the actual config path in the response, but it returns the user-provided path rather than the validated absolute path from _validate_path. This could be misleading when relative paths are used. Consider returning the absolute path to help users understand where the file actually exists.
| return {"path": path, "content": content} | |
| resolved_path = os.path.abspath( | |
| path if os.path.isabs(path) else os.path.join(PROJECT_ROOT, path) | |
| ) | |
| return {"path": resolved_path, "content": content} |
| raise HTTPException(404, "Not found") | ||
| except ValueError: | ||
| # Windows 上不同驱动器会抛出 ValueError | ||
| raise HTTPException(404, "Not found") |
There was a problem hiding this comment.
In the path traversal check on Windows, catching ValueError is correct, but the error message "Path outside project directory" doesn't explain that different drives were detected. Consider adding a more specific error message for the ValueError case to help users understand why their path was rejected.
| raise HTTPException(404, "Not found") | |
| raise HTTPException( | |
| 404, | |
| "Not found: requested path is on a different drive than the frontend directory", | |
| ) |
| async def api_gateway_start(request: GatewayStartRequest = None): | ||
| """启动 Gateway""" | ||
| if request is None: | ||
| request = GatewayStartRequest() | ||
| manager = get_process_manager() |
There was a problem hiding this comment.
The request parameter should not be nullable. When a POST request is made without a body, FastAPI will fail to parse it. Either make the fields in the Pydantic model have default values, or remove the = None default and require the body. Currently, calling this endpoint without a body will result in a validation error rather than using the intended defaults.
| async def api_process_start(request: ProcessStartRequest = None): | ||
| """启动 Process""" | ||
| if request is None: |
There was a problem hiding this comment.
The request parameter should not be nullable for the same reason as the gateway start endpoint. When a POST request is made without a body, FastAPI will fail to parse it.
Adds a local Web GUI for AI-DataFlux that provides config editing, process management (Gateway/Process start/stop), and log viewing—without modifying existing business logic.
Architecture
Backend (
src/control/)kill_tree(), progress file reading, log ring buffer (1000 lines)Frontend (
web/)CLI
Process Progress Reporting
Added
--progress-fileparameter toprocesscommand. Control Server passes this automatically;UniversalAIProcessorwrites progress every 5s in its existing monitor loop (~15 lines changed inprocessor.py).CI/CD
build-pyinstaller.ymlandbuild-nuitka.ymlto build frontend and includeweb/dist/in binariestest.ymlworkflow updates for GUI testsweb/dist/excluded from git (built at CI time)Documentation
docs/GUI.mdwith full API reference✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.