Gerrit Broekhuis
Programmer
Chris Miller has been very helpfull writing thread 184-1820019: Multiprocessing with a COM Server. I intend to use this to call ChatGPT.
In the main program I added a property "Payload", called by this (changed) procedure:
I'm using this background program to access ChatGPT we talked about in another thread last week.
I fill the property payload in my calling program like this:
The actual code calling ChatGPT is put in goBackgroundprocess.Script.
So far so good. Simple code is running without using the script and the payload properties.
However, when adtivating this line
I get an error.
I have compared the content of lcPayload with the one I use in another VFP program (calling ChatGPT in a prg) and both texts are identical. I verified this too by using and this indicated too that both texts / strings are identical.
So I'm puzzled now. Is it possible that
still doesn't understand / read the variable lcPayload? What else could be happening here?
Regards, Gerrit
In the main program I added a property "Payload", called by this (changed) procedure:
Code:
Hidden Procedure ExecuteScript(HWnd As Integer, Msg As Integer, wParam As Integer, Lparam As Integer)
LOCAL lcPayload
lcPayload = ALLTRIM(this.Payload)
This.LastReturnValue = Execscript(This.Script)
&& This.Reply = loHTTP.responseText
This.Executing = .F.
Return 0
Endproc
I'm using this background program to access ChatGPT we talked about in another thread last week.
I fill the property payload in my calling program like this:
Code:
* Create the request payload
TEXT To goBackgroundprocess.Payload Textmerge NOSHOW
{
"model": "gpt-3.5-turbo",
"max_tokens" : 2000,
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "<<lcQuestion>>"
}
]
}
ENDTEXT
The actual code calling ChatGPT is put in goBackgroundprocess.Script.
So far so good. Simple code is running without using the script and the payload properties.
However, when adtivating this line
Code:
loHTTP.Send(lcPayload)
I have compared the content of lcPayload with the one I use in another VFP program (calling ChatGPT in a prg) and both texts are identical. I verified this too by using and this indicated too that both texts / strings are identical.
So I'm puzzled now. Is it possible that
Code:
Execscript(This.Script)
Regards, Gerrit