Skip to content

Commit

Permalink
chore: move Usage table in Call summary (#2641)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie-rasmussen authored Oct 10, 2024
1 parent 6245bcf commit 3ef2591
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ const useCallTabs = (call: CallSchema) => {
},
{
label: 'Summary',
content: <CallSummary call={call} />,
content: (
<Tailwind style={{height: '100%', overflow: 'auto'}}>
<CallSummary call={call} />
</Tailwind>
),
},
{
label: 'Use',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {Divider} from '@mui/material';
import _ from 'lodash';
import React from 'react';

Expand Down Expand Up @@ -32,7 +31,22 @@ export const CallSummary: React.FC<{
);

return (
<div style={{padding: 8, overflow: 'auto'}}>
<div className="overflow-auto px-16 pt-12">
{span.summary.usage && (
<div className="mb-16">
{/* This styling is similar to what is is SimpleKeyValueTable */}
<p
className="mb-10"
style={{
fontWeight: 600,
marginRight: 10,
paddingRight: 10,
}}>
Usage
</p>
<CostTable usage={span.summary.usage as {[key: string]: UsageData}} />
</div>
)}
<SimpleKeyValueTable
data={{
Operation:
Expand Down Expand Up @@ -63,25 +77,6 @@ export const CallSummary: React.FC<{
...(Object.keys(summary).length > 0 ? {Summary: summary} : {}),
}}
/>
{span.summary.usage && (
<>
<Divider sx={{marginY: '16px'}} />
<div>
{/* This styling is similar to what is is SimpleKeyValueTable */}
<p
style={{
fontWeight: 600,
marginRight: 10,
paddingRight: 10,
}}>
Usage
</p>
<CostTable
usage={span.summary.usage as {[key: string]: UsageData}}
/>
</div>
</>
)}
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,35 @@ const columns: GridColDef[] = [
{
field: 'requests',
headerName: 'Requests',
headerAlign: 'right',
flex: 2,
renderCell: renderNumberCell,
},
{
field: 'prompt_tokens',
headerName: 'Input tokens',
headerAlign: 'right',
flex: 3,
renderCell: renderNumberCell,
},
{
field: 'completion_tokens',
headerName: 'Output tokens',
headerAlign: 'right',
flex: 3,
renderCell: renderNumberCell,
},
{
field: 'total_tokens',
headerName: 'Total tokens',
headerAlign: 'right',
flex: 3,
renderCell: renderNumberCell,
},
{
field: 'cost',
headerName: 'Total Cost',
headerAlign: 'right',
flex: 3,
renderCell: (params: GridRenderCellParams) => (
<Box sx={{textAlign: 'right', width: '100%'}}>
Expand Down

0 comments on commit 3ef2591

Please sign in to comment.