{
renderParams(params: CalculateParams, isStreaming?: boolean): TemplateResult {
if (isStreaming && !params.expression) {
return html`${i18n("Writing expression...")}
`;
}
return html`
${i18n("Calculating")}
${params.expression}
`;
}
renderResult(_params: CalculateParams, result: ToolResultMessage): TemplateResult {
// Parse the output to make it look nicer
const output = result.output || "";
const isError = result.isError === true;
if (isError) {
return html`${output}
`;
}
// Try to split on = to show expression and result separately
const parts = output.split(" = ");
if (parts.length === 2) {
return html`
${parts[0]}
=
${parts[1]}
`;
}
// Fallback to showing the whole output
return html`${output}
`;
}
}