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

toolkit: add file content viewer #825

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

danylo-boiko
Copy link
Contributor

@danylo-boiko danylo-boiko commented Oct 30, 2024

Description

  • Added viewer for imported files

AI Description

This PR introduces a new feature for retrieving files by ID, with a focus on agent and conversation files. The changes include:

  • Adding a new function, get_file, in src/backend/crud/file.py, which retrieves a file by ID. The function now accepts an optional user_id parameter, allowing for more flexible file retrieval.
  • Creating new classes, ConversationFileFull and AgentFileFull, in src/backend/schemas/file.py, to represent conversation and agent files with additional attributes like file_content.
  • Modifying the get_files_by_agent_id function in src/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.
  • Adding new routes in src/backend/routers/agent.py and src/backend/routers/conversation.py to handle file retrieval by ID for agents and conversations, respectively. These routes use the get_file function from the file_crud module.
  • Enhancing the src/interfaces/assistants_web/src/cohere-client/client.ts file by adding new methods, getConversationFile and getAgentFile, to retrieve conversation and agent files by ID.
  • Introducing new types, AgentFileFull and ConversationFileFull, in src/interfaces/assistants_web/src/cohere-client/generated/types.gen.ts, to represent conversation and agent files with additional attributes.
  • Adding new functions, getAgentFileV1AgentsAgentIdFilesFileIdGet and getFileV1ConversationsConversationIdFilesFileIdGet, in src/interfaces/assistants_web/src/cohere-client/generated/services.gen.ts, to retrieve agent and conversation files by ID.
  • Creating a new component, FileViewer, in src/interfaces/assistants_web/src/components/UI/FileViewer.tsx, to display file content.
  • Enhancing the ConversationPanel component in src/interfaces/assistants_web/src/components/Conversation/ConversationPanel.tsx to handle file viewing and deletion.
  • Adding a new hook, useFile, in src/interfaces/assistants_web/src/hooks/use-files.ts, to retrieve agent and conversation files by ID.
  • Introducing new tests in src/backend/tests/unit/routers/test_conversation.py to ensure the proper functioning of file retrieval by ID for conversations.

@tianjing-li
Copy link
Collaborator

@danylo-boiko Always happy to see more contributions from you.Will review when bandwidth permits

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.

2 participants