You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: store absolute attachment paths in message content for AI context
## Summary
Enables text-based AI models to reference images and other attachments
from previous generations by storing absolute file paths as hidden markers
in the message content. This allows seamless multi-model conversations where
image-generating models (DALL-E, Flux) can pass their output to text models.
## Changes
### Backend Changes
- Add `getBasePath()` IPC handler to expose attachment storage directory path
- Update `AttachmentStorage` constructor documentation to clarify Electron
userData paths across platforms (macOS, Windows, Linux)
### Frontend State Management
- Modify `persistMessage()` to generate content markers when messages have
attachments but no text content
- Format: `[attachment:type:/absolute/path:filename]`
- Implement absolute path resolution via IPC to `attachmentStorage.getBasePath()`
- Return generated content from `persistMessage()` for UI synchronization
- Track generated content separately to avoid duplicating in state
### UI Rendering
- Filter attachment markers from visible content in `Response` component
so users don't see the internal markers
- Support both new format `[attachment:...]` and old markdown format
``
- Preserve message rendering when content is only attachment markers
### Message State Synchronization
- Update `ChatPage.tsx` to capture generated content from `persistMessage()`
- Add generated content to message `parts` array for inclusion in AI context
- Ensure message state stays in sync with persisted content
## Technical Details
- Attachment markers are invisible to end users but included in AI context
- Absolute paths ensure models can locate files regardless of session
- Backward compatible with existing messages and old markdown format
- All changes preserve type safety with proper TypeScript updates
## Migration
- Script updated to use correct Electron userData path
- Previous: ~/levante/attachments/
- Correct: ~/Library/Application Support/Levante/attachments/ (macOS)
0 commit comments