Skip to content

Commit 1e25e6d

Browse files
committed
fix issue with empty text parts when input.trim() was empty...
1 parent 8de7e5d commit 1e25e6d

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

frontend/app/aipanel/waveai-model.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,12 @@ export class WaveAIModel {
251251
async handleSubmit(shouldFocus: boolean) {
252252
const input = globalStore.get(this.inputAtom);
253253
const droppedFiles = globalStore.get(this.droppedFiles);
254-
255-
if ((!input.trim() && droppedFiles.length === 0) || (this.useChatStatus !== "ready" && this.useChatStatus !== "error") || globalStore.get(this.isLoadingChatAtom)) {
254+
255+
if (
256+
(!input.trim() && droppedFiles.length === 0) ||
257+
(this.useChatStatus !== "ready" && this.useChatStatus !== "error") ||
258+
globalStore.get(this.isLoadingChatAtom)
259+
) {
256260
return;
257261
}
258262

@@ -264,11 +268,11 @@ export class WaveAIModel {
264268

265269
this.clearError();
266270

267-
const aiMessageParts: AIMessagePart[] = [{ type: "text", text: input.trim() }];
268-
271+
const aiMessageParts: AIMessagePart[] = [];
269272
const uiMessageParts: WaveUIMessagePart[] = [];
270273

271274
if (input.trim()) {
275+
aiMessageParts.push({ type: "text", text: input.trim() });
272276
uiMessageParts.push({ type: "text", text: input.trim() });
273277
}
274278

0 commit comments

Comments
 (0)