feat: custom tool renderers
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import type { Component } from "vue";
|
||||
import Generic from "./Generic.vue";
|
||||
import Search from "./Search.vue";
|
||||
|
||||
// Renderers receive a readonly toolCall prop and own their presentation only.
|
||||
const renderers: Readonly<Record<string, Component>> = Object.freeze({
|
||||
search: Search,
|
||||
});
|
||||
|
||||
export const resolveToolRenderer = (toolName: string): Component => {
|
||||
if (Object.hasOwn(renderers, toolName)) {
|
||||
return renderers[toolName] ?? Generic;
|
||||
}
|
||||
return Generic;
|
||||
};
|
||||
Reference in New Issue
Block a user