Files
classroomio/apps/dashboard/src/lib/features/ai-assistant/tool-invocation-badge.svelte
T

28 lines
828 B
Svelte
Raw Normal View History

2026-04-27 11:40:38 +01:00
<script lang="ts">
import LoaderIcon from '@lucide/svelte/icons/loader';
import CheckIcon from '@lucide/svelte/icons/check';
import { getToolLabel, getToolResultLabel } from '$features/ai-assistant/utils/tool-labels';
interface Props {
toolName: string;
state: string;
result?: unknown;
}
let { toolName, state, result }: Props = $props();
</script>
<div class="ui:bg-background/50 flex items-center gap-2 rounded border px-2 py-1 text-xs">
{#if state === 'call' || state === 'partial-call'}
<LoaderIcon size={12} class="animate-spin" />
<span class="ui:text-muted-foreground">
{getToolLabel(toolName)}...
</span>
{:else if state === 'result'}
<CheckIcon size={12} class="ui:text-primary" />
<span>
{getToolResultLabel(toolName, result)}
</span>
{/if}
</div>