File tree Expand file tree Collapse file tree 2 files changed +24
-13
lines changed
Expand file tree Collapse file tree 2 files changed +24
-13
lines changed Original file line number Diff line number Diff line change @@ -92,19 +92,26 @@ const ContentPanel = (props: IContentPanelProps) => {
9292 setPromptType ( p || promptType || query )
9393 setResult ( "" )
9494 setSending ( true )
95- await sendNotionPostToBackground ( {
96- prompt : query ,
97- context : selectionText ,
98- promptType : p || promptType ,
99- onProgress : ( e : IPostNotionProgress ) => {
100- resultTemp += e . value . completion
101- if ( ! e . done ) {
102- setResult ( resultTemp )
103- } else {
104- setSending ( false )
95+
96+ try {
97+ await sendNotionPostToBackground ( {
98+ prompt : query ,
99+ context : selectionText ,
100+ promptType : p || promptType ,
101+ onProgress : ( e : IPostNotionProgress ) => {
102+ resultTemp += e . value . completion
103+ if ( ! e . done ) {
104+ setResult ( resultTemp )
105+ } else {
106+ setSending ( false )
107+ }
105108 }
106- }
107- } )
109+ } )
110+ } catch ( error ) {
111+ console . log ( error , "error" )
112+ showToast ( t ( "MessageProcessing" ) )
113+ }
114+
108115 setSending ( false )
109116 }
110117
@@ -186,7 +193,7 @@ const ContentPanel = (props: IContentPanelProps) => {
186193 className = "pl-12 pr-12 input input-bordered w-full rounded-none box-border h-12"
187194 style = { {
188195 outline : "none" ,
189- minWidth : "700px "
196+ minWidth : "900px "
190197 } }
191198 placeholder = { t ( "AskInputPlaceholder" ) as string }
192199 onChange = { ( event ) => {
Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ export const sendNotionPostToBackground = ({
3131 prompt ?: string
3232 onProgress : ( data : IPostNotionProgress ) => void
3333} ) => {
34+ if ( onProgressHandler ) {
35+ return Promise . reject ( "posting" )
36+ }
37+
3438 onProgressHandler = onProgress
3539 postNotionAddEventListener ( )
3640 return new Promise ( async ( resolve ) => {
You can’t perform that action at this time.
0 commit comments