import { Badge, Button, Divider, Group, Paper, Select, Stack, Text, TextInput, Textarea, Title, } from "@mantine/core"; import { MessageBubble } from "../../atoms/MessageBubble/MessageBubble"; export interface SamplingMessage { role: string; content: string; imageContent?: { data: string; mimeType: string }; } export interface SamplingTool { name: string; description?: string; inputSchema: Record; } export interface SamplingRequestPanelProps { messages: SamplingMessage[]; modelHints?: string[]; costPriority?: number; speedPriority?: number; intelligencePriority?: number; maxTokens?: number; stopSequences?: string[]; temperature?: number; includeContext?: string; tools?: SamplingTool[]; toolChoice?: string; responseText: string; modelUsed: string; stopReason: string; onResponseChange: (text: string) => void; onModelChange: (model: string) => void; onStopReasonChange: (reason: string) => void; onAutoRespond: () => void; onSend: () => void; onReject: () => void; } function formatPriority(value: number): string { if (value < 0.4) return `low (${value})`; if (value <= 0.7) return `medium (${value})`; return `high (${value})`; } export function SamplingRequestPanel({ messages, modelHints, costPriority, speedPriority, intelligencePriority, maxTokens, stopSequences, temperature, includeContext, tools, toolChoice, responseText, modelUsed, stopReason, onResponseChange, onModelChange, onStopReasonChange, onAutoRespond, onSend, onReject, }: SamplingRequestPanelProps) { return ( The server is requesting an LLM completion. Messages: {messages.map((message, index) => ( ))} {modelHints && modelHints.length > 0 && ( Model Preferences: Hints: {modelHints.map((hint) => ( {hint} ))} {costPriority !== undefined && ( Cost Priority: {formatPriority(costPriority)} )} {speedPriority !== undefined && ( Speed Priority: {formatPriority(speedPriority)} )} {intelligencePriority !== undefined && ( Intelligence Priority: {formatPriority(intelligencePriority)} )} )} Parameters: Max Tokens: {maxTokens ?? "not specified"} Stop Sequences:{" "} {stopSequences ? JSON.stringify(stopSequences) : "not specified"} Temperature: {temperature !== undefined ? temperature : "not specified"} {includeContext && ( Include Context: {includeContext} )} {tools && tools.length > 0 && ( <> Available Tools: {tools.map((tool) => ( {tool.name} {tool.description && {tool.description}} ))} )} {toolChoice && Tool Choice: {toolChoice}} Response: