-
Notifications
You must be signed in to change notification settings - Fork 15
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
Knowledge #241
Conversation
Signed-off-by: Daishan Peng <[email protected]>
Signed-off-by: Daishan Peng <[email protected]>
556f8b0
to
d99027c
Compare
pkg/api/handlers/agent.go
Outdated
return err | ||
} | ||
|
||
file.Spec.Approved = &[]bool{body.Approve}[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file.Spec.Approved = &[]bool{body.Approve}[0] | |
file.Spec.Approved = &body.Approve |
pkg/api/handlers/agent.go
Outdated
|
||
file.Spec.Approved = &[]bool{body.Approve}[0] | ||
|
||
return req.Storage.Update(req.Context(), &file) |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove line.
Same here. |
</TypographyP> | ||
</div> | ||
|
||
{statusIcon} | ||
{isApproved ? ( | ||
// eslint-disable-next-line |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
getKnowledgeFiles: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 things here:
- use
Todo
instead ofany
- can you add a type here?
<div | ||
className="hover:cursor-pointer" | ||
onClick={() => { | ||
setIsApproved(false); | ||
approveFile(file, false); | ||
}} | ||
> | ||
<FileStatusIcon status={file.ingestionStatus} /> | ||
</div> |
There was a problem hiding this comment.
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! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
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!, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 !
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generated by ai :)
There was a problem hiding this comment.
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!, |
There was a problem hiding this comment.
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 !
There was a problem hiding this comment.
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?
Same here. @ryanhopperlowe @tylerslaton should be fixed. |
0871cef
to
9024aee
Compare
Signed-off-by: Daishan Peng <[email protected]>
9024aee
to
2741f7b
Compare
Signed-off-by: Daishan Peng <[email protected]>
Signed-off-by: Daishan Peng <[email protected]>
<RemoteSourceSettingModal | ||
agentId={agentId} | ||
isOpen={isSettingModalOpen} | ||
onOpenChange={setIsSettingModalOpen} | ||
remoteKnowledgeSource={websiteSource!} | ||
/> | ||
<AddWebsiteModal | ||
agentId={agentId} | ||
websiteSource={websiteSource!} | ||
startPolling={startPolling} | ||
isOpen={isAddWebsiteModalOpen} | ||
onOpenChange={setIsAddWebsiteModalOpen} | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<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]>
There was a problem hiding this 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!
Knowledge UX revamp:
This includes
#228
#212
#208
#207
#206
#201
#199