Added translations for all observability components: - Validation warnings panel - Auto-fixes badge - AI reasoning process viewer - Debug information panel - Structured error display English translations (en.json): - observability_validationWarnings: "Validation Warnings" - observability_autoFixesApplied: "Automatically adjusted" - observability_aiReasoningProcess: "AI Reasoning Process" - observability_debugInfo: "Debug Information" - observability_model/duration/tokenUsage: Debug panel labels - observability_validationFailed: "Safety validation failed" Polish translations (pl.json): - observability_validationWarnings: "Ostrzeżenia walidacji" - observability_autoFixesApplied: "Automatycznie dostosowano" - observability_aiReasoningProcess: "Proces rozumowania AI" - observability_debugInfo: "Informacje debugowania" - All debug panel labels translated - observability_validationFailed: "Walidacja bezpieczeństwa nie powiodła się" Updated components: - ValidationWarningsAlert: Uses m.observability_validationWarnings() - AutoFixBadge: Uses m.observability_autoFixesApplied() - ReasoningChainViewer: Uses m.observability_aiReasoningProcess() - MetadataDebugPanel: All labels now use i18n - StructuredErrorDisplay: Translates error prefixes All components now fully support English and Polish locales.
63 lines
1.6 KiB
Svelte
63 lines
1.6 KiB
Svelte
<script lang="ts">
|
|
import { XCircle } from 'lucide-svelte';
|
|
import { m } from '$lib/paraglide/messages.js';
|
|
|
|
interface Props {
|
|
error: string;
|
|
}
|
|
|
|
let { error }: Props = $props();
|
|
|
|
// Parse semicolon-separated errors from backend validation failures
|
|
const errors = $derived(
|
|
error.includes(';')
|
|
? error
|
|
.split(';')
|
|
.map((e) => e.trim())
|
|
.filter((e) => e.length > 0)
|
|
: [error]
|
|
);
|
|
|
|
// Extract prefix if present (e.g., "Generated routine failed safety validation: ")
|
|
const hasPrefix = $derived(errors.length === 1 && errors[0].includes(': '));
|
|
const prefix = $derived(
|
|
hasPrefix ? errors[0].substring(0, errors[0].indexOf(': ') + 1) : ''
|
|
);
|
|
const cleanedErrors = $derived(
|
|
hasPrefix && prefix ? [errors[0].substring(prefix.length)] : errors
|
|
);
|
|
|
|
// Translate known error prefixes
|
|
const translatedPrefix = $derived(() => {
|
|
if (!prefix) return '';
|
|
const prefixText = prefix.replace(':', '').trim();
|
|
// Check for common validation failure prefix
|
|
if (
|
|
prefixText.includes('safety validation') ||
|
|
prefixText.includes('validation')
|
|
) {
|
|
return m.observability_validationFailed();
|
|
}
|
|
return prefixText;
|
|
});
|
|
</script>
|
|
|
|
<div class="editorial-alert editorial-alert--error">
|
|
<div class="flex items-start gap-2">
|
|
<XCircle class="size-5 shrink-0 mt-0.5" />
|
|
<div class="flex-1">
|
|
{#if prefix}
|
|
<p class="font-medium mb-2">{translatedPrefix()}</p>
|
|
{/if}
|
|
{#if cleanedErrors.length === 1}
|
|
<p>{cleanedErrors[0]}</p>
|
|
{:else}
|
|
<ul class="list-disc list-inside space-y-1">
|
|
{#each cleanedErrors as err}
|
|
<li>{err}</li>
|
|
{/each}
|
|
</ul>
|
|
{/if}
|
|
</div>
|
|
</div>
|
|
</div>
|