Skip to content

Commit afc1331

Browse files
Merge pull request #12 from TensorBlock/image-generation-support
Image generation support
2 parents 53dc6ad + 1a22893 commit afc1331

24 files changed

+1375
-115
lines changed

package-lock.json

Lines changed: 61 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
"preview": "vite preview"
1717
},
1818
"dependencies": {
19-
"@ai-sdk/fireworks": "^0.2.5",
20-
"@ai-sdk/google": "^1.2.5",
21-
"@ai-sdk/openai": "^1.3.6",
22-
"@ai-sdk/togetherai": "^0.2.5",
23-
"@anthropic-ai/sdk": "^0.39.0",
19+
"@ai-sdk/fireworks": "^0.2.13",
20+
"@ai-sdk/google": "^1.2.13",
21+
"@ai-sdk/openai": "^1.3.20",
22+
"@ai-sdk/togetherai": "^0.2.13",
23+
"@anthropic-ai/sdk": "^0.40.0",
2424
"@openrouter/ai-sdk-provider": "^0.4.5",
25-
"ai": "^4.2.10",
25+
"ai": "^4.3.10",
2626
"axios": "^1.8.4",
2727
"dotenv": "^16.4.7",
2828
"electron-builder": "26.0.12",

src/App.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import { useEffect } from 'react';
1+
import { useEffect, useState } from 'react';
22
import { ChatPage } from './components/pages/ChatPage';
3+
import { ImageGenerationPage } from './components/pages/ImageGenerationPage';
4+
import { TranslationPage } from './components/pages/TranslationPage';
35
import MainLayout from './components/layout/MainLayout';
46
import DatabaseInitializer from './components/core/DatabaseInitializer';
57

68
function App() {
9+
const [activePage, setActivePage] = useState('chat');
10+
const [showSettings, setShowSettings] = useState(false);
711

812
// Handle link clicks
913
useEffect(() => {
@@ -22,11 +26,16 @@ function App() {
2226
};
2327
}, []);
2428

29+
const handlePageChange = (page: string) => {
30+
setActivePage(page);
31+
};
2532

2633
return (
2734
<DatabaseInitializer>
28-
<MainLayout>
29-
<ChatPage/>
35+
<MainLayout activePage={activePage} onChangePage={handlePageChange} showSettings={showSettings} setShowSettings={setShowSettings}>
36+
{activePage === 'chat' && <ChatPage />}
37+
{activePage === 'image' && <ImageGenerationPage />}
38+
{activePage === 'translation' && <TranslationPage />}
3039
</MainLayout>
3140
</DatabaseInitializer>
3241
);

src/components/chat/ChatMessageArea.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import ProviderIcon from '../ui/ProviderIcon';
1212
import { useTranslation } from '../../hooks/useTranslation';
1313
import FileUploadButton from './FileUploadButton';
1414
import FileAttachmentDisplay from './FileAttachmentDisplay';
15+
import ImageGenerationButton from './ImageGenerationButton';
1516

1617
interface ChatMessageAreaProps {
1718
activeConversation: Conversation | null;
@@ -319,7 +320,7 @@ export const ChatMessageArea: React.FC<ChatMessageAreaProps> = ({
319320
:<></>;
320321

321322
return (
322-
<div className="flex flex-col w-full h-full max-w-full">
323+
<div className="flex flex-col w-full h-full">
323324
{/* Messages area */}
324325
<div className="flex-1 p-4 space-y-4 overflow-y-auto">
325326
{getMessagesList().map((message) => {
@@ -527,11 +528,16 @@ export const ChatMessageArea: React.FC<ChatMessageAreaProps> = ({
527528
<div className='flex flex-row items-center h-full gap-2'>
528529
{/* File upload button */}
529530
{onSendMessageWithFiles && (
530-
<FileUploadButton
531-
onFilesSelected={handleFilesSelected}
532-
disabled={isLoading || isCurrentlyStreaming}
533-
/>
534-
)}
531+
<FileUploadButton
532+
onFilesSelected={handleFilesSelected}
533+
disabled={isLoading || isCurrentlyStreaming}
534+
/>
535+
)}
536+
537+
{/* Image generation button */}
538+
<ImageGenerationButton
539+
disabled={isLoading || isCurrentlyStreaming}
540+
/>
535541
</div>
536542

537543
{/* Web search element */}

0 commit comments

Comments
 (0)