ai-chatbot/lib/ai/canvas-agent-routing.ts

24 lines
769 B
TypeScript

import type { AgentTargetResolutionMode } from "@/lib/ai/auto-agent-graph";
export type CanvasAgentRoutingContext = {
hasCanvasSelection?: boolean;
selectedImageCount?: number;
selectedSlotCount?: number;
hasSelectedAgentSlot?: boolean;
mediaSource?: "current_message" | "canvas_selection" | "history" | "none";
targetResolutionMode?: AgentTargetResolutionMode;
};
export function hasCanvasAgentRoutingContext(
context: CanvasAgentRoutingContext
) {
return (
Boolean(context.hasCanvasSelection) ||
(context.selectedImageCount || 0) > 0 ||
(context.selectedSlotCount || 0) > 0 ||
Boolean(context.hasSelectedAgentSlot) ||
context.mediaSource === "canvas_selection" ||
context.targetResolutionMode === "explicit_selection"
);
}