-
Notifications
You must be signed in to change notification settings - Fork 2
feat(PDFProView): ✨ feat: Add MessageBubble and TypingIndica… #51
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
base: develop
Are you sure you want to change the base?
Conversation
…nents for conversation UI - Implemented MessageBubble component to display user and assistant messages with timestamps and avatars. - Created TypingIndicator component to show a typing animation for the assistant. - Updated conversation index to export new components. feat: Define conversation types and utility functions - Added ConversationMessage and ConversationPanelProps interfaces for type safety. - Introduced PDFConversationHandler class for handling messages with PDF context and extracting structured data. feat: Enhance PDF handling in PdfPage component - Extract structured data from rendered text layers and store it in state. - Updated PDF structured data management to include text blocks and metadata. fix: Improve OCRMarkers component to display AI-generated markers - Integrated AI-generated OCR markers into the Markers component. - Added user feedback when no markers are available. docs: Create README for OpenAI integration - Documented setup, usage, and error handling for OpenAI document analysis service. - Provided examples and response structures for clarity. feat: Implement OpenAI document analysis service - Developed OpenAIDocumentService class for analyzing PDF content and extracting structured data. - Added validation for API responses and connection testing functionality.
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.
Pull Request Overview
This pull request introduces a conversational AI assistant feature to the PDF viewer application, enabling users to interact with PDF documents through natural language queries. The assistant uses OpenAI's structured outputs to analyze PDF content and extract coordinate-based information that integrates with the existing OCR marker system.
- Integration of OpenAI service for document analysis with structured outputs
- Addition of conversation UI components including chat panel, message bubbles, and typing indicators
- Enhanced PDF data extraction to capture structured text blocks with coordinates for improved AI analysis
Reviewed Changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/services/openai/types.ts |
Defines TypeScript interfaces and schema for OpenAI document analysis API |
src/services/openai/documentService.ts |
Core OpenAI service implementation for PDF document analysis |
src/services/openai/README.md |
Comprehensive documentation for OpenAI integration setup and usage |
src/features/conversation/utils/conversationHandler.ts |
Handler utility for managing AI conversations with PDF context |
src/features/conversation/components/ConversationPanel.tsx |
Main conversation UI component with message handling |
src/features/conversation/components/MessageBubble.tsx |
Individual message display component |
src/features/conversation/components/TypingIndicator.tsx |
Loading animation component for assistant responses |
src/features/pdfViewer/components/PdfPage.tsx |
Enhanced PDF page component to extract structured text data |
src/features/pdfViewer/components/ocr-markers/OCRMarkers.tsx |
Updated markers component to display AI-generated results |
src/data/types.ts |
New type definitions for PDF structured data |
src/data/atoms.ts |
Additional Jotai atoms for conversation and structured data state |
src/App.tsx |
Main application layout integration of conversation panel |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| return | ||
| } | ||
|
|
||
| console.log('a') |
Copilot
AI
Sep 1, 2025
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.
Remove this debug console.log statement that was likely left in by mistake.
| console.log('a') |
| <EyeIcon color={'primary.700'} /> | ||
| )} | ||
| </InputLeftAddon> | ||
| <Input disabled={true} value={ocrMark.text}></Input> |
Copilot
AI
Sep 1, 2025
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.
[nitpick] Use the more idiomatic disabled prop instead of disabled={true} for boolean attributes.
| <Input disabled={true} value={ocrMark.text}></Input> | |
| <Input disabled value={ocrMark.text}></Input> |
This pull request introduces a conversational AI assistant panel to the PDF viewer application, enabling users to interact with PDF documents through natural language queries. The assistant leverages OpenAI to analyze PDF content, extract structured data, and display relevant information and coordinate-based markers on the document. The changes also add new state management for conversation and structured PDF data, and refactor the UI to accommodate the conversation panel alongside the PDF viewer.
Conversational AI Assistant Integration
ConversationPanelcomponent, which provides a chat interface for users to ask questions about the PDF document and receive AI-generated responses. The panel manages conversation state, loading indicators, and user input.conversationHandler.ts) that interacts with OpenAI, analyzes PDF content, extracts coordinate-based data, and updates OCR markers in response to user queries.MessageBubblefor displaying messages andTypingIndicatorfor showing loading states. [1] [2]State Management Enhancements
Structured PDF Data Support
PDFTextBlock,PDFStructuredData) to represent extracted text blocks and document metadata, facilitating more advanced PDF analysis and interaction.UI Layout and Integration
App.tsxlayout to display the conversation panel alongside the PDF viewer, with improved alignment and spacing for a cohesive user experience. [1] [2] [3]Module Organization