Commit graph

23 commits

Author SHA1 Message Date
Andrew Beal
d2e7b47c65 refactor: centralize icon handling and improve attachment UI
- Move icon name logic to Attachment and Reference classes
- Create reusable setElementIcon Svelte action in ElementHelper
- Update ChatArea and ChatAttachments to use new icon helper
- Add visual separator and background color for message attachments
- Fix duplicate URIs in drag-and-drop file handling
- Improve attachment icon centering with flexbox layout
2025-12-23 20:18:27 +00:00
Andrew Beal
ea9cd211fc refactor: extract MIME type mappings and improve attachment handling
- Move MimeTypeToFileTypes and FileTypeToMimeType mappings to dedicated FileTypeMimeTypeMapping enum file
- Add empty content validation for file attachments
- Add PDF support for Gemini
- Display attachment references in user messages with file info
- Fix OpenAI unsupported mime type message formatting
- Improve URI list handling in InputService to include text/plain
- Update chat area padding and styling for better attachment display
- Prevent drag selection on chat padding element
- Update test assertions for new unsupported mime type message format
2025-12-23 12:04:29 +00:00
Andrew Beal
13cdd0a162 feat: add support for file attachments via drag and drop and paste.
refactor: standardize file type and MIME type handling across AI providers

Introduce centralized MimeType enum and bidirectional mappings between file types and MIME types. Update Claude, Gemini, and OpenAI implementations to use consistent MIME type validation. Add file attachment support via drag-and-drop and paste in chat input. Expand supported file type detection to include programming languages, config files, and documentation formats.
2025-12-22 20:02:02 +00:00
Andrew Beal
8a16ee125b refactor: migrate file upload from base64 to file ID API for all providers
- Add file ID storage and upload tracking to Attachment class
- Store provider field in BaseAIClass for file service integration
- Update Claude, Gemini, and OpenAI to use file ID references
- Replace fetch with requestUrl for native Obsidian HTTP handling
- Implement graceful upload failure handling with user notifications
- Add retry logic with default values to prevent conversation breaks
- Optimize file cache refresh to run only when attachments present
- Filter empty function responses in conversation content validation
2025-12-19 20:05:46 +00:00
Andrew Beal
3e013f6c9f refactor: migrate from flag-based content types to typed properties
Replace boolean flags (isFunctionCall, isFunctionCallResponse,
isProviderSpecificContent) with explicit typed properties (functionCall,
functionResponse, attachments) in ConversationContent. Introduce Attachment
class and BaseAIFileService. Update all AI providers (Claude, Gemini, OpenAI)
to use new attachment-based binary file handling with proper error handling,
retry logic, and AbortService integration.
Implement new Files API service for all providers (not yet integrated).
2025-12-19 12:30:51 +00:00
Andrew Beal
b2856aa294 feat: add image and PDF support to ReadVaultFiles function
Add support for reading images (PNG, JPG, JPEG, WebP) and PDFs in ReadVaultFiles. Implement provider-specific formatting for binary content (Claude, OpenAI, Gemini). Update conversation structure to handle binary files separately from text responses. Add unpdf library for PDF text extraction in search.
2025-12-16 20:50:28 +00:00
Andrew Beal
d36815c214 feat: add Gemini thought signature support and OpenAI Responses API migration
Implement thought signature tracking for Gemini function calls to support Gemini 3 requirements. Migrate OpenAI integration from Chat Completions to Responses API with proper input/output item handling. Add cross-provider compatibility via legacy text format fallback for conversations without thought signatures or tool IDs. Improve chat auto-scroll behavior and conversation validation. Add and update AI class and conversation tests.
2025-12-10 21:27:58 +00:00
Andrew Beal
28772e7d0e feat: implement centralized abort controller with enhanced cancellation UX
Introduce a new AbortService to centralize cancellation logic across all async operations, replacing scattered AbortSignal parameters with a unified singleton service. This improves maintainability and provides consistent cancellation behavior throughout the application.

Key changes:
- Add AbortService for centralized abort signal management with automatic cleanup
- Refactor all AI providers (Claude, Gemini, OpenAI) to use AbortService instead of passing AbortSignal parameters
- Update streaming operations to use centralized abort handling
- Add CancellationIndicator component to show visual feedback during operation cancellation
- Rename ChatAreaThought to ThoughtIndicator for better semantic clarity
- Add Environment enum for consistent environment detection
- Enhance ChatService lifecycle with proper cancellation state management
- Remove scattered abort-related UI selectors and error messages in favor of dedicated indicator
- Add safeContinue() factory method to ConversationContent for internal continuations
- Update all tests to reflect new abort handling architecture

This change simplifies the API surface by removing AbortSignal parameters from method signatures while improving the user experience with clearer cancellation feedback.
2025-12-04 23:04:20 +00:00
Andrew Beal
2d5a1b52bf feat: add interactive diff viewer with user approval workflow
Implement a comprehensive diff viewing system that allows users to review and approve/reject file changes before they're applied. The system includes event-driven architecture for managing diff lifecycle and integrates diff2html for rich visual diffs.

