-
Notifications
You must be signed in to change notification settings - Fork 381
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
toolkit: add file content viewer #825
Conversation
@danylo-boiko Always happy to see more contributions from you.Will review when bandwidth permits |
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.
Backend portion looks great to me. Let me get someone with some more frontend expertise to look at the rest
All checks are good too, asked @malexw to take a look at the frontend part |
Nice, thanks! |
@danylo-boiko On an aside - and perhaps this chat can happen in a different channel, but I've been collecting internal/external feedback on the toolkit and I'm open to any suggestions you might have to build out a future roadmap, mainly look at features/dev experience improvements |
@tianjing-li I'd be happy to help with building a future roadmap. What platform do you use for communication? |
@danylo-boiko Mostly Slack, what's your email? |
|
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 is a very helpful change - thank you! It's certainly a feature that I've wished we had in the past.
Overall, I'd prefer that the file previews not be shown in a modal dialog. However, I think that's a much more involved change, and I'm happy to use the dialog for now until we have an opportunity to build a different design.
Assuming that the dialog-based preview is temporary, then I think that the changes here to pass the dialogPaddingClassName
value through the ModalContext
and Modal
components make the API for those components less clean than I'd prefer to see. The smaller padding does make the preview look better, but I'm not sure it's better enough to justify those changes to the components.
Description
AI Description
This PR introduces a new feature for retrieving files by ID, with a focus on agent and conversation files. The changes include:
get_file
, insrc/backend/crud/file.py
, which retrieves a file by ID. The function now accepts an optionaluser_id
parameter, allowing for more flexible file retrieval.ConversationFileFull
andAgentFileFull
, insrc/backend/schemas/file.py
, to represent conversation and agent files with additional attributes likefile_content
.get_files_by_agent_id
function insrc/backend/services/file.py
to return a list of file IDs instead of files. A new function,get_file_ids_by_agent_id
, is introduced to retrieve file IDs associated with a specific agent ID.src/backend/routers/agent.py
andsrc/backend/routers/conversation.py
to handle file retrieval by ID for agents and conversations, respectively. These routes use theget_file
function from thefile_crud
module.src/interfaces/assistants_web/src/cohere-client/client.ts
file by adding new methods,getConversationFile
andgetAgentFile
, to retrieve conversation and agent files by ID.AgentFileFull
andConversationFileFull
, insrc/interfaces/assistants_web/src/cohere-client/generated/types.gen.ts
, to represent conversation and agent files with additional attributes.getAgentFileV1AgentsAgentIdFilesFileIdGet
andgetFileV1ConversationsConversationIdFilesFileIdGet
, insrc/interfaces/assistants_web/src/cohere-client/generated/services.gen.ts
, to retrieve agent and conversation files by ID.FileViewer
, insrc/interfaces/assistants_web/src/components/UI/FileViewer.tsx
, to display file content.ConversationPanel
component insrc/interfaces/assistants_web/src/components/Conversation/ConversationPanel.tsx
to handle file viewing and deletion.useFile
, insrc/interfaces/assistants_web/src/hooks/use-files.ts
, to retrieve agent and conversation files by ID.src/backend/tests/unit/routers/test_conversation.py
to ensure the proper functioning of file retrieval by ID for conversations.