Skip to content

Image generation support #12

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

Merged
merged 9 commits into from
Apr 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 61 additions & 61 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
"preview": "vite preview"
},
"dependencies": {
"@ai-sdk/fireworks": "^0.2.5",
"@ai-sdk/google": "^1.2.5",
"@ai-sdk/openai": "^1.3.6",
"@ai-sdk/togetherai": "^0.2.5",
"@anthropic-ai/sdk": "^0.39.0",
"@ai-sdk/fireworks": "^0.2.13",
"@ai-sdk/google": "^1.2.13",
"@ai-sdk/openai": "^1.3.20",
"@ai-sdk/togetherai": "^0.2.13",
"@anthropic-ai/sdk": "^0.40.0",
"@openrouter/ai-sdk-provider": "^0.4.5",
"ai": "^4.2.10",
"ai": "^4.3.10",
"axios": "^1.8.4",
"dotenv": "^16.4.7",
"electron-builder": "26.0.12",
Expand Down
15 changes: 12 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { useEffect } from 'react';
import { useEffect, useState } from 'react';
import { ChatPage } from './components/pages/ChatPage';
import { ImageGenerationPage } from './components/pages/ImageGenerationPage';
import { TranslationPage } from './components/pages/TranslationPage';
import MainLayout from './components/layout/MainLayout';
import DatabaseInitializer from './components/core/DatabaseInitializer';

function App() {
const [activePage, setActivePage] = useState('chat');
const [showSettings, setShowSettings] = useState(false);

// Handle link clicks
useEffect(() => {
Expand All @@ -22,11 +26,16 @@ function App() {
};
}, []);

const handlePageChange = (page: string) => {
setActivePage(page);
};

return (
<DatabaseInitializer>
<MainLayout>
<ChatPage/>
<MainLayout activePage={activePage} onChangePage={handlePageChange} showSettings={showSettings} setShowSettings={setShowSettings}>
{activePage === 'chat' && <ChatPage />}
{activePage === 'image' && <ImageGenerationPage />}
{activePage === 'translation' && <TranslationPage />}
</MainLayout>
</DatabaseInitializer>
);
Expand Down
18 changes: 12 additions & 6 deletions src/components/chat/ChatMessageArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ProviderIcon from '../ui/ProviderIcon';
import { useTranslation } from '../../hooks/useTranslation';
import FileUploadButton from './FileUploadButton';
import FileAttachmentDisplay from './FileAttachmentDisplay';
import ImageGenerationButton from './ImageGenerationButton';

interface ChatMessageAreaProps {
activeConversation: Conversation | null;
Expand Down Expand Up @@ -319,7 +320,7 @@ export const ChatMessageArea: React.FC<ChatMessageAreaProps> = ({
:<></>;

return (
<div className="flex flex-col w-full h-full max-w-full">
<div className="flex flex-col w-full h-full">
{/* Messages area */}
<div className="flex-1 p-4 space-y-4 overflow-y-auto">
{getMessagesList().map((message) => {
Expand Down Expand Up @@ -527,11 +528,16 @@ export const ChatMessageArea: React.FC<ChatMessageAreaProps> = ({
<div className='flex flex-row items-center h-full gap-2'>
{/* File upload button */}
{onSendMessageWithFiles && (
<FileUploadButton
onFilesSelected={handleFilesSelected}
disabled={isLoading || isCurrentlyStreaming}
/>
)}
<FileUploadButton
onFilesSelected={handleFilesSelected}
disabled={isLoading || isCurrentlyStreaming}
/>
)}

{/* Image generation button */}
<ImageGenerationButton
disabled={isLoading || isCurrentlyStreaming}
/>
</div>

{/* Web search element */}
Expand Down
Loading
Loading