From 40e364d9f6fd8e9ba2b40b5db9e9c8b0956701dc Mon Sep 17 00:00:00 2001 From: busya Date: Mon, 1 Jun 2026 17:09:40 +0300 Subject: [PATCH] fix --- backend/src/plugins/llm_analysis/plugin.py | 10 +++++----- backend/src/schemas/validation.py | 2 +- frontend/src/lib/api.ts | 6 +++--- .../translate/TranslationRunGlobalIndicator.svelte | 3 ++- run.sh | 6 ++++++ 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/backend/src/plugins/llm_analysis/plugin.py b/backend/src/plugins/llm_analysis/plugin.py index ebab5238..0b5b0124 100644 --- a/backend/src/plugins/llm_analysis/plugin.py +++ b/backend/src/plugins/llm_analysis/plugin.py @@ -150,11 +150,11 @@ def _update_run_status(db, run_id: str | None) -> None: run.unknown_count = unknown_count db.commit() logger.info( - f"[_update_run_status] Run {run_id} completed: " - f"PASS={pass_count} WARN={warn_count} FAIL={fail_count} UNKNOWN={unknown_count}" - ) - except Exception as e: - logger.error(f"[_update_run_status] Failed to finalize run {run_id}: {e}") + f"[_update_run_status] Run {run_id} completed: " + f"PASS={pass_count} WARN={warn_count} FAIL={fail_count} UNKNOWN={unknown_count}" + ) + except Exception as e: + logger.error(f"[_update_run_status] Failed to finalize run {run_id}: {e}") # #endregion _update_run_status diff --git a/backend/src/schemas/validation.py b/backend/src/schemas/validation.py index 62606694..641be1bc 100644 --- a/backend/src/schemas/validation.py +++ b/backend/src/schemas/validation.py @@ -208,7 +208,7 @@ class RecordResponse(BaseModel): dataset_health: dict[str, Any] | None = None chart_data_results: list[dict[str, Any]] = Field(default_factory=list) tab_screenshots: list[dict[str, Any]] = Field(default_factory=list) - logs_sent_to_llm: list[dict[str, Any]] = Field(default_factory=list) + logs_sent_to_llm: list[str] = Field(default_factory=list) token_usage: dict[str, Any] | None = None timings: dict[str, Any] | None = None diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index 0d9d9590..1b6f01e8 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -124,7 +124,7 @@ function shouldSuppressApiErrorToast(endpoint: string, error: ApiError): boolean */ export const getWsUrl = (taskId: string): string => { const protocol = typeof window !== 'undefined' && window.location.protocol === 'https:' ? 'wss:' : 'ws:'; - const host = typeof window !== 'development' && typeof window !== 'undefined' ? window.location.host : 'localhost:8000'; + const host = typeof window !== 'undefined' ? window.location.host : 'localhost:8000'; let url = `${protocol}//${host}/ws/logs/${taskId}`; if (typeof window !== 'undefined') { const token = localStorage.getItem('auth_token'); @@ -140,7 +140,7 @@ export const getWsUrl = (taskId: string): string => { */ export const getTaskEventsWsUrl = (): string => { const protocol = typeof window !== 'undefined' && window.location.protocol === 'https:' ? 'wss:' : 'ws:'; - const host = typeof window !== 'development' && typeof window !== 'undefined' ? window.location.host : 'localhost:8000'; + const host = typeof window !== 'undefined' ? window.location.host : 'localhost:8000'; let url = `${protocol}//${host}/ws/task-events`; if (typeof window !== 'undefined') { const token = localStorage.getItem('auth_token'); @@ -156,7 +156,7 @@ export const getTaskEventsWsUrl = (): string => { */ export const getMaintenanceEventsWsUrl = (): string => { const protocol = typeof window !== 'undefined' && window.location.protocol === 'https:' ? 'wss:' : 'ws:'; - const host = typeof window !== 'development' && typeof window !== 'undefined' ? window.location.host : 'localhost:8000'; + const host = typeof window !== 'undefined' ? window.location.host : 'localhost:8000'; let url = `${protocol}//${host}/ws/maintenance/events`; if (typeof window !== 'undefined') { const token = localStorage.getItem('auth_token'); diff --git a/frontend/src/lib/components/translate/TranslationRunGlobalIndicator.svelte b/frontend/src/lib/components/translate/TranslationRunGlobalIndicator.svelte index e273be3e..5767ddea 100644 --- a/frontend/src/lib/components/translate/TranslationRunGlobalIndicator.svelte +++ b/frontend/src/lib/components/translate/TranslationRunGlobalIndicator.svelte @@ -149,7 +149,7 @@
+ >
@@ -181,6 +181,7 @@ class:bg-destructive={uxState === 'failed'} class:bg-gray-500={uxState === 'cancelled'} onclick={handleClick} + onkeydown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); handleClick(); } }} role="button" tabindex="0" > diff --git a/run.sh b/run.sh index bd2a6751..b060c0bd 100755 --- a/run.sh +++ b/run.sh @@ -203,6 +203,12 @@ start_backend() { fi if [ -f ".env" ]; then uvicorn_env_args=(--env-file .env) + # Also export .env vars so Python's os.environ sees them before app.py imports. + # uvicorn --env-file only affects uvicorn's own config, not the application. + set -a + # shellcheck disable=SC1091 + . .env + set +a fi # PYTHONUNBUFFERED=1 prevents stderr buffering when piped through sed. # Without it, JSON logs from superset_tools_app get stuck in the buffer