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

Knowledge #241

Merged
merged 6 commits into from
Oct 21, 2024
Merged

Knowledge #241

merged 6 commits into from
Oct 21, 2024

Conversation

StrongMonkey
Copy link
Contributor

@StrongMonkey StrongMonkey commented Oct 18, 2024

Knowledge UX revamp:
This includes

  1. File based approved
  2. New UX on how to add files through files/onedrive/notion/websites

#228
#212
#208
#207
#206
#201
#199

Signed-off-by: Daishan Peng <[email protected]>
Signed-off-by: Daishan Peng <[email protected]>
return err
}

file.Spec.Approved = &[]bool{body.Approve}[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
file.Spec.Approved = &[]bool{body.Approve}[0]
file.Spec.Approved = &body.Approve


file.Spec.Approved = &[]bool{body.Approve}[0]

return req.Storage.Update(req.Context(), &file)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do a check here to see if we actually need to update?

@@ -288,6 +303,15 @@ func compileFileStatuses(ctx context.Context, client kclient.Client, ws *v1.Work
return final, errors.Join(errs...)
}

func (a *Handler) BindWorkspace(req router.Request, resp router.Response) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

This will cause the file to be re-enqueued when the workspace changes, which seems to be the opposite of what the comment indicates.

However, the workspace handler already lists the files, which would already have the desired effect. So, I think this can be removed.

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, I have been seeing issue where new file added doesn't trigger an ingestion. But haven't seen it anymore. Removed.

@@ -362,6 +367,7 @@ func compileKnowledgeFilesFromOneDriveConnector(ctx context.Context, c client.Cl
} else if err != nil {
errs = append(errs, err)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove line.

@ryanhopperlowe
Copy link
Contributor

ryanhopperlowe commented Oct 21, 2024

Getting this error whenever I open the knowledge accordion in /admin/agents/<id>

Screenshot 2024-10-21 at 11 38 54 AM

EDIT: this is fixed

@tylerslaton
Copy link
Contributor

Getting this error whenever I open the knowledge accordion in /admin/agents/<id>

Same here.

</TypographyP>
</div>

{statusIcon}
{isApproved ? (
// eslint-disable-next-line
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this ignoring?

When disabling eslint can you specify the rule so you don't accidentally conceal other breakages?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed by using a button

Comment on lines 26 to 27
// eslint-disable-next-line @typescript-eslint/no-explicit-any
getKnowledgeFiles: any;
Copy link
Contributor

Choose a reason for hiding this comment

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

2 things here:

  1. use Todo instead of any
  2. can you add a type here?

Comment on lines 68 to 76
<div
className="hover:cursor-pointer"
onClick={() => {
setIsApproved(false);
approveFile(file, false);
}}
>
<FileStatusIcon status={file.ingestionStatus} />
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't ever create a "clickable" div (it breaks accessibility features). Instead use <Button variant="link"> or <Button variant="ghost">

]?.title
}
remoteKnowledgeSourceType={
item.remoteKnowledgeSourceType!
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is ganranteed the type will never be empty because we already filter the files by checking if `item.remoteKnowledgeSourceType== 'notion`` so this is just bypassing type check

approveFile={async (file, approved) => {
await KnowledgeService.approveKnowledgeFile(
agentId,
file.id!,
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually I made it required, it should always be there

Copy link
Contributor

Choose a reason for hiding this comment

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

can you still remove the !

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, forgot to remove it.

<Dialog open={isOpen} onOpenChange={onOpenChange}>
<DialogContent
aria-describedby={undefined}
className="bd-secondary data-[state=open]:animate-contentShow fixed top-[50%] left-[50%] max-h-[85vh] w-[90vw] max-w-[400px] translate-x-[-50%] translate-y-[-50%] rounded-[6px] bg-white dark:bg-secondary p-[25px] shadow-[hsl(206_22%_7%_/_35%)_0px_10px_38px_-10px,_hsl(206_22%_7%_/_20%)_0px_10px_20px_-15px] focus:outline-none"
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need to override the way dialogs look here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

generated by ai :)

Copy link
Contributor

Choose a reason for hiding this comment

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

can you remove it then? we want things to stay consistent

const handleSave = async () => {
await KnowledgeService.updateRemoteKnowledgeSource(
agentId,
onedriveSource!.id!,
Copy link
Contributor

Choose a reason for hiding this comment

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

use an early return or throw instead of a !

Copy link
Contributor

Choose a reason for hiding this comment

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

there are quite a few instances of ! operators here. Can you sweep through the rest of the PR and make sure you've removed what you can?

@StrongMonkey
Copy link
Contributor Author

Getting this error whenever I open the knowledge accordion in /admin/agents/

Same here.

@ryanhopperlowe @tylerslaton should be fixed.

@StrongMonkey StrongMonkey force-pushed the knowledge branch 2 times, most recently from 0871cef to 9024aee Compare October 21, 2024 21:13
Signed-off-by: Daishan Peng <[email protected]>
@ryanhopperlowe
Copy link
Contributor

ryanhopperlowe commented Oct 21, 2024

Screenshot 2024-10-21 at 5 00 16 PM

It says notion is syncing on a brand new agent before I've even connected it. Is this expected?

@ryanhopperlowe
Copy link
Contributor

ryanhopperlowe commented Oct 21, 2024

Screenshot 2024-10-21 at 5 03 21 PM

There's some weird scroll behavior here where items are being displayed even when they exist outside of the dialog

Signed-off-by: Daishan Peng <[email protected]>
Signed-off-by: Daishan Peng <[email protected]>
Comment on lines 264 to 276
<RemoteSourceSettingModal
agentId={agentId}
isOpen={isSettingModalOpen}
onOpenChange={setIsSettingModalOpen}
remoteKnowledgeSource={websiteSource!}
/>
<AddWebsiteModal
agentId={agentId}
websiteSource={websiteSource!}
startPolling={startPolling}
isOpen={isAddWebsiteModalOpen}
onOpenChange={setIsAddWebsiteModalOpen}
/>
Copy link
Contributor

@ryanhopperlowe ryanhopperlowe Oct 21, 2024

Choose a reason for hiding this comment

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

Suggested change
<RemoteSourceSettingModal
agentId={agentId}
isOpen={isSettingModalOpen}
onOpenChange={setIsSettingModalOpen}
remoteKnowledgeSource={websiteSource!}
/>
<AddWebsiteModal
agentId={agentId}
websiteSource={websiteSource!}
startPolling={startPolling}
isOpen={isAddWebsiteModalOpen}
onOpenChange={setIsAddWebsiteModalOpen}
/>
{websiteSource && (
<>
<RemoteSourceSettingModal
agentId={agentId}
isOpen={isSettingModalOpen}
onOpenChange={setIsSettingModalOpen}
remoteKnowledgeSource={websiteSource}
/>
<AddWebsiteModal
agentId={agentId}
websiteSource={websiteSource}
startPolling={startPolling}
isOpen={isAddWebsiteModalOpen}
onOpenChange={setIsAddWebsiteModalOpen}
/>
</>
)}

Signed-off-by: Daishan Peng <[email protected]>
Copy link
Contributor

@tylerslaton tylerslaton left a comment

Choose a reason for hiding this comment

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

This looks good to me, I do wonder if we could add in a drag/drop for the local file option but as is this UX worked for me and the various cases I tried. Approved!

@StrongMonkey StrongMonkey merged commit 3308e96 into obot-platform:main Oct 21, 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.

4 participants