Skip to content

Commit 81232a9

Browse files
committed
Updated old job routes
1 parent e6c5ca9 commit 81232a9

File tree

10 files changed

+52
-16
lines changed

10 files changed

+52
-16
lines changed

src/renderer/components/Experiment/Eval/EvalJobsTable.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,10 @@ const EvalJobsTable = () => {
216216

217217
const fetchCSV = async (jobId) => {
218218
const response = await fetch(
219-
chatAPI.Endpoints.Experiment.GetAdditionalDetails(jobId),
219+
chatAPI.Endpoints.Experiment.GetAdditionalDetails(
220+
experimentInfo.id,
221+
jobId,
222+
),
220223
);
221224
const text = await response.text();
222225
return text;

src/renderer/components/Experiment/Eval/ViewCSVModal.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
} from '@mui/joy';
1212

1313
import * as chatAPI from 'renderer/lib/transformerlab-api-sdk';
14+
import { useExperimentInfo } from 'renderer/lib/ExperimentInfoContext';
1415

1516
function formatColumnNames(name) {
1617
return name
@@ -215,6 +216,7 @@ const ViewCSVModal = ({
215216
fetchCSV,
216217
compareData = null,
217218
}) => {
219+
const { experimentInfo } = useExperimentInfo();
218220
const [report, setReport] = useState({});
219221

220222
useEffect(() => {
@@ -240,7 +242,11 @@ const ViewCSVModal = ({
240242
const handleDownload = async () => {
241243
if (!compareData) {
242244
const response = await fetch(
243-
chatAPI.Endpoints.Experiment.GetAdditionalDetails(jobId, 'download'),
245+
chatAPI.Endpoints.Experiment.GetAdditionalDetails(
246+
experimentInfo.id,
247+
jobId,
248+
'download',
249+
),
244250
);
245251
const blob = await response.blob();
246252
const url = URL.createObjectURL(blob);

src/renderer/components/Experiment/Eval/ViewOutputModalStreaming.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ export default function ViewOutputModalStreaming({
3232
const logEndpoint =
3333
fileName !== ''
3434
? chatAPI.Endpoints.Experiment.StreamDetailedJSONReportFromJob(
35+
experimentInfo.id,
3536
jobId,
3637
fileName,
3738
)
3839
: chatAPI.Endpoints.Experiment.StreamOutputFromJob(
40+
experimentInfo.id,
3941
jobId,
4042
);
4143
const title_sentence =
@@ -44,6 +46,7 @@ export default function ViewOutputModalStreaming({
4446
const handleDownload = async () => {
4547
const response = await fetch(
4648
chatAPI.Endpoints.Experiment.GetAdditionalDetails(
49+
experimentInfo.id,
4750
jobId,
4851
'download',
4952
),

src/renderer/components/Experiment/Export/ViewOutputModalStreaming.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ export default function ViewOutputModalStreaming({
4141
);
4242

4343
// // Create a custom endpoint for export job output
44-
const outputEndpoint =
45-
chatAPI.Endpoints.Experiment.StreamOutputFromJob(jobId);
44+
const outputEndpoint = chatAPI.Endpoints.Experiment.StreamOutputFromJob(
45+
experimentInfo.id,
46+
jobId,
47+
);
4648

4749
return (
4850
<Modal open={jobId !== -1} onClose={() => setJobId(-1)}>

src/renderer/components/Experiment/Generate/GenerateJobsTable.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ const GenerateJobsTable = () => {
112112

113113
const fetchGenerateCSV = async (jobId) => {
114114
const response = await fetch(
115-
chatAPI.Endpoints.Experiment.GetGeneratedDataset(jobId),
115+
chatAPI.Endpoints.Experiment.GetGeneratedDataset(
116+
experimentInfo.id,
117+
jobId,
118+
),
116119
);
117120
const text = await response.text();
118121
return text;

src/renderer/components/Experiment/Generate/ViewOutputModalStreaming.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default function ViewOutputModalStreaming({ jobId, setJobId }) {
2727
>
2828
<OutputTerminal
2929
logEndpoint={chatAPI.Endpoints.Experiment.StreamOutputFromJob(
30+
experimentInfo.id,
3031
jobId,
3132
)}
3233
lineAnimationDelay={5}

src/renderer/components/Experiment/Train/ViewOutputModal.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ const fetcher = (url) => fetch(url).then((res) => res.json());
1111
export default function ViewOutputModal({ jobId, setJobId }) {
1212
const { experimentInfo } = useExperimentInfo();
1313
const { data, error, isLoading, isValidating, mutate } = useSWR(
14-
jobId == -1 ? null : chatAPI.Endpoints.Experiment.GetOutputFromJob(jobId),
14+
jobId == -1
15+
? null
16+
: chatAPI.Endpoints.Experiment.GetOutputFromJob(experimentInfo.id, jobId),
1517
fetcher,
1618
{
1719
refreshInterval: 5000, //refresh every 5 seconds

src/renderer/components/Experiment/Train/ViewOutputModalStreaming.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ export default function ViewOutputModalStreaming({
139139
>
140140
<OutputTerminal
141141
logEndpoint={chatAPI.Endpoints.Experiment.StreamOutputFromJob(
142+
experimentInfo.id,
142143
jobId,
143144
sweeps,
144145
)}

src/renderer/components/Experiment/Workflows/WorkflowRuns/JobDetails.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export default function JobDetails({ experimentId, jobId, onClose }) {
129129
>
130130
<OutputTerminal
131131
logEndpoint={chatAPI.Endpoints.Experiment.StreamOutputFromJob(
132+
experimentId,
132133
jobId,
133134
)}
134135
lineAnimationDelay={1}

src/renderer/lib/api-client/endpoints.ts

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -390,16 +390,30 @@ Endpoints.Experiment = {
390390
`${API_URL()}experiment/${experimentId}/plugins/new_plugin?pluginId=${
391391
pluginId
392392
}`,
393-
GetOutputFromJob: (jobId: string) => `${API_URL()}jobs/${jobId}/output`,
394-
StreamOutputFromJob: (jobId: string, sweep: boolean = false) =>
395-
`${API_URL()}jobs/${jobId}/stream_output?sweeps=${sweep}`,
396-
StreamDetailedJSONReportFromJob: (jobId: string, fileName: string) =>
397-
`${API_URL()}jobs/${jobId}/stream_detailed_json_report?file_name=${fileName}`,
398-
GetAdditionalDetails: (jobId: string, task: string = 'view') =>
399-
`${API_URL()}jobs/${jobId}/get_additional_details?task=${task}`,
400-
GetGeneratedDataset: (jobId: string) =>
401-
`${API_URL()}jobs/${jobId}/get_generated_dataset`,
402-
GetPlotJSON: (jobId: string) => `${API_URL()}jobs/${jobId}/get_figure_json`,
393+
GetOutputFromJob: (experimentId: string, jobId: string) =>
394+
`${API_URL()}experiment/${experimentId}/jobs/${jobId}/output`,
395+
StreamOutputFromJob: (
396+
experimentId: string,
397+
jobId: string,
398+
sweep: boolean = false,
399+
) =>
400+
`${API_URL()}experiment/${experimentId}/jobs/${jobId}/stream_output?sweeps=${sweep}`,
401+
StreamDetailedJSONReportFromJob: (
402+
experimentId: string,
403+
jobId: string,
404+
fileName: string,
405+
) =>
406+
`${API_URL()}experiment/${experimentId}/jobs/${jobId}/stream_detailed_json_report?file_name=${fileName}`,
407+
GetAdditionalDetails: (
408+
experimentId: string,
409+
jobId: string,
410+
task: string = 'view',
411+
) =>
412+
`${API_URL()}experiment/${experimentId}/jobs/${jobId}/get_additional_details?task=${task}`,
413+
GetGeneratedDataset: (experimentId: string, jobId: string) =>
414+
`${API_URL()}experiment/${experimentId}/jobs/${jobId}/get_generated_dataset`,
415+
GetPlotJSON: (experimentId: string, jobId: string) =>
416+
`${API_URL()}experiment/${experimentId}/jobs/${jobId}/get_figure_json`,
403417
};
404418

405419
Endpoints.Jobs = {

0 commit comments

Comments
 (0)