refactor: code review improvements — fix bugs, extract shared utilities, add README
- Fix reactivity bug: use SvelteMap instead of Map in sessions store - Fix theme listener memory leak: guard against double-init, return cleanup function - Fix transport singleton ignoring different endpoints - Fix form/button type mismatch in MessageInput - Add safer retry validation in chat page - Extract shared utilities: date formatting, session config check, result source config - Extract shared components: Backdrop, PageHeader - Extract orchestration composable from chat page (310→85 lines of script) - Consolidate AuditTimeline switch functions into config record - Move sample data to dedicated module - Add dark mode support for LineageTree SVG colors - Memoize leaf count computation in LineageTree - Update README with usage guide and project structure Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import type { SubagentResult } from '$lib/proto/llm_multiverse/v1/common_pb';
|
||||
import { ResultStatus, ResultQuality, ResultSource } from '$lib/proto/llm_multiverse/v1/common_pb';
|
||||
import { ResultStatus, ResultQuality } from '$lib/proto/llm_multiverse/v1/common_pb';
|
||||
import { resultSourceConfig } from '$lib/types/resultSource';
|
||||
|
||||
let { result }: { result: SubagentResult } = $props();
|
||||
|
||||
@@ -26,14 +27,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
const sourceLabel = $derived.by(() => {
|
||||
switch (result.source) {
|
||||
case ResultSource.TOOL_OUTPUT: return 'Tool Output';
|
||||
case ResultSource.MODEL_KNOWLEDGE: return 'Model Knowledge';
|
||||
case ResultSource.WEB: return 'Web';
|
||||
default: return '';
|
||||
}
|
||||
});
|
||||
const sourceBadge = $derived(resultSourceConfig(result.source));
|
||||
</script>
|
||||
|
||||
<div class="mx-4 mb-3 rounded-xl border {statusConfig.border} {statusConfig.bg} p-4">
|
||||
@@ -46,9 +40,9 @@
|
||||
{qualityLabel}
|
||||
</span>
|
||||
{/if}
|
||||
{#if sourceLabel}
|
||||
<span class="rounded-full bg-purple-100 dark:bg-purple-900/40 px-2.5 py-0.5 text-xs font-medium text-purple-800 dark:text-purple-300">
|
||||
{sourceLabel}
|
||||
{#if sourceBadge.label !== 'Unspecified'}
|
||||
<span class="rounded-full {sourceBadge.bg} px-2.5 py-0.5 text-xs font-medium {sourceBadge.text}">
|
||||
{sourceBadge.label}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user