diff --git a/agenta-web/src/components/pages/evaluations/cellRenderers/cellRenderers.tsx b/agenta-web/src/components/pages/evaluations/cellRenderers/cellRenderers.tsx index 59e3cd10b9..866090f990 100644 --- a/agenta-web/src/components/pages/evaluations/cellRenderers/cellRenderers.tsx +++ b/agenta-web/src/components/pages/evaluations/cellRenderers/cellRenderers.tsx @@ -71,7 +71,7 @@ const useStyles = createUseStyles((theme: JSSTheme) => ({ }, })) -export function LongTextCellRenderer(params: ICellRendererParams) { +export function LongTextCellRenderer(params: ICellRendererParams, output?: any) { const {value, api, node} = params const [expanded, setExpanded] = useState( node.rowHeight !== api.getSizesForCurrentTheme().rowHeight, @@ -95,11 +95,11 @@ export function LongTextCellRenderer(params: ICellRendererParams) { cellsArr.forEach((cell) => { cell.setAttribute( "style", - "overflow: visible; white-space: pre-wrap; text-overflow: unset;", + "overflow: visible; white-space: pre-wrap; text-overflow: unset; line-height: 2.5em;", ) }) const height = Math.max(...cellsArr.map((cell) => cell.scrollHeight)) - node.setRowHeight(height <= defaultHeight ? defaultHeight * 2 : height) + node.setRowHeight(height <= defaultHeight ? defaultHeight * 2 : height + 10) } else { cellsArr.forEach((cell) => { cell.setAttribute( @@ -121,9 +121,9 @@ export function LongTextCellRenderer(params: ICellRendererParams) { return (
- {value} + {output ? output : value} {expanded ? ( diff --git a/agenta-web/src/components/pages/evaluations/evaluationCompare/EvaluationCompare.tsx b/agenta-web/src/components/pages/evaluations/evaluationCompare/EvaluationCompare.tsx index fedb229b0e..159b766767 100644 --- a/agenta-web/src/components/pages/evaluations/evaluationCompare/EvaluationCompare.tsx +++ b/agenta-web/src/components/pages/evaluations/evaluationCompare/EvaluationCompare.tsx @@ -97,7 +97,7 @@ const EvaluationCompareMode: React.FC = () => { field: `inputs.${ix}.value` as any, ...getFilterParams("text"), pinned: "left", - cellRenderer: LongTextCellRenderer, + cellRenderer: (params: any) => LongTextCellRenderer(params), }) }) @@ -108,7 +108,7 @@ const EvaluationCompareMode: React.FC = () => { field: "correctAnswer", ...getFilterParams("text"), pinned: "left", - cellRenderer: LongTextCellRenderer, + cellRenderer: (params: any) => LongTextCellRenderer(params), }) variants.forEach((variant, vi) => { @@ -128,25 +128,28 @@ const EvaluationCompareMode: React.FC = () => { cellRenderer: (params: any) => { return ( <> - {showDiff === "show" ? ( - - - item.evaluationId === variant.evaluationId, - )?.output?.result, - )} - expectedOutput={params.data?.correctAnswer} - /> - - ) : ( - getTypedValue( - params.data?.variants.find( - (item: any) => item.evaluationId === variant.evaluationId, - )?.output?.result, - ) - )} + {showDiff === "show" + ? LongTextCellRenderer( + params, + + item.evaluationId === variant.evaluationId, + )?.output?.result, + )} + expectedOutput={params.data?.correctAnswer} + />, + ) + : LongTextCellRenderer( + params, + getTypedValue( + params.data?.variants.find( + (item: any) => + item.evaluationId === variant.evaluationId, + )?.output?.result, + ), + )} ) }, diff --git a/agenta-web/src/components/pages/evaluations/evaluationScenarios/EvaluationScenarios.tsx b/agenta-web/src/components/pages/evaluations/evaluationScenarios/EvaluationScenarios.tsx index ea13957b1a..687ae40f10 100644 --- a/agenta-web/src/components/pages/evaluations/evaluationScenarios/EvaluationScenarios.tsx +++ b/agenta-web/src/components/pages/evaluations/evaluationScenarios/EvaluationScenarios.tsx @@ -71,7 +71,7 @@ const EvaluationScenarios: React.FC = () => { valueGetter: (params) => { return getTypedValue(params.data?.inputs[index]) }, - cellRenderer: LongTextCellRenderer, + cellRenderer: (params: any) => LongTextCellRenderer(params), }) }) colDefs.push({ @@ -83,7 +83,7 @@ const EvaluationScenarios: React.FC = () => { valueGetter: (params) => { return params.data?.correct_answer?.toString() || "" }, - cellRenderer: LongTextCellRenderer, + cellRenderer: (params: any) => LongTextCellRenderer(params), }) evalaution?.variants.forEach((_, index) => { colDefs.push({ @@ -97,14 +97,15 @@ const EvaluationScenarios: React.FC = () => { if (result && result.type == "error") { return `${result?.error?.message}\n${result?.error?.stacktrace}` } - return showDiff === "show" ? ( - - ) : ( - result?.value - ) + return showDiff === "show" + ? LongTextCellRenderer( + params, + , + ) + : LongTextCellRenderer(params) }, valueGetter: (params) => { const result = params.data?.outputs[index].result