Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b757685

Browse filesBrowse files
committed
fix bug
1 parent 9f54d3c commit b757685
Copy full SHA for b757685

File tree

Expand file treeCollapse file tree

14 files changed

+127
-117
lines changed
Filter options
Expand file treeCollapse file tree

14 files changed

+127
-117
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# genfly.dev
22

33

4-
[![genfly.dev: AI-Powered Full-Stack Web Development in the Browser](https://github.com/user-attachments/assets/1a36b52a-14fc-4831-a583-486d10e90031)](https://genfly.dev)
4+
[![genfly.dev: AI-Powered Full-Stack Web Development in the Browser](https://github.com/user-attachments/assets/563b1902-465f-4b84-b05c-69548f5872ec)](https://genfly.dev)
55

66
Welcome to genfly.dev, an open-source AI-powered code generation tool that provides an isolated sandbox environment preview for each generated application
77

‎app/(auth)/layout.tsx

Copy file name to clipboardExpand all lines: app/(auth)/layout.tsx
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default async function AuthLayout({ children }: { children: ReactNode })
1717
<SessionProvider basePath={"/api/auth"} session={session}>
1818
<div className="flex flex-col h-full w-full">
1919
<Header />
20-
<Background />
20+
{/* <Background /> */}
2121
{children}
2222
</div>
2323
<ToastContainer />

‎app/api/chat/route.ts

Copy file name to clipboardExpand all lines: app/api/chat/route.ts
+1-11Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export async function POST(request: Request) {
4848
contextOptimization: boolean;
4949
};
5050

51-
console.log('messages ************ 1');
5251

5352
const session = await auth();
5453
const userId = session?.user?.id;
@@ -59,7 +58,6 @@ export async function POST(request: Request) {
5958
});
6059
}
6160

62-
console.log('messages ************ 2');
6361

6462
const result = await withDb(db => db.update(credits)
6563
.set({
@@ -76,7 +74,6 @@ export async function POST(request: Request) {
7674
})
7775
);
7876

79-
console.log('messages ************ 3');
8077

8178
if (!result.length) {
8279
return new Response(JSON.stringify({
@@ -87,15 +84,13 @@ export async function POST(request: Request) {
8784
});
8885
}
8986

90-
console.log('messages ************ 4');
9187

9288
const cookieHeader = request.headers.get('Cookie');
9389
const apiKeys = JSON.parse(parseCookies(cookieHeader)?.apiKeys || '{}');
9490
const providerSettings: Record<string, IProviderSetting> = JSON.parse(
9591
parseCookies(cookieHeader)?.providers || '{}'
9692
);
9793

98-
console.log('messages ************ 5');
9994

10095
const stream = new SwitchableStream();
10196
const env = process.env as Record<string, string>; // Adjust based on your env setup
@@ -107,14 +102,11 @@ export async function POST(request: Request) {
107102
const encoder: TextEncoder = new TextEncoder();
108103
let progressCounter: number = 1;
109104

110-
console.log('messages ************ 6');
111105

112106
try {
113107
const totalMessageContent = messages.reduce((acc, message) => acc + message.content, '');
114108
logger.debug(`Total message length: ${totalMessageContent.split(' ').length}, words`);
115109

116-
console.log('messages ************ 7');
117-
118110
let lastChunk: string | undefined = undefined;
119111

120112
const dataStream = createDataStream({
@@ -129,7 +121,6 @@ export async function POST(request: Request) {
129121
}
130122

131123
if (filePaths.length > 0 && contextOptimization) {
132-
console.log('messages ************ 8');
133124
logger.debug('Generating Chat Summary');
134125
dataStream.writeData({
135126
type: 'progress',
@@ -327,7 +318,7 @@ export async function POST(request: Request) {
327318
})();
328319
result.mergeIntoDataStream(dataStream);
329320
},
330-
onError: (error: any) => `Custom error: ${error.message}`,
321+
onError: (error: any) => `Custom error: ${error?.message}`,
331322
}).pipeThrough(
332323
new TransformStream({
333324
transform: (chunk, controller) => {
@@ -360,7 +351,6 @@ export async function POST(request: Request) {
360351
},
361352
})
362353
);
363-
console.log('messages ************ 9');
364354

365355
return new Response(dataStream, {
366356
status: 200,

‎app/api/deploy-to-machine/route.ts

Copy file name to clipboardExpand all lines: app/api/deploy-to-machine/route.ts
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export async function POST(request: Request) {
5555
result: 'Update completed',
5656
});
5757
} catch (error) {
58+
console.log('error **********', error);
5859
await noticeHost({
5960
event: 'error',
6061
error: error instanceof Error ? error.message : 'Unknown error occurred',
@@ -69,7 +70,7 @@ export async function POST(request: Request) {
6970
headers: {
7071
'Content-Type': 'text/event-stream',
7172
'Cache-Control': 'no-cache',
72-
'Connection': 'keep-alive',
73+
Connection: 'keep-alive',
7374
},
7475
});
7576

‎app/background/page.tsx

Copy file name to clipboardExpand all lines: app/background/page.tsx
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function Background() {
1010

1111
return (
1212
<div className="w-full h-full">
13-
{theme === 'dark' ? <BackgroundMeteor /> : <NatureScene />}
13+
{/* {theme === 'dark' ? <BackgroundMeteor /> : <NatureScene />} */}
1414
</div>
1515
);
1616
}

‎components/chat/BaseChat.tsx

Copy file name to clipboardExpand all lines: components/chat/BaseChat.tsx
+53-38Lines changed: 53 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
123123
const [progressAnnotations, setProgressAnnotations] = useState<ProgressAnnotation[]>([]);
124124
const { data: session } = useSession();
125125
const [showLoginModal, setShowLoginModal] = useState(false);
126+
const [isButtonDisabled, setIsButtonDisabled] = useState(false);
126127
useEffect(() => {
127128
if (data) {
128129
const progressList = data.filter(
@@ -237,7 +238,6 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
237238
const handleSendMessage = (event: React.UIEvent, messageInput?: string) => {
238239
if (sendMessage) {
239240
sendMessage(event, messageInput);
240-
241241
if (recognition) {
242242
recognition.abort(); // Stop current recognition
243243
setTranscript(''); // Clear transcript
@@ -499,30 +499,38 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
499499

500500
event.preventDefault();
501501

502-
if(!session) {
503-
setShowLoginModal(true);
504-
return;
505-
}
502+
// Prevent multiple rapid Enter presses
503+
if (isButtonDisabled) return;
504+
setIsButtonDisabled(true);
506505

507-
if (isStreaming) {
508-
handleStop?.();
509-
return;
510-
}
506+
try {
507+
if(!session) {
508+
setShowLoginModal(true);
509+
return;
510+
}
511511

512-
// ignore if using input method engine
513-
if (event.nativeEvent.isComposing) {
514-
return;
515-
}
512+
if (isStreaming) {
513+
handleStop?.();
514+
return;
515+
}
516+
517+
// ignore if using input method engine
518+
if (event.nativeEvent.isComposing) {
519+
return;
520+
}
516521

517-
const credits = await checkCredits();
522+
const credits = await checkCredits();
518523

519524
if (credits <= 0) {
520525
toast.error('No credits left');
521526
return;
522527
}
523528

524-
525-
handleSendMessage?.(event);
529+
handleSendMessage?.(event);
530+
} finally {
531+
// Re-enable after 1 second
532+
setTimeout(() => setIsButtonDisabled(false), 1000);
533+
}
526534
}
527535
}}
528536
value={input}
@@ -540,29 +548,36 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
540548
<SendButton
541549
show={input.length > 0 || isStreaming || uploadedFiles.length > 0}
542550
isStreaming={isStreaming}
543-
disabled={!providerList || providerList.length === 0}
551+
disabled={!providerList || providerList.length === 0 || isButtonDisabled}
544552
onClick={async (event) => {
545-
546-
if(!session) {
547-
setShowLoginModal(true);
548-
return;
549-
}
550-
551-
if (isStreaming) {
552-
handleStop?.();
553-
return;
554-
}
555-
556-
const credits = await checkCredits();
557-
558-
if (credits <= 0) {
559-
toast.error('No credits left');
560-
return;
561-
}
562-
563-
564-
if (input.length > 0 || uploadedFiles.length > 0) {
565-
handleSendMessage?.(event);
553+
// Prevent multiple rapid clicks
554+
if (isButtonDisabled) return;
555+
setIsButtonDisabled(true);
556+
557+
try {
558+
if(!session) {
559+
setShowLoginModal(true);
560+
return;
561+
}
562+
563+
if (isStreaming) {
564+
handleStop?.();
565+
return;
566+
}
567+
568+
const credits = await checkCredits();
569+
570+
if (credits <= 0) {
571+
toast.error('No credits left');
572+
return;
573+
}
574+
575+
if (input.length > 0 || uploadedFiles.length > 0) {
576+
handleSendMessage?.(event);
577+
}
578+
} finally {
579+
// Re-enable the button after 1 second
580+
setTimeout(() => setIsButtonDisabled(false), 1000);
566581
}
567582
}}
568583
/>

‎components/chat/IdeaShortcut.tsx

Copy file name to clipboardExpand all lines: components/chat/IdeaShortcut.tsx
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ export default function IdeaShortcut({ onSelect }: IdeaShortcutProps) {
4646
return (
4747
<div className="relative flex max-w-full gap-1 mx-2">
4848
<div className="w-full overflow-x-auto whitespace-nowrap scrollbar-hide">
49-
<div className="flex gap-2.5 text-white dark:text-white">
49+
<div className="flex gap-2.5 light:text-block dark:text-white">
5050
{ideas.map((idea, index) => (
5151
<button
5252
key={index}
5353
className="flex shrink-0 cursor-pointer items-center gap-2 rounded-full border border-zinc-800 px-3 py-1.5 transition-colors light:hover:bg-purple-600 dark:hover:border-purple-400"
5454
onClick={() => handleClick(idea.content)}
5555
>
56-
<p className="text-xs text-zinc-50">{idea.label}</p>
56+
<p className="text-xs">{idea.label}</p>
5757
<IoMdArrowUp className="shrink-0 h-4 w-4 text-muted-foreground" />
5858
</button>
5959
))}

‎components/chat/Messages.client.tsx

Copy file name to clipboardExpand all lines: components/chat/Messages.client.tsx
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export const Messages = forwardRef<HTMLDivElement, MessagesProps>(
119119
/>
120120
</WithTooltip>
121121
)}
122-
122+
{/*
123123
<WithTooltip tooltip="Fork chat from this message">
124124
<button
125125
onClick={() => handleFork(messageId)}
@@ -129,7 +129,7 @@ export const Messages = forwardRef<HTMLDivElement, MessagesProps>(
129129
'text-xl text-bolt-elements-textSecondary hover:text-bolt-elements-textPrimary transition-colors',
130130
)}
131131
/>
132-
</WithTooltip>
132+
</WithTooltip> */}
133133
</div>
134134
)}
135135
</div>

‎components/sidebar/Menu.client.tsx

Copy file name to clipboardExpand all lines: components/sidebar/Menu.client.tsx
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ function CurrentDateTime() {
5757
<div className="h-4 w-4 i-lucide:clock opacity-80" />
5858
<div className="flex gap-2">
5959
<span>{dateTime.toLocaleDateString()}</span>
60-
<span>{dateTime.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}</span>
60+
{/* <span>{dateTime.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}</span> */}
6161
</div>
6262
</div>
6363
);
6464
}
6565

6666
export const Menu = () => {
67-
const { duplicateCurrentChat, exportChat } = useChatHistory();
67+
// const { duplicateCurrentChat, exportChat } = useChatHistory();
6868
const menuRef = useRef<HTMLDivElement>(null);
6969
const [list, setList] = useState<ChatHistoryItem[]>([]);
7070
const [open, setOpen] = useState(false);
@@ -192,7 +192,7 @@ export const Menu = () => {
192192

193193
const handleExport = async (id: string) => {
194194
try {
195-
const response = await fetch(`/api/chats/${id}/export`);
195+
const response = await fetch(`/api/chats/export/${id}`);
196196
if (!response.ok) throw new Error('Failed to export chat');
197197

198198
const chatData = await response.json();
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
"use client"
22

3-
import BackgroundMeteor from '@/components/ui/BackgroundMeteor/MeteorShower';
4-
import NatureScene from '@/components/ui/BackgroundMeteor/NatureScene';
5-
import { themeStore, Theme } from '@/lib/stores/theme';
3+
// import BackgroundMeteor from '@/components/ui/BackgroundMeteor/MeteorShower';
4+
// import NatureScene from '@/components/ui/BackgroundMeteor/NatureScene';
5+
// import { themeStore, Theme } from '@/lib/stores/theme';
66
import { useStore } from '@nanostores/react';
77
import { useEffect } from 'react';
88

99

1010
export default function Background() {
11-
const theme = useStore(themeStore);
12-
useEffect(() => {
13-
const theme = localStorage.getItem('bolt_theme');
14-
themeStore.set(theme as Theme || 'dark');
15-
}, [theme]);
11+
// const theme = useStore(themeStore);
12+
// useEffect(() => {
13+
// const theme = localStorage.getItem('bolt_theme');
14+
// themeStore.set(theme as Theme || 'dark');
15+
// }, [theme]);
1616

1717
return (
1818
<>
19-
{theme === 'dark' ? <BackgroundMeteor /> : <NatureScene />}
19+
{/* {theme === 'dark' ? <BackgroundMeteor /> : <NatureScene />} */}
2020
</>
2121
);
2222
}

‎lib/common/prompts/prompts.ts

Copy file name to clipboardExpand all lines: lib/common/prompts/prompts.ts
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ You are Bolt, an expert AI assistant and exceptional senior software developer w
3737
3838
IMPORTANT: Don't use Cube from lucide-react.
3939
40+
IMPORTANT: When using lucide-react, carefully check the exports and do not use icons that are not available in lucide-react.
41+
4042
Available shell commands:
4143
File Operations:
4244
- cat: Display file contents

‎lib/modules/llm/providers/deepseek.ts

Copy file name to clipboardExpand all lines: lib/modules/llm/providers/deepseek.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default class DeepseekProvider extends BaseProvider {
1515
staticModels: ModelInfo[] = [
1616
// { name: 'deepseek-coder', label: 'Deepseek-Coder', provider: 'Deepseek', maxTokenAllowed: 8000 },
1717
{ name: 'deepseek/deepseek-chat', label: 'Deepseek-Chat', provider: 'Deepseek', maxTokenAllowed: 8000 },
18-
{ name: 'deepseek/deepseek-r1', label: 'Deepseek-Reasoner', provider: 'Deepseek', maxTokenAllowed: 8000 },
18+
{ name: 'deepseek/deepseek-chat-v3-0324', label: 'deepseek-chat-v3-0324', provider: 'Deepseek', maxTokenAllowed: 8000 },
1919
];
2020

2121
getModelInstance(options: {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.