using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;
namespace GenesisAPIFormApplication { public partial class Form1 : Form { private string apiUrl = "https://cluster-2.pudochu.repl.co/api/genesis"; private HttpClient httpClient = new HttpClient();
public Form1() { InitializeComponent(); }
private async void button1_Click(object sender, EventArgs e) { // Sabit bir metin kullanarak API'ye metin gönderme işlemi string prompt = "Senin adın Jarvis. Her şeyi bilen üstün bir yapay zekasın.\n\nBen: " + "selam" + "\nJarvis:";
try { var content = new StringContent($"{"prompt": "{prompt}", "model": "text-dream-001"}", Encoding.UTF8, "application/json");
var response = await httpClient.PostAsync(apiUrl, content);
if (response.IsSuccessStatusCode) { string responseString = await response.Content.ReadAsStringAsync(); MessageBox.Show(responseString); } else { MessageBox.Show($"HTTP Hata Kodu: {response.StatusCode}"); // HTTP hata kodunu burada işleyebilirsiniz. } } catch (Exception ex) { MessageBox.Show("İstek gönderilirken bir hata meydana geldi: " + ex.Message); } } } }