Похоже работает
This commit is contained in:
@@ -27,6 +27,7 @@ Stores the outcome of a dashboard validation task.
|
||||
| timestamp | DateTime | Yes | When the validation ran |
|
||||
| status | Enum | Yes | `PASS`, `WARN`, `FAIL` |
|
||||
| screenshot_path | String | No | Path to the captured screenshot (if stored) |
|
||||
| screenshot_metadata | JSON | No | `{width: 1920, height: dynamic, tabs_processed: []}` |
|
||||
| issues | JSON | Yes | List of detected issues `[{severity, message, location}]` |
|
||||
| raw_response | Text | No | Full LLM response for debugging |
|
||||
|
||||
|
||||
@@ -23,6 +23,25 @@ This feature implements two new plugins for the `ss-tools` platform: `DashboardV
|
||||
**Constraints**: Must integrate with existing `PluginBase` and `TaskManager`. Secure storage for API keys.
|
||||
**Scale/Scope**: Support for configurable LLM providers, scheduled tasks, and notification integration.
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
### Screenshot Capture Implementation
|
||||
The screenshot service uses Playwright with Chrome DevTools Protocol (CDP) to avoid font loading timeouts in headless mode. Key implementation details:
|
||||
- **Full Page Capture**: Uses CDP `Page.captureScreenshot` with `captureBeyondViewport: true` and `fromSurface: true`
|
||||
- **Tab Switching**: Implements recursive tab switching to trigger lazy-loaded chart rendering on multi-tab dashboards
|
||||
- **Authentication**: Uses direct UI login flow (navigating to `/login/` and filling credentials) instead of API cookie injection for better reliability
|
||||
- **Resolution**: 1920px width with dynamic full page height calculation
|
||||
|
||||
### Authentication Flow
|
||||
The service authenticates via Playwright UI login rather than API authentication:
|
||||
1. Navigate to `/login/` page
|
||||
2. Fill username/password fields (supports multiple Superset versions)
|
||||
3. Click login button
|
||||
4. Verify successful redirect to `/superset/welcome/`
|
||||
5. Navigate to dashboard with valid session
|
||||
|
||||
This approach is more reliable than API-to-UI cookie injection which was causing 403 Forbidden errors.
|
||||
|
||||
## Constitution Check
|
||||
|
||||
*GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.*
|
||||
@@ -60,7 +79,8 @@ backend/
|
||||
│ │ ├── llm_analysis/ # New Plugin Directory
|
||||
│ │ │ ├── __init__.py
|
||||
│ │ │ ├── plugin.py # Implements DashboardValidationPlugin & DocumentationPlugin
|
||||
│ │ │ ├── service.py # LLM interaction logic
|
||||
│ │ │ ├── service.py # LLM interaction logic + ScreenshotService (CDP, tab switching)
|
||||
│ │ │ ├── scheduler.py # Scheduled validation task handler
|
||||
│ │ │ └── models.py # Pydantic models for LLM config/results
|
||||
│ │ └── git/ # Existing Git Plugin
|
||||
│ │ └── ... # Update for commit message generation
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
**Goal**: Implement core services and shared infrastructure.
|
||||
|
||||
- [x] T008 Implement `LLMProviderService` in `backend/src/services/llm_provider.py` (CRUD for providers, AES-256 encryption)
|
||||
- [x] T009 Implement `ScreenshotService` in `backend/src/plugins/llm_analysis/service.py` (Playwright + API strategies, fallback logic, min 1280x720px resolution)
|
||||
- [x] T009 Implement `ScreenshotService` in `backend/src/plugins/llm_analysis/service.py` (Playwright + API strategies, fallback logic, 1920px width, full page height, CDP screenshot, recursive tab switching)
|
||||
- [x] T010 Implement `LLMClient` in `backend/src/plugins/llm_analysis/service.py` (OpenAI SDK wrapper, retry logic with tenacity, rate limit handling)
|
||||
- [x] T011 Create `backend/src/plugins/llm_analysis/plugin.py` with `PluginBase` implementation stubs
|
||||
- [x] T012 Define database schema updates for `LLMProviderConfig` in `backend/src/models/llm.py` (or appropriate location)
|
||||
@@ -43,7 +43,7 @@
|
||||
- [x] T014 [US1] Implement `validate_dashboard` task logic in `backend/src/plugins/llm_analysis/plugin.py`
|
||||
- [x] T015 [US1] Implement log retrieval logic (fetch recent logs, limit 100 lines/24h) in `backend/src/plugins/llm_analysis/plugin.py`
|
||||
- [x] T016 [US1] Construct multimodal prompt (image + text) in `backend/src/plugins/llm_analysis/service.py` (implement PII/credential filtering)
|
||||
- [x] T017 [US1] Implement result parsing and persistence (ValidationResult) in `backend/src/plugins/llm_analysis/plugin.py` (ensure JSON structure: status, issues, summary)
|
||||
- [x] T017 [US1] Implement result parsing and persistence (ValidationResult) in `backend/src/plugins/llm_analysis/plugin.py` (ensure JSON structure: status, issues, summary, log results to task output with `[ANALYSIS_SUMMARY]` and `[ANALYSIS_ISSUE]` markers)
|
||||
- [x] T018 [US1] Add `validate` endpoint trigger in `backend/src/api/routes/tasks.py` (or reuse existing dispatch)
|
||||
- [x] T019 [US1] Implement notification dispatch (Email/Pulse) on failure in `backend/src/plugins/llm_analysis/plugin.py` (Summary + Link format)
|
||||
- [x] T020 [US1] Create `frontend/src/components/llm/ValidationReport.svelte` for viewing results
|
||||
|
||||
Reference in New Issue
Block a user