File tree Expand file tree Collapse file tree 3 files changed +14
-15
lines changed Expand file tree Collapse file tree 3 files changed +14
-15
lines changed Original file line number Diff line number Diff line change 88 "build" : " tsc -b && vite build" ,
99 "format" : " eslint . && prettier --write ." ,
1010 "lint" : " eslint ." ,
11+ "lint:fix" : " eslint . --fix" ,
1112 "preview" : " vite preview"
1213 },
1314 "dependencies" : {
Original file line number Diff line number Diff line change @@ -24,17 +24,20 @@ export interface MessageDisplay {
2424 * If the current URL contains "#m=...", prefill the message input with the value.
2525 * If the current URL contains "#q=...", prefill and SEND the message.
2626 */
27- let init_message_done :boolean = false ;
28- let init_query_done :boolean = false ;
27+ let init_query_done : boolean = false ;
2928const prefilledMsg = {
3029 clear ( ) {
31- init_message_done = true ;
3230 init_query_done = true ;
3331 } ,
34- content : function ( ) {
35- return init_message_done ? '' : INIT_MESSAGE ;
32+ content : function ( ) {
33+ if ( init_query_done ) return '' ;
34+ if ( '' === INIT_QUERY ) {
35+ return INIT_MESSAGE ;
36+ } else {
37+ return INIT_QUERY ;
38+ }
3639 } ,
37- shouldSend : function ( ) {
40+ shouldSend : function ( ) {
3841 return init_query_done ? '' : INIT_QUERY ;
3942 } ,
4043} ;
Original file line number Diff line number Diff line change @@ -633,7 +633,10 @@ export const AppContextProvider = ({
633633 const [ promptSelectFirstConfig , setPromptSelectFirstConfig ] =
634634 useState < number > ( - 1 ) ;
635635 // https://swapi.dev/api/planets/1/?format=json
636+
636637 useEffect ( ( ) => {
638+ const prt : { key : number ; value : string } [ ] = [ ] ;
639+ if ( ! promptSelectConfig ) {
637640 fetch ( '/prompts.config.json' )
638641 . then ( ( response ) => {
639642 if ( ! response . ok ) throw new Error ( response . status . toString ( ) ) ;
@@ -647,15 +650,7 @@ export const AppContextProvider = ({
647650 . catch ( ( error ) => {
648651 console . log ( 'error: ' + error ) ;
649652 } ) ;
650- } , [ language ,
651- setPromptSelectConfig ,
652- setPromptSelectFirstConfig ,
653- setPromptSelectOptions ,
654- promptSelectConfig
655- ] ) ;
656-
657- useEffect ( ( ) => {
658- const prt : { key : number ; value : string } [ ] = [ ] ;
653+ }
659654 if ( promptSelectConfig ) {
660655 let firstConfigSet = false ;
661656 saveConfig ( CONFIG_DEFAULT ) ;
You can’t perform that action at this time.
0 commit comments