This repository has been archived on 2023-11-16. You can view files and clone it, but cannot push or open issues or pull requests.
GOA/godot/FetchButton.cs

28 lines
829 B
C#

using Godot;
using System.Linq;
public partial class FetchButton : Button
{
private LLMApiRequests llmApiRequests;
private TextEdit input;
private TextEdit story;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
SetProcess(false);
llmApiRequests = GetTree().Root.GetNode<LLMApiRequests>("Root/LLMApiRequests");
input = GetTree().Root.GetNode<TextEdit>("Root/Ingame/IngameCanvas/Eingabe/TextEdit");
story = GetTree().Root.GetNode<TextEdit>("Root/Ingame/IngameCanvas/Story/TextEdit");
}
public override void _Pressed()
{
var temp = llmApiRequests.Context.Where(c => c.Role != "system").Select(c => c.Content.Trim()).ToList();
temp.Add(llmApiRequests.Choices.ElementAt(0).Message.Content.Trim());
story.Text = string.Join("\n", temp);
}
}