File tree Expand file tree Collapse file tree 2 files changed +13
-16
lines changed Expand file tree Collapse file tree 2 files changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -115,11 +115,14 @@ import { getClientConfig } from "../config/client";
115
115
import { useAllModels } from "../utils/hooks" ;
116
116
import { MultimodalContent } from "../client/api" ;
117
117
118
- const localStorage = safeLocalStorage ( ) ;
119
118
import { ClientApi } from "../client/api" ;
120
119
import { createTTSPlayer } from "../utils/audio" ;
121
120
import { MsEdgeTTS , OUTPUT_FORMAT } from "../utils/ms_edge_tts" ;
122
121
122
+ import { isEmpty } from "lodash-es" ;
123
+
124
+ const localStorage = safeLocalStorage ( ) ;
125
+
123
126
const ttsPlayer = createTTSPlayer ( ) ;
124
127
125
128
const Markdown = dynamic ( async ( ) => ( await import ( "./markdown" ) ) . Markdown , {
@@ -1015,7 +1018,7 @@ function _Chat() {
1015
1018
} ;
1016
1019
1017
1020
const doSubmit = ( userInput : string ) => {
1018
- if ( userInput . trim ( ) === "" ) return ;
1021
+ if ( userInput . trim ( ) === "" && isEmpty ( attachImages ) ) return ;
1019
1022
const matchCommand = chatCommands . match ( userInput ) ;
1020
1023
if ( matchCommand . matched ) {
1021
1024
setUserInput ( "" ) ;
Original file line number Diff line number Diff line change @@ -337,22 +337,16 @@ export const useChatStore = createPersistStore(
337
337
338
338
if ( attachImages && attachImages . length > 0 ) {
339
339
mContent = [
340
- {
341
- type : "text" ,
342
- text : userContent ,
343
- } ,
340
+ ...( userContent
341
+ ? [ { type : "text" as const , text : userContent } ]
342
+ : [ ] ) ,
343
+ ...attachImages . map ( ( url ) => ( {
344
+ type : "image_url" as const ,
345
+ image_url : { url } ,
346
+ } ) ) ,
344
347
] ;
345
- mContent = mContent . concat (
346
- attachImages . map ( ( url ) => {
347
- return {
348
- type : "image_url" ,
349
- image_url : {
350
- url : url ,
351
- } ,
352
- } ;
353
- } ) ,
354
- ) ;
355
348
}
349
+
356
350
let userMessage : ChatMessage = createMessage ( {
357
351
role : "user" ,
358
352
content : mContent ,
You can’t perform that action at this time.
0 commit comments