Skip to content
Snippets Groups Projects
Commit 8a4f4727 authored by deep1401's avatar deep1401
Browse files

Setting eval name using friendly name generator if run_name is not specified

parent 462ada1b
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,7 @@ import {
Trash2Icon,
XSquareIcon,
} from 'lucide-react';
import { generateFriendlyName } from 'renderer/lib/utils';
import DynamicPluginForm from '../DynamicPluginForm';
import EvalJobsTable from './EvalJobsTable.tsx';
......@@ -102,10 +103,10 @@ export default function Eval({
isLoading: pluginsIsLoading,
} = useSWR(
experimentInfo?.id &&
chatAPI.Endpoints.Experiment.ListScriptsOfType(
experimentInfo?.id,
'evaluator'
),
chatAPI.Endpoints.Experiment.ListScriptsOfType(
experimentInfo?.id,
'evaluator'
),
fetcher
);
......@@ -120,7 +121,7 @@ export default function Eval({
method: 'POST',
body: value,
}
).then(() => {});
).then(() => { });
}
}
......@@ -133,6 +134,9 @@ export default function Eval({
return 'No experiment selected';
}
console.log("ExperimentInfo", experimentInfo);
return (
<>
<Sheet
......@@ -164,12 +168,17 @@ export default function Eval({
/* The way evals are defined right now, they need a unique name. This is a hack
until we have a better solution */
const nameOfThisEvaluation =
selectedPlugin + '_' + JSON.stringify(formJson);
let nameOfThisEvaluation;
if (formJson.run_name) {
nameOfThisEvaluation = formJson.run_name;
} else {
nameOfThisEvaluation = selectedPlugin + '_' + generateFriendlyName();
}
addEvaluation(selectedPlugin, nameOfThisEvaluation, formJson);
setOpen(false);
}}
>
<Stack spacing={2}>
<FormControl>
<FormLabel>Evaluation Plugin Template:</FormLabel>
......@@ -179,7 +188,6 @@ export default function Eval({
experimentInfo={experimentInfo}
plugin={selectedPlugin}
/>
<Button type="submit">Submit</Button>
</Stack>
</form>
......
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