mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-27 18:50:41 +00:00
# What does this PR do? * Add responses list and detail views * Refactored components to be shared as much as possible between chat completions and responses ## Test Plan <img width="2014" alt="image" src="https://github.com/user-attachments/assets/6dee12ea-8876-4351-a6eb-2338058466ef" /> <img width="2021" alt="image" src="https://github.com/user-attachments/assets/6c7c71b8-25b7-4199-9c57-6960be5580c8" /> added tests
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import {
|
|
MessageBlock,
|
|
ToolCallBlock,
|
|
} from "@/components/ui/message-components";
|
|
import { FunctionCallItem, FunctionCallOutputItem } from "../utils/item-types";
|
|
|
|
interface GroupedFunctionCallItemProps {
|
|
functionCall: FunctionCallItem;
|
|
output: FunctionCallOutputItem;
|
|
index: number;
|
|
keyPrefix: string;
|
|
}
|
|
|
|
export function GroupedFunctionCallItemComponent({
|
|
functionCall,
|
|
output,
|
|
index,
|
|
keyPrefix,
|
|
}: GroupedFunctionCallItemProps) {
|
|
const name = functionCall.name || "unknown";
|
|
const args = functionCall.arguments || "{}";
|
|
|
|
// Extract the output content from function_call_output
|
|
let outputContent = "";
|
|
if (output.output) {
|
|
outputContent =
|
|
typeof output.output === "string"
|
|
? output.output
|
|
: JSON.stringify(output.output);
|
|
} else {
|
|
outputContent = JSON.stringify(output, null, 2);
|
|
}
|
|
|
|
const functionCallContent = (
|
|
<div>
|
|
<div className="mb-2">
|
|
<span className="text-sm text-gray-600">Arguments</span>
|
|
<ToolCallBlock>{`${name}(${args})`}</ToolCallBlock>
|
|
</div>
|
|
<div>
|
|
<span className="text-sm text-gray-600">Output</span>
|
|
<ToolCallBlock>{outputContent}</ToolCallBlock>
|
|
</div>
|
|
</div>
|
|
);
|
|
|
|
return (
|
|
<MessageBlock
|
|
key={`${keyPrefix}-${index}`}
|
|
label="Function Call"
|
|
content={functionCallContent}
|
|
/>
|
|
);
|
|
}
|