Web Lab 2: Add project files as context to AI tutor#68567
Conversation
fisher-alice
left a comment
There was a problem hiding this comment.
Looks great! Left some minor comments/questions. Nice job!
| } | ||
| dispatch( | ||
| addItemToUserAddedContext({ | ||
| displayName: fullFilename, |
There was a problem hiding this comment.
Curious why you have both displayName and filename - they seem like duplicates.
There was a problem hiding this comment.
They are now, but when we add code snippets the display name for those will be something like my_file.html (6-8)
There was a problem hiding this comment.
Oh gotcha - that make sense. Thanks!
| clickHandler: () => openRenameFilePrompt({fileId: file.id}), | ||
| }, | ||
| { | ||
| condition: enableUserAddedContext(appName, file), |
There was a problem hiding this comment.
I wonder if we should display this option if the user is not in the AI tutor tab.
There was a problem hiding this comment.
What option is this referring to?
There was a problem hiding this comment.
Alice is wondering if we should show "add to AI Tutor Chat" as an option on the file dropdown if the ai tutor tab isn't open. I think it makes sense for now to always show it.
| @@ -1,4 +1,5 @@ | |||
| { | |||
| "addToAiTutorContext": "Add to AI Tutor Chat", | |||
There was a problem hiding this comment.
Do we still need to add loc strings?
There was a problem hiding this comment.
Not sure, but I'm going to keep doing it until there's an official announcement 😄
|
This looks like a great addition and something I could see going tutor-wide pretty soon! With that in mind and in the interest of keeping the shared plumbing clean (especially things like As discussed offline, I have prepped a stacked PR to better integrate this with |
This is an initial implementation (UI subject to change) of allowing users to add text-based project files to AI Tutor as context. This feature will only be available in Web Lab 2 for now. The way the feature works is:
userAddedContext. This was discussed on slack. We need to do multiple operations on the files from within the aichat domain, so it made sense to put it here, and it could be used in other situations, not just Web Lab 2.userAddedContextwill be cleared for the next message.Screenshots
Pop-up menu option for text-based file
No pop-up menu option for an image
File chip in message editor
With multi-modal upload
Without multi-modal upload
File chip in message history
Links
Testing story
I confirmed this all works in Web Lab 2 but appears nowhere else, and does not cause issues for AI tutor in python lab or AI Chat.
Follow-up work
Exactly how we prompt the AI on how to focus on this section of code may need to be tweaked. Right now it works fine for the first message, but if you attach a new file to your second message and don't clear the context, it tends to still focus on the first file.
Next up I'm going to work on adding code snippets as context, and will look more at how to best tweak the prompt we are using here.
PR Creation Checklist: