Files
veridian/app/components/Message/Agent/Tool/index.vue
T

29 lines
879 B
Vue

<script setup lang="ts">
import type { MessagePart, ToolCall } from "~/composables/useChat";
import { computed } from "vue";
import Generic from "./Generic.vue";
import { resolveToolRenderer } from "./renderers";
const props = defineProps<{
toolCall: Readonly<ToolCall>;
part?: MessagePart;
}>();
const emit = defineEmits<{
retry: [];
}>();
const renderer = computed(() => resolveToolRenderer(props.toolCall.toolName));
</script>
<template>
<div class="flex flex-col min-w-0">
<NuxtErrorBoundary :key="toolCall.id + ':' + toolCall.toolName">
<component :is="renderer" :tool-call="toolCall" :part="part" @retry="emit('retry')"></component>
<template #error>
<Generic :tool-call="toolCall" :part="part" @retry="emit('retry')"></Generic>
</template>
</NuxtErrorBoundary>
</div>
</template>