Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add file tree, add include and exclude prefix for auto ingestion #639

Merged
merged 6 commits into from
Nov 22, 2024

Conversation

StrongMonkey
Copy link
Contributor

@StrongMonkey StrongMonkey commented Nov 20, 2024

This PR add file tree to show knowledge files. Demo is here https://www.loom.com/share/0e707405c1194ea1a9a1ffd595347a22

It also adds a backend piece of functionality to include/exclude folder prefix so that user can add a folder in UI to automatically ingest files inside the folder.

});
}
}}
className="justify-start items-center group ml-2 hidden group-hover:block"
Copy link
Contributor

@ryanhopperlowe ryanhopperlowe Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use visible/invisible instead of hidden/block

This will prevent the row from resizing when it adds the icon button to the row

Suggested change
className="justify-start items-center group ml-2 hidden group-hover:block"
className="justify-start items-center group ml-2 invisible group-hover:visible"

Comment on lines 39 to 40
FilePathPrefixInclude []string `json:"filePathPrefixInclude,omitempty"`
FilePathPrefixExclude []string `json:"filePathPrefixExclude,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this both here and KnowledgeSourceManifest? Seems like just in KnowledgeSourceManifest is enough.

Comment on lines 28 to 29
FilePathPrefixExclude: knowledgeSource.Spec.Manifest.FilePathPrefixExclude,
FilePathPrefixInclude: knowledgeSource.Spec.Manifest.FilePathPrefixInclude,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed if we use the fields from KnowledgeSourceManifest.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, right. I will drop that

Comment on lines 104 to 111
matchInclude := isFileMatchPrefixPattern(file.Spec.FileName, source.Spec.Manifest.FilePathPrefixInclude)
matchExclude := isFileMatchPrefixPattern(file.Spec.FileName, source.Spec.Manifest.FilePathPrefixExclude)
switch {
case source.Spec.Manifest.AutoApprove != nil && *source.Spec.Manifest.AutoApprove:
file.Spec.Approved = typed.Pointer(true)
case matchExclude:
file.Spec.Approved = typed.Pointer(false)
case matchInclude:
file.Spec.Approved = typed.Pointer(true)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: only do the processing that's necessary.

Suggested change
matchInclude := isFileMatchPrefixPattern(file.Spec.FileName, source.Spec.Manifest.FilePathPrefixInclude)
matchExclude := isFileMatchPrefixPattern(file.Spec.FileName, source.Spec.Manifest.FilePathPrefixExclude)
switch {
case source.Spec.Manifest.AutoApprove != nil && *source.Spec.Manifest.AutoApprove:
file.Spec.Approved = typed.Pointer(true)
case matchExclude:
file.Spec.Approved = typed.Pointer(false)
case matchInclude:
file.Spec.Approved = typed.Pointer(true)
}
switch {
case source.Spec.Manifest.AutoApprove != nil && *source.Spec.Manifest.AutoApprove:
file.Spec.Approved = typed.Pointer(true)
case isFileMatchPrefixPattern(file.Spec.FileName, source.Spec.Manifest.FilePathPrefixInclude):
file.Spec.Approved = typed.Pointer(false)
case isFileMatchPrefixPattern(file.Spec.FileName, source.Spec.Manifest.FilePathPrefixInclude):
file.Spec.Approved = typed.Pointer(true)
}

@ryanhopperlowe
Copy link
Contributor

Screenshot 2024-11-21 at 9 34 30 AM

Noticing that the add button is getting cutoff when the file name is too long. I think we need to truncate the text and add a tooltip to it

Copy link
Contributor

@ryanhopperlowe ryanhopperlowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discovered above issue

@StrongMonkey
Copy link
Contributor Author

@ryanhopperlowe good catch, should be fixed 🙏
image

@ryanhopperlowe
Copy link
Contributor

@ryanhopperlowe good catch, should be fixed 🙏 image

Beautiful 🙌

Signed-off-by: Daishan Peng <[email protected]>
Signed-off-by: Daishan Peng <[email protected]>
Signed-off-by: Daishan Peng <[email protected]>
Signed-off-by: Daishan Peng <[email protected]>
Signed-off-by: Daishan Peng <[email protected]>
@StrongMonkey StrongMonkey merged commit e1648bc into otto8-ai:main Nov 22, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants