KayJs
❔ win form app desinger app erorr
Severity Code Description Project File Line Suppression State
Error CS1061 'Form1' does not contain a definition for 'Form1_load' and no accessible extension method 'Form1_load' accepting a first argument of type 'Form1' could be found (are you missing a using directive or an assembly reference?) ödev C:\Users\cengiz\source\reposödevödev\Form1.Designer.cs 147 Active
this error
14 replies
❔ What is problem?
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);
}
}
}
}
70 replies