@@ -792,7 +792,7 @@ function is_stopped() {
792
792
const ask_gpt = async ( message_id , message_index = - 1 , regenerate = false , provider = null , model = null , action = null ) => {
793
793
if ( ! model && ! provider ) {
794
794
model = get_selected_model ( ) ?. value || null ;
795
- provider = providerSelect . options [ providerSelect . selectedIndex ] . value ;
795
+ provider = providerSelect . options [ providerSelect . selectedIndex ] ? .value ;
796
796
}
797
797
let conversation = await get_conversation ( window . conversation_id ) ;
798
798
if ( ! conversation ) {
@@ -1815,8 +1815,14 @@ async function on_load() {
1815
1815
let chat_url = new URL ( window . location . href )
1816
1816
let chat_params = new URLSearchParams ( chat_url . search ) ;
1817
1817
if ( chat_params . get ( "prompt" ) ) {
1818
- messageInput . value = chat_params . get ( "prompt" ) ;
1819
- await handle_ask ( ) ;
1818
+ messageInput . value = chat_params . title
1819
+ + chat_params . title ? "\n\n\n" : ""
1820
+ + chat_params . prompt
1821
+ + chat_params . prompt && chat_params . url ? "\n\n\n" : ""
1822
+ + chat_params . url ;
1823
+ messageInput . style . height = messageInput . scrollHeight + "px" ;
1824
+ messageInput . focus ( ) ;
1825
+ //await handle_ask();
1820
1826
} else {
1821
1827
say_hello ( )
1822
1828
}
@@ -1871,7 +1877,6 @@ async function on_api() {
1871
1877
setTimeout ( ( ) => prompt_lock = false , 3000 ) ;
1872
1878
await handle_ask ( ) ;
1873
1879
} else {
1874
- messageInput . style . removeProperty ( "height" ) ;
1875
1880
messageInput . style . height = messageInput . scrollHeight + "px" ;
1876
1881
}
1877
1882
} ) ;
@@ -1970,7 +1975,11 @@ async function on_api() {
1970
1975
provider_options [ provider . name ] = option ;
1971
1976
}
1972
1977
} ) ;
1978
+ }
1979
+ if ( appStorage . getItem ( "provider" ) ) {
1973
1980
await load_provider_models ( appStorage . getItem ( "provider" ) )
1981
+ } else {
1982
+ providerSelect . selectedIndex = 0 ;
1974
1983
}
1975
1984
for ( let [ name , [ label , login_url , childs ] ] of Object . entries ( login_urls ) ) {
1976
1985
if ( ! login_url && ! is_demo ) {
@@ -1990,7 +1999,7 @@ async function on_api() {
1990
1999
}
1991
2000
1992
2001
register_settings_storage ( ) ;
1993
- await load_settings_storage ( )
2002
+ await load_settings_storage ( ) ;
1994
2003
Object . entries ( provider_options ) . forEach (
1995
2004
( [ provider_name , option ] ) => load_provider_option ( option . querySelector ( "input" ) , provider_name )
1996
2005
) ;
@@ -2156,9 +2165,14 @@ async function upload_files(fileInput) {
2156
2165
}
2157
2166
appStorage . setItem ( `bucket:${ bucket_id } ` , data . size ) ;
2158
2167
inputCount . innerText = "Files are loaded successfully" ;
2159
- messageInput . value += ( messageInput . value ? "\n" : "" ) + JSON . stringify ( { bucket_id : bucket_id } ) + "\n" ;
2160
- paperclip . classList . remove ( "blink" ) ;
2161
- fileInput . value = "" ;
2168
+ if ( ! messageInput . value ) {
2169
+ messageInput . value = JSON . stringify ( { bucket_id : bucket_id } ) ;
2170
+ handle_ask ( false ) ;
2171
+ } else {
2172
+ messageInput . value += ( messageInput . value ? "\n" : "" ) + JSON . stringify ( { bucket_id : bucket_id } ) + "\n" ;
2173
+ paperclip . classList . remove ( "blink" ) ;
2174
+ fileInput . value = "" ;
2175
+ }
2162
2176
}
2163
2177
} ;
2164
2178
eventSource . onerror = ( event ) => {
0 commit comments