using Godot; using System; public partial class LLMApiRequests : HttpRequest { public record AnswerRequest( Message[] Context, string Prompt ); public record Message( string Role, string? Content ); private bool PostToApiIsSet = false; public override void _Ready() { SetProcess(false); } public void PostToApi(Action action) { if(!PostToApiIsSet) { RequestCompleted += (long result, long responseCode, string[] headers, byte[] body) => action(result, responseCode, headers, body); PostToApiIsSet = true; } var answerRequest = new AnswerRequest(new[] { new Message("user", "Hello!"), }, "aodneris"); Request($"http://localhost:5246/LLM/Test", new[] { "Content-Type: application/json" }, HttpClient.Method.Get, Newtonsoft.Json.JsonConvert.SerializeObject(answerRequest)); } }