-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moooore QA fixes in new document parameters (#630)
- [ ] Link from a log to document paramaters history tag. - [ ] Fix run batch eval modal to show mapped input - [ ] Fix run batch doc modal to show linked dataset to doc and mapped fields. - [ ] Fix tooltip colors in evaluation stats - [ ] Fix tabs when fullWidth prop is present
- Loading branch information
1 parent
0e25a0a
commit 28dea3d
Showing
16 changed files
with
339 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...umentUuid]/batch/_components/RunPromptInBatchModal/useMappedParametersFromLocalStorage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { useEffect } from 'react' | ||
|
||
import { Dataset, DocumentVersion } from '@latitude-data/core/browser' | ||
import { RunBatchParameters } from '$/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/_components/Actions/CreateBatchEvaluationModal/useRunBatch' | ||
import { useDocumentParameters } from '$/hooks/useDocumentParameters' | ||
|
||
/** | ||
* This hook map parameters | ||
* from document.datasetId that are mapped in the | ||
* document paramters UI if any | ||
* | ||
* IMPORTANT: Other wise it will ignore if it's a different dataset | ||
*/ | ||
export function useMappedParametersFromLocalStorage({ | ||
document, | ||
commitVersionUuid, | ||
parametersList, | ||
onDatasetReady, | ||
selectedDataset, | ||
}: { | ||
document: DocumentVersion | ||
commitVersionUuid: string | ||
parametersList: string[] | ||
selectedDataset: Dataset | null | undefined | ||
onDatasetReady: (_args: { mapped: RunBatchParameters }) => void | ||
}) { | ||
const { | ||
dataset: { mappedInputs }, | ||
} = useDocumentParameters({ | ||
documentVersionUuid: document.documentUuid, | ||
commitVersionUuid, | ||
}) | ||
useEffect(() => { | ||
if (!selectedDataset) return | ||
if (selectedDataset.id !== document.datasetId) return | ||
|
||
const mappedParameters = parametersList.reduce((acc, key) => { | ||
acc[key] = mappedInputs[key] | ||
return acc | ||
}, {} as RunBatchParameters) | ||
|
||
onDatasetReady({ mapped: mappedParameters }) | ||
}, [parametersList, document, selectedDataset, mappedInputs]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.