Skip to content
Snippets Groups Projects
Unverified Commit b366c18b authored by ali asaria's avatar ali asaria Committed by GitHub
Browse files

Merge pull request #267 from transformerlab/fix/rag-fixed-on-rag-folder

Allow setting a fixed folder from outside the Documents component.
parents b947ef47 85ffee03
Branches
Tags
No related merge requests found
......@@ -140,6 +140,7 @@ export default function Documents({
experimentInfo,
fullPage = false,
additionalMessage = false,
fixedFolder = '',
}) {
const [doc, setDoc] = React.useState<Doc>('desc');
const [selected, setSelected] = React.useState<readonly string[]>([]);
......@@ -154,13 +155,7 @@ export default function Documents({
const [loading, setLoading] = React.useState(false);
const [currentFolder, setCurrentFolder] = React.useState('');
React.useEffect(() => {
if (!additionalMessage) {
setCurrentFolder('rag');
}
}, [additionalMessage]);
const [currentFolder, setCurrentFolder] = React.useState(fixedFolder);
const {
data: rows,
......@@ -405,6 +400,10 @@ export default function Documents({
</FormControl>
</React.Fragment>
);
/****
* Main Documents Component is Here
*/
return (
<>
<Modal
......@@ -470,9 +469,9 @@ export default function Documents({
) : (
<>
<Link
disabled={fixedFolder !== ''}
onClick={() => {
additionalMessage? setCurrentFolder('') :
setCurrentFolder('rag');
setCurrentFolder('');
}}
>
Documents /
......@@ -712,6 +711,11 @@ export default function Documents({
</tr>
</thead>
<tbody>
{rows?.status == 'error' && (
<tr>
<td colSpan={2}>{/*rows?.message*/}</td>
</tr>
)}
{rows?.length == 0 && (
<tr>
<td colSpan={2} style={{ padding: '2rem' }}>
......@@ -745,7 +749,8 @@ export default function Documents({
</Stack>
{additionalMessage && (
<Typography level="body-xs" mt={1}>
Documents for RAG should be uploaded in a folder called "rag" and only those will be indexed for RAG.
Documents for RAG should be uploaded in a folder called "rag" and only
those will be indexed for RAG.
</Typography>
)}
</>
......
......@@ -117,7 +117,7 @@ export default function DocumentSearch({ experimentInfo, setRagEngine }) {
flexDirection: 'column',
}}
>
<Documents experimentInfo={experimentInfo} />
<Documents experimentInfo={experimentInfo} fixedFolder="rag" />
</Box>
<Box sx={{ flex: 1, display: 'flex', flexDirection: 'column' }}>
<Query experimentInfo={experimentInfo} />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment