Skip to content

Commit 518e304

Browse files
committed
Added and updated models.
1 parent 20535d9 commit 518e304

File tree

4 files changed

+342
-29
lines changed

4 files changed

+342
-29
lines changed

CodeDroidAI.dproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@
270270
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
271271
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
272272
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
273-
<DCC_ExeOutput>.\</DCC_ExeOutput>
274273
<VerInfo_Locale>1033</VerInfo_Locale>
275274
<VerInfo_Release>1</VerInfo_Release>
276275
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.1.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.1.0;Comments=</VerInfo_Keys>

Win32/Release/ConsoleProgram.dpr

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
program test;
2+
3+
uses System.Net.HttpClientComponent;
4+
5+
procedure MakeChatGPTRestAPICall(const Endpoint: String; const Payload: String);
6+
var
7+
HTTPRequest: TNetHttpRequest;
8+
HTTPResponse: TNetHttpResponse;
9+
JSONData: TJsonObject;
10+
begin
11+
// Create a new HTTP request
12+
HTTPRequest := TNetHttpRequest.Create(nil);
13+
HTTPRequest.Open('POST', Endpoint, False);
14+
15+
// Set the request headers
16+
HTTPRequest.AddHeader('Content-Type', 'application/json');
17+
18+
// Set the request payload
19+
HTTPRequest.Write(Payload);
20+
21+
// Send the request
22+
HTTPResponse := TNetHttpResponse.Create(nil);
23+
HTTPResponse.StatusCode := HTTPRequest.Send;
24+
25+
// Check the response status code
26+
if HTTPResponse.StatusCode = 200 then
27+
begin
28+
// Parse the response JSON data
29+
JSONData := TJsonObject.Parse(HTTPResponse.Content);
30+
31+
// Return the JSON data as a string
32+
Result := JSONData.ToString;
33+
end
34+
else
35+
begin
36+
// Return an error message
37+
Result := 'Error: ' + HTTPResponse.StatusText;
38+
end;
39+
end;
40+
41+
end.
42+
43+
// Example usage:
44+
45+
procedure MyProcedure;
46+
begin
47+
// Call the MakeChatGPTRestAPICall function
48+
MakeChatGPTRestAPICall('https://api.openai.com/v1/chat/gpt', '{"prompt": "Hello, chatbot! How are you today?"}');
49+
end;
50+
51+
end.

0 commit comments

Comments
 (0)