File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,11 +115,14 @@ import { getClientConfig } from "../config/client";
115115import { useAllModels } from "../utils/hooks" ;
116116import { MultimodalContent } from "../client/api" ;
117117
118- const localStorage = safeLocalStorage ( ) ;
119118import { ClientApi } from "../client/api" ;
120119import { createTTSPlayer } from "../utils/audio" ;
121120import { MsEdgeTTS , OUTPUT_FORMAT } from "../utils/ms_edge_tts" ;
122121
122+ import { isEmpty } from "lodash-es" ;
123+
124+ const localStorage = safeLocalStorage ( ) ;
125+
123126const ttsPlayer = createTTSPlayer ( ) ;
124127
125128const Markdown = dynamic ( async ( ) => ( await import ( "./markdown" ) ) . Markdown , {
@@ -1015,7 +1018,7 @@ function _Chat() {
10151018 } ;
10161019
10171020 const doSubmit = ( userInput : string ) => {
1018- if ( userInput . trim ( ) === "" ) return ;
1021+ if ( userInput . trim ( ) === "" && isEmpty ( attachImages ) ) return ;
10191022 const matchCommand = chatCommands . match ( userInput ) ;
10201023 if ( matchCommand . matched ) {
10211024 setUserInput ( "" ) ;
Original file line number Diff line number Diff line change @@ -372,22 +372,16 @@ export const useChatStore = createPersistStore(
372372
373373 if ( attachImages && attachImages . length > 0 ) {
374374 mContent = [
375- {
376- type : "text" ,
377- text : userContent ,
378- } ,
375+ ...( userContent
376+ ? [ { type : "text" as const , text : userContent } ]
377+ : [ ] ) ,
378+ ...attachImages . map ( ( url ) => ( {
379+ type : "image_url" as const ,
380+ image_url : { url } ,
381+ } ) ) ,
379382 ] ;
380- mContent = mContent . concat (
381- attachImages . map ( ( url ) => {
382- return {
383- type : "image_url" ,
384- image_url : {
385- url : url ,
386- } ,
387- } ;
388- } ) ,
389- ) ;
390383 }
384+
391385 let userMessage : ChatMessage = createMessage ( {
392386 role : "user" ,
393387 content : mContent ,
You can’t perform that action at this time.
0 commit comments