@@ -201,22 +201,24 @@ GetBody(mode, promptName, prompt, input, promptEnd) {
201201CallAPI (mode, promptName, prompt, input, promptEnd ) {
202202
203203 body := GetBody(mode, promptName, prompt, input , promptEnd)
204+ bodyJson := Jxon_dump(body, 4 )
205+ LogDebug " bodyJson ->`n" bodyJson
206+
204207 endpoint := GetSetting(mode, " endpoint" )
205208 apiKey := GetSetting(mode, " api_key" , GetSetting(" settings" , " default_api_key" ))
206209
207- req := ComObject(" WinHttp.WinHttpRequest.5.1" )
210+ req := ComObject(" Msxml2.ServerXMLHTTP" )
211+
208212 req.open(" POST" , endpoint, true )
209- req.SetTimeouts(10000 , 30000 , 30000 , 60000 ) ; resolve, connect, send, receive
210213 req.SetRequestHeader(" Content-Type" , " application/json" )
211214 req.SetRequestHeader(" Authorization" , " Bearer " apiKey) ; openai
212215 req.SetRequestHeader(" api-key" , apiKey) ; azure
213-
214- bodyJson := Jxon_dump(body, 4 )
215- LogDebug " bodyJson ->`n" bodyJson
216-
216+ req.SetRequestHeader('Content- Length', StrLen (bodyJson))
217+ req.SetRequestHeader(" If-Modified-Since" , " Sat, 1 Jan 2000 00:00:00 GMT" )
218+
217219 req.send (bodyJson)
218- req.WaitForResponse()
219220
221+ req.WaitForResponse(GetSetting(" settings" , " timeout" , 60 ))
220222 if (req.status == 200 ) { ; OK.
221223 data := req.responseText
222224 HandleResponse(data, mode, promptName, input )
@@ -305,7 +307,7 @@ InitPopupMenu() {
305307 _iMenu.Add ; Add a separator line.
306308 } else {
307309 menu_text := GetSetting(v_promptName, " menu_text" , v_promptName)
308- if (RegExMatch (menu_text, " ^(?!.*&&).*&. *$" ) == 0 ) {
310+ if (RegExMatch (menu_text, " ^[^&]*&[^&] *$" ) == 0 ) {
309311 if (id == 10 )
310312 keyboard_shortcut := " &0 - "
311313 else if (id > 10 )
0 commit comments