Skip to content
Snippets Groups Projects
Commit 500a8c13 authored by deep1401's avatar deep1401
Browse files

Remove function from api file and make it a url and move logic to the component

parent deef7232
No related branches found
No related tags found
No related merge requests found
...@@ -121,10 +121,16 @@ const EvalJobsTable = () => { ...@@ -121,10 +121,16 @@ const EvalJobsTable = () => {
fallbackData: [], fallbackData: [],
}); });
// New function to call CombinedReports via SDK and send data to ViewPlotModal
const handleCombinedReports = async () => { const handleCombinedReports = async () => {
try { try {
const data = await chatAPI.COMPARE_EVALS(selected); const jobIdsParam = selected.join(',');
const compareEvalsUrl = chatAPI.Endpoints.Charts.CompareEvals(jobIdsParam);
const response = await fetch(compareEvalsUrl, { method: 'GET' });
if (!response.ok) {
throw new Error('Network response was not ok');
}
const data = await response.json();
console.log('data', data);
setCurrentData(JSON.stringify(data)); setCurrentData(JSON.stringify(data));
setOpenPlotModal(true); setOpenPlotModal(true);
setChart(false); setChart(false);
...@@ -187,10 +193,10 @@ const EvalJobsTable = () => { ...@@ -187,10 +193,10 @@ const EvalJobsTable = () => {
level="body-sm" level="body-sm"
startDecorator={<ChartColumnIncreasingIcon size="20px" />} startDecorator={<ChartColumnIncreasingIcon size="20px" />}
// Uncomment this line to enable the combined reports feature // Uncomment this line to enable the combined reports feature
// onClick={handleCombinedReports} onClick={handleCombinedReports}
onClick={() => { // onClick={() => {
alert('this feature coming soon'); // alert('this feature coming soon');
}} // }}
sx={{ cursor: 'pointer' }} sx={{ cursor: 'pointer' }}
> >
<>Compare Selected Evals</> <>Compare Selected Evals</>
......
...@@ -1196,6 +1196,11 @@ Endpoints.ServerInfo = { ...@@ -1196,6 +1196,11 @@ Endpoints.ServerInfo = {
StreamLog: () => API_URL() + 'server/stream_log', StreamLog: () => API_URL() + 'server/stream_log',
}; };
Endpoints.Charts = {
CompareEvals: (jobIds: string) =>
API_URL() + 'evals/compare_evals?job_list=' + jobIds,
}
export function GET_TRAINING_TEMPLATE_URL() { export function GET_TRAINING_TEMPLATE_URL() {
return API_URL() + 'train/templates'; return API_URL() + 'train/templates';
} }
...@@ -1551,22 +1556,6 @@ export async function EXPERIMENT_EDIT_EVALUATION( ...@@ -1551,22 +1556,6 @@ export async function EXPERIMENT_EDIT_EVALUATION(
return result; return result;
} }
export async function COMPARE_EVALS(jobIds: string[]) {
const jobIdsParam = jobIds.join(',');
const url = API_URL() + 'evals/compare_evals?job_list=' + jobIdsParam;
console.log('url', url);
console.log('jobIds', jobIds);
const response = await fetch(url, {
method: 'GET'
});
if (!response.ok) {
throw new Error('Network response was not ok');
}
const data = await response.json();
console.log('data', data);
return data;
}
export async function EXPERIMENT_ADD_GENERATION( export async function EXPERIMENT_ADD_GENERATION(
id: string, id: string,
name: string, name: string,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment