-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add image support in chat (#132)
* feat: add image support in chat - Add support for pasting images directly into chat input - Create new MentionableImage type for handling image data - Add image preview in chat input alongside file content preview - Add visual indicator for focused mentionable badge * feat: add image support for LLM providers - Add support for handling image content in messages across LLM providers (Anthropic, Gemini, Groq, OpenAI) - Modify PromptGenerator to include image data URLs in message content - Define new types for content parts (TextContent and ImageContentPart) in request.ts * feat: add image upload button - Add ImageUploadButton component for direct image uploads - Refactor image handling to support multiple images at once * feat: support drag & drop for images * style: use text overflow in model select
- Loading branch information
Showing
19 changed files
with
640 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { ImageIcon } from 'lucide-react' | ||
|
||
export function ImageUploadButton({ | ||
onUpload, | ||
}: { | ||
onUpload: (files: File[]) => void | ||
}) { | ||
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
const files = Array.from(event.target.files ?? []) | ||
if (files.length > 0) { | ||
onUpload(files) | ||
} | ||
} | ||
|
||
return ( | ||
<label className="smtcmp-chat-user-input-submit-button"> | ||
<input | ||
type="file" | ||
accept="image/*" | ||
multiple | ||
onChange={handleFileChange} | ||
style={{ display: 'none' }} | ||
/> | ||
<div className="smtcmp-chat-user-input-submit-button-icons"> | ||
<ImageIcon size={12} /> | ||
</div> | ||
<div>Image</div> | ||
</label> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.