Key changes:
- Add DiffService for managing diff approval workflow with accept/reject/suggest actions
- Create EventService for type-safe event handling (DiffOpened/DiffClosed)
- Add DiffView component with diff2html integration for visual diff rendering
- Modify VaultService to propose changes and require confirmation before file operations
- Update FileSystemService to support optional confirmation for write operations
- Add Event enum for centralized event type definitions
- Import custom styles and diff2html styles for proper diff rendering
- Update ConversationContent validation to support optional toolId field
- Remove FileManager from dependency injection (now accessed directly from app)
- Update .gitignore to track styles.css instead of main.css
2025-11-24 21:29:54 +00:00
Andrew Beal
18372ce01b refactor: improve error handling with structured API errors and retry logic
Replace console.error calls with Exception.log, implement typed API errors with automatic retry for transient failures (rate limits, server errors), add error state tracking to conversation content, and enhance system prompt with action-first operating principle, update unit tests
2025-11-19 20:30:53 +00:00
Andrew Beal
fbe5766d03 refactor: consolidate string utilities into StringTools class
Move isValidJson, dateToString, and escapeRegex from Helpers to new StringTools class. Add asRegex method for parsing regex literals with /pattern/flags format. Update all imports and usages across codebase.
2025-11-12 21:12:36 +00:00
Andrew Beal
643129517a refactor: convert TypeScript namespaces to standalone functions
Migrate AIProvider and SearchTrigger from namespace pattern to exported functions. Simplify OpenAITokenService async implementation, remove unused imports, fix enum aliases, and update placeholder text.
2025-11-10 12:59:48 +00:00
Andrew Beal
15f1a01e4a Strengthen type safety across AI provider implementations
Replace `any` types with proper TypeScript interfaces and type assertions throughout Claude, Gemini, and OpenAI implementations. Add explicit typing for streaming events, function parameters, and conversation content to improve type checking and reduce runtime errors.
2025-11-10 11:55:19 +00:00
Andrew Beal
679a94d173 feature: implement fuzzysearch service
refactor: rename type interfaces to use I prefix convention

Standardize naming by adding I prefix to all interface types across the codebase (StreamChunk → IStreamChunk, SearchMatch → ISearchMatch, etc.). Also rename conversationStore.ts to ConversationStore.ts for consistency.
2025-10-29 19:35:19 +00:00
Andrew Beal
a35269550d Bump package versions.
Setup Vitest.
Create unit and integration tests.
Co-authored by Claude.
2025-10-24 23:36:55 +01:00
Andrew Beal
098c598c88 feat: add updated timestamp tracking to conversations
Track when conversations are last modified by adding an `updated` field to the Conversation model. Sort conversation history by last updated time instead of creation time for better user experience.
2025-10-22 10:06:32 +01:00
Andrew Beal
afdfa3021b Refactor conversation content handling and improve error messages
- Split content and functionCall into separate fields in ConversationContent
- Extract content parsing logic into dedicated methods for Claude and Gemini
- Add API error 429 handling with provider-specific user information
- Improve error messages in naming services to include response text
- Increase max_tokens for main requests and naming services
- Optimize ChatService to reduce unnecessary saves and array recreations
- Remove message key binding in ChatArea to improve performance
- Adjust chat window max-width to fixed pixel value
2025-10-20 08:30:08 +01:00
Andrew Beal
eac7ac13fb Add Claude API provider support with streaming and tool integration
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 14:23:24 +01:00
Andrew Beal
b99c2062dd refactor: use stable message IDs instead of index-based tracking
Replace index-based message identification with stable UUID-based IDs for proper streaming state management and message updates across chat components
2025-10-12 13:07:54 +01:00
Andrew Beal
62104f0abd Refactor AI function handling by introducing AIFunctionCall and AIFunctionResponse classes, updating function definitions, and enhancing conversation content management. Remove unused code and improve service registration for AIFunctionService. 2025-10-06 23:01:20 +01:00
Andrew Beal
df1d9391b2 Enhance conversation management by adding file path handling in Conversation class, updating ConversationHistoryModal for improved item deletion and state management, and implementing current conversation path retrieval in ConversationFileSystemService. 2025-10-05 13:37:28 +01:00
Andrew Beal
74eb20c2a1 Implement conversation history modal with Svelte component, enhance conversation file system service for loading conversations, and update styles for modal presentation. Refactor file handling methods and remove unused modal service. 2025-10-05 13:06:05 +01:00
Andrew Beal
ace478c311 Refactor conversation handling by introducing Conversation and ConversationContent classes, updating ChatArea and ChatWindow components, and enhancing file system service for conversation management. 2025-10-04 13:10:22 +01:00