js - ts + fix
This commit is contained in:
@@ -34,10 +34,13 @@ DEFAULT_LLM_PROMPTS: dict[str, str] = {
|
||||
),
|
||||
"dashboard_validation_prompt_multimodal": ( # Path A — image-focused (v2)
|
||||
"Analyze the attached {total_chunks} dashboard tab screenshots and execution logs for visual and data health issues.\n\n"
|
||||
"Each screenshot corresponds to a different dashboard tab. "
|
||||
"Screenshots are attached IN ORDER — screenshot 0 is the first tab, screenshot 1 is the second, etc.\n"
|
||||
"Tab order:\n"
|
||||
"{tab_list}\n\n"
|
||||
"Logs:\n"
|
||||
"{logs}\n\n"
|
||||
"Provide the analysis in JSON format with the following structure:\n"
|
||||
"Provide the analysis in JSON format. Each issue MUST specify the tab_index field "
|
||||
"(0-based index of the screenshot/tab where the issue appears, or -1 if not tab-specific):\n"
|
||||
"{\n"
|
||||
' "status": "PASS" | "WARN" | "FAIL",\n'
|
||||
' "summary": "Short summary of findings",\n'
|
||||
@@ -45,7 +48,8 @@ DEFAULT_LLM_PROMPTS: dict[str, str] = {
|
||||
" {\n"
|
||||
' "severity": "WARN" | "FAIL",\n'
|
||||
' "message": "Description of the issue",\n'
|
||||
' "location": "Optional location info (e.g. tab name, chart name)"\n'
|
||||
' "location": "Where the issue is located (tab name, chart name, screen region)",\n'
|
||||
' "tab_index": "0-based tab index (-1 if unknown)"\n'
|
||||
" }\n"
|
||||
" ]\n"
|
||||
"}"
|
||||
@@ -53,13 +57,14 @@ DEFAULT_LLM_PROMPTS: dict[str, str] = {
|
||||
"dashboard_validation_prompt_text": ( # Path B — topology-focused (v2)
|
||||
"Analyze the following dashboard topology, dataset health, and execution logs for "
|
||||
"data consistency and KXD connectivity issues.\n\n"
|
||||
"Dashboard structure:\n"
|
||||
"Dashboard structure (tabs are indicated in the topology below):\n"
|
||||
"{topology}\n\n"
|
||||
"Dataset health:\n"
|
||||
"{dataset_health}\n\n"
|
||||
"Logs:\n"
|
||||
"{logs}\n\n"
|
||||
"Provide the analysis in JSON format with the following structure:\n"
|
||||
"Provide the analysis in JSON format. Each issue MUST specify the tab_index field "
|
||||
"(0-based index of the tab where the issue appears, or -1 if not tab-specific):\n"
|
||||
"{\n"
|
||||
' "status": "PASS" | "WARN" | "FAIL",\n'
|
||||
' "summary": "Short summary of findings",\n'
|
||||
@@ -67,7 +72,8 @@ DEFAULT_LLM_PROMPTS: dict[str, str] = {
|
||||
" {\n"
|
||||
' "severity": "WARN" | "FAIL",\n'
|
||||
' "message": "Description of the issue",\n'
|
||||
' "location": "Optional location info (e.g. dataset name, chart name)"\n'
|
||||
' "location": "Where the issue is located (tab name, chart name, dataset name)",\n'
|
||||
' "tab_index": "0-based tab index (-1 if unknown)"\n'
|
||||
" }\n"
|
||||
" ]\n"
|
||||
"}"
|
||||
|
||||
@@ -265,7 +265,18 @@ class ValidationTaskService:
|
||||
|
||||
# #region _run_to_dict [C:2] [TYPE Function]
|
||||
# @BRIEF Convert ValidationRun ORM object to a serializable dict for run history APIs.
|
||||
# Computes duration_ms from started_at/finished_at for frontend display.
|
||||
# @RATIONALE duration_ms added so the frontend can show "Длительность: 3m 12s" on the
|
||||
# run detail page. Previously duration was always "-" even for completed runs.
|
||||
# @POST Returns dict with duration_ms = int (ms) if both started_at and finished_at
|
||||
# are present, else None. All other fields are direct ORM mappings.
|
||||
def _run_to_dict(self, run: ValidationRun) -> dict:
|
||||
from datetime import timezone as _tz
|
||||
duration_ms: int | None = None
|
||||
if run.started_at and run.finished_at:
|
||||
started = run.started_at.replace(tzinfo=_tz.utc) if run.started_at.tzinfo is None else run.started_at
|
||||
finished = run.finished_at.replace(tzinfo=_tz.utc) if run.finished_at.tzinfo is None else run.finished_at
|
||||
duration_ms = int((finished - started).total_seconds() * 1000)
|
||||
return {
|
||||
"id": run.id,
|
||||
"policy_id": run.policy_id,
|
||||
@@ -274,6 +285,7 @@ class ValidationTaskService:
|
||||
"trigger": run.trigger,
|
||||
"started_at": run.started_at.isoformat() if run.started_at else None,
|
||||
"finished_at": run.finished_at.isoformat() if run.finished_at else None,
|
||||
"duration_ms": duration_ms,
|
||||
"dashboard_count": run.dashboard_count or 0,
|
||||
"pass_count": run.pass_count or 0,
|
||||
"warn_count": run.warn_count or 0,
|
||||
|
||||
Reference in New Issue
Block a user