Skip to content

Commit

Permalink
Merge pull request #37 from Agenta-AI/evaluation-flow
Browse files Browse the repository at this point in the history
display data in comparison table
  • Loading branch information
aakrem authored May 30, 2023
2 parents 70cea75 + 9d4cb9f commit 6aa769d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 8 additions & 4 deletions agenta-web/src/components/EvaluationTable/EvaluationTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const EvaluationTable: React.FC<EvaluationTableProps> = ({ columnsCount, variant
const { app_name } = router.query;
const [variantInputs, setVariantInputs] = useState<string[]>([]);
const [isError, setIsError] = useState(false);
const datasetRowsData = dataset.csvdata

const variantData = variants.map((variant, index) => {
const { optParams, URIPath, isLoading, isError, error } = useVariant(app_name, variant);
Expand Down Expand Up @@ -77,7 +78,7 @@ const EvaluationTable: React.FC<EvaluationTableProps> = ({ columnsCount, variant

useEffect(() => {
if (variantInputs.length > 0) {
const initialRows = dataset && dataset.length > 0 ? dataset.map((item: any) => {
const initialRows = datasetRowsData && datasetRowsData.length > 0 ? datasetRowsData.map((item: any) => {
return {
inputFields: variantInputs.map((input: string) => ({ input_name: input, input_value: item[input] })),
columnData0: '',
Expand Down Expand Up @@ -131,7 +132,6 @@ const EvaluationTable: React.FC<EvaluationTableProps> = ({ columnsCount, variant

setRowValue(rowIndex, 'vote', 'loading');


postEvaluationRow(comparisonTableId, data)
.then(data => {
setRowValue(rowIndex, 'vote', data.vote);
Expand Down Expand Up @@ -185,7 +185,7 @@ const EvaluationTable: React.FC<EvaluationTableProps> = ({ columnsCount, variant
return ({
title: (
<div>
App Variant: {variants[i].variantName}
App Variant: <span style={{backgroundColor: 'rgb(153 232 175)', padding: 4, borderRadius: 5}}>{variants[i].variantName}</span>
</div>
),
dataIndex: columnKey,
Expand All @@ -199,7 +199,11 @@ const EvaluationTable: React.FC<EvaluationTableProps> = ({ columnsCount, variant
key: '1',
title: (
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
Inputs
<div >
<span> Inputs (Dataset: </span>
<span style={{backgroundColor: 'rgb(153 232 175)', padding: 4, borderRadius: 5}}>{dataset.name}</span>
<span> )</span>
</div>
<Button size="small" onClick={runAllEvaluations} icon={<CaretRightOutlined />}>Run All</Button>
</div>
),
Expand Down
6 changes: 4 additions & 2 deletions agenta-web/src/components/Evaluations/Evaluations.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import { useState, useEffect } from 'react';
import { Button, Col, Dropdown, Menu, Row, Spin, Switch, Tooltip, Tag, message, MenuProps } from 'antd';
import { Button, Col, Dropdown, Menu, Row, Spin, Switch, Tooltip, Tag, message, MenuProps, Divider } from 'antd';
import EvaluationTable from './../EvaluationTable/EvaluationTable';
import EvaluationTableWithChat from '../EvaluationTable/EvaluationTableWithChat';
import { DownOutlined } from '@ant-design/icons';
Expand Down Expand Up @@ -92,7 +92,7 @@ export default function Evaluations() {
})
.then((res) => res.json())
.then((data) => {
return data.csvdata
return data
})
.catch((err) => {
console.error(err);
Expand Down Expand Up @@ -227,6 +227,8 @@ export default function Evaluations() {
</Col>
</Row>

<Divider style={{marginTop:30, marginBottom:30}}></Divider>

{!chatModeActivated &&
evaluationTable
}
Expand Down

0 comments on commit 6aa769d

Please sign in to comment.