<?xml version="1.0" encoding="iso-8859-9" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Clomosy | Forum : TclStringList</title>
  <link>https://forum.clomosy.com.tr/</link>
  <description><![CDATA[XML içerik linki; Clomosy | Forum : Genel &#304;&#351;lemler : TclStringList]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Mon, 04 May 2026 17:57:10 +0000</pubDate>
  <lastBuildDate>Wed, 27 Nov 2024 14:36:59 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.07</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>https://forum.clomosy.com.tr/RSS_post_feed.asp?TID=969</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Clomosy | Forum]]></title>
   <url>https://forum.clomosy.com.tr/forum_images/logo.png</url>
   <link>https://forum.clomosy.com.tr/</link>
  </image>
  <item>
   <title><![CDATA[TclStringList : Merhaba Ya&#351;ar,{&amp;#034;error&amp;#03...]]></title>
   <link>https://forum.clomosy.com.tr/forum_posts.asp?TID=969&amp;PID=1915#1915</link>
   <description>
    <![CDATA[<strong>Yazar:</strong> <a href="https://forum.clomosy.com.tr/member_profile.asp?PF=157">Kemal</a><br /><strong>Konu:</strong> 969<br /><strong>Gönderim Zamanı:</strong> 27&nbsp;Kasım&nbsp;2024 Saat 14:36<br /><br />Merhaba Yaşar,<div><br><div><div>{"error":{"code":400,"message":"API key not valid. Please pass a valid API key.","status":"INVALID_ARGUMENT","details":&#091;{"@type":"type.googleapis.com\/google.rpc.ErrorInfo","reason":"API_KEY_INVALID","domain":"googleapis.com","metadata":{"service":"generativelanguage.googleapis.com"}},{"@type":"type.googleapis.com\/google.rpc.LocalizedMessage","locale":"en-US","message":"API key not valid. Please pass a valid API key."}&#093;}}</div><div>Kodu çalıştırdığımda dönen yanıt bu olduğu için örnek olarak bunu parçalamasını göstereceğim.</div><div><br></div><div><div>void BtnOnClick;</div><div><br></div><div>{</div><div><br></div><div>&nbsp; try</div><div><br></div><div>&nbsp; &nbsp; // clRest bileşeni (API bağlantısı için) oluşturuluyor</div><div><br></div><div>&nbsp; &nbsp; clRest = TCLRest.Create;</div><div><br></div><div>&nbsp; &nbsp; // Kullanıcıdan alınan metni JSON formatında API'ye gönderilecek hale getiriyoruz</div><div><br></div><div>&nbsp; &nbsp; /* RequestBody = '{"contents":{"parts":{"text":"' + InputText.Text + '"}}"}';*/</div><div><br></div><div>&nbsp; &nbsp; RequestBody ='{"contents":{ "role": "user", "parts": {"text": "' + InputText.Text + '"}},"generationConfig": {"temperature": 1,"topK": 40,"topP": 0.95,"maxOutputTokens": 8192,"responseMimeType": "text/plain"}}';</div><div><br></div><div>&nbsp; &nbsp;</div><div><br></div><div>&nbsp; &nbsp;&nbsp;</div><div><br></div><div>&nbsp; &nbsp; // clRest bileşeni ile API bağlantısı kuruyoruz</div><div><br></div><div>&nbsp; &nbsp; clRest.BaseURL = '<a href="https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateC&#111;ntent?key=My" target="_blank" rel="nofollow">https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=My</a> API'; // Gerçek API endpointini kullanın</div><div><br></div><div>&nbsp; &nbsp; clRest.Accept = 'application/json';</div><div><br></div><div>&nbsp; &nbsp; clRest.Method = rmPOST;</div><div><br></div><div>&nbsp; &nbsp; clRest.AddHeader( 'Content-Type',' application/json');</div><div><br></div><div>&nbsp; &nbsp; clRest.AddBody(RequestBody, 'application/json');</div><div><br></div><div>&nbsp; &nbsp;</div><div><br></div><div>&nbsp; &nbsp; // API isteğini gönderiyoruz</div><div><br></div><div>&nbsp; &nbsp; clRest.Execute;</div><div><br></div><div>&nbsp; &nbsp;</div><div><br></div><div>&nbsp; &nbsp; // Yanıt kontrolü</div><div><br></div><div>&nbsp; &nbsp; if (clRest.Response &lt;&gt; '')</div><div><br></div><div>&nbsp; &nbsp; {</div><div><br></div><div>&nbsp; &nbsp; &nbsp; // Başarılı bir yanıt aldıysak, yanıtı ResponseMemo'ya ekliyoruz</div><div>&nbsp; &nbsp; &nbsp; JSONObject = Clomosy.ClDataSetFromJSON(clRest.Response)</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp;ShowMessage(clRest.Response);</div><div>&nbsp; <span style="white-space:pre">		</span>ShowMessage(JSONObject.FieldByName('error').AsString);</div><div>&nbsp; &nbsp; &nbsp; JSONObject = Clomosy.ClDataSetFromJSON(JSONObject.FieldByName('error').AsString);</div><div>&nbsp; &nbsp; &nbsp; ShowMessage(JSONObject.FieldByName('details').AsString);</div><div><br></div><div>&nbsp; &nbsp; &nbsp; ResponseMemo.Lines.Add('Gemini Yanıtı: ' + JSONObject.FieldByName('details').AsString);</div><div>&nbsp; &nbsp; &nbsp;&nbsp;</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp;InputText.Text = '';</div><div><br></div><div>&nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; else</div><div><br></div><div>&nbsp; &nbsp; {</div><div><br></div><div>&nbsp; &nbsp; &nbsp; // Yanıt alınamazsa hata mesajı veriyoruz</div><div><br></div><div>&nbsp; &nbsp; &nbsp; ResponseMemo.Lines.Add('API isteği başarısız oldu.');</div><div><br></div><div>&nbsp; &nbsp; }</div><div><br></div><div>&nbsp; finally</div><div><br></div><div>&nbsp; &nbsp; clRest.Free;</div><div><br></div><div>&nbsp; }</div><div><br></div><div>}</div></div><div>TCLJSONQuery nesnesini kullanarak FieldbyName ile istenilen dataya ulaşabilirsiniz.</div><div><br></div><div><br></div></div><div><br></div><div><br></div></div>]]>
   </description>
   <pubDate>Wed, 27 Nov 2024 14:36:59 +0000</pubDate>
   <guid isPermaLink="true">https://forum.clomosy.com.tr/forum_posts.asp?TID=969&amp;PID=1915#1915</guid>
  </item> 
  <item>
   <title><![CDATA[TclStringList : var Form1 : TclForm; InputText...]]></title>
   <link>https://forum.clomosy.com.tr/forum_posts.asp?TID=969&amp;PID=1914#1914</link>
   <description>
    <![CDATA[<strong>Yazar:</strong> <a href="https://forum.clomosy.com.tr/member_profile.asp?PF=246">yasar</a><br /><strong>Konu:</strong> 969<br /><strong>Gönderim Zamanı:</strong> 27&nbsp;Kasım&nbsp;2024 Saat 11:55<br /><br /><div>var</div><div><br></div><div>&nbsp; Form1 : TclForm;</div><div><br></div><div>&nbsp; InputText : TclProEdit;</div><div><br></div><div>&nbsp; ResponseMemo : TclMemo;</div><div><br></div><div>&nbsp; Button1 : TclButton;</div><div><br></div><div>&nbsp; clRest : TCLRest;</div><div>&nbsp; ResponseBody2:tstringlist;</div><div><br></div><div>&nbsp; RequestBody, ResponseBody : string;</div><div><br></div><div>&nbsp;</div><div><br></div><div>void BtnOnClick;</div><div><br></div><div>{</div><div><br></div><div>&nbsp; try</div><div><br></div><div>&nbsp; &nbsp; // clRest bileşeni (API bağlantısı için) oluşturuluyor</div><div><br></div><div>&nbsp; &nbsp; clRest = TCLRest.Create;</div><div><br></div><div>&nbsp; &nbsp; // Kullanıcıdan alınan metni JSON formatında API'ye gönderilecek hale getiriyoruz</div><div><br></div><div>&nbsp; &nbsp; /* RequestBody = '{"contents":{"parts":{"text":"' + InputText.Text + '"}}"}';*/</div><div><br></div><div>&nbsp; &nbsp; RequestBody ='{"contents":{ "role": "user", "parts": {"text": "' + InputText.Text + '"}},"generationConfig": {"temperature": 1,"topK": 40,"topP": 0.95,"maxOutputTokens": 8192,"responseMimeType": "text/plain"}}';</div><div><br></div><div>&nbsp; &nbsp;</div><div><br></div><div>&nbsp; &nbsp;&nbsp;</div><div><br></div><div>&nbsp; &nbsp; // clRest bileşeni ile API bağlantısı kuruyoruz</div><div><br></div><div>&nbsp; &nbsp; clRest.BaseURL = '<a href="https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateC&#111;ntent?key=My" target="_blank" rel="nofollow">https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=My</a> API'; // Gerçek API endpointini kullanın</div><div><br></div><div>&nbsp; &nbsp; clRest.Accept = 'application/json';</div><div><br></div><div>&nbsp; &nbsp; clRest.Method = rmPOST;</div><div><br></div><div>&nbsp; &nbsp; clRest.AddHeader( 'Content-Type',' application/json');</div><div><br></div><div>&nbsp; &nbsp; clRest.AddBody(RequestBody, 'application/json');</div><div><br></div><div>&nbsp; &nbsp;</div><div><br></div><div>&nbsp; &nbsp; // API isteğini gönderiyoruz</div><div><br></div><div>&nbsp; &nbsp; clRest.Execute;</div><div><br></div><div>&nbsp; &nbsp;</div><div><br></div><div>&nbsp; &nbsp; // Yanıt kontrolü</div><div><br></div><div>&nbsp; &nbsp; if (clRest.Response &lt;&gt; '')</div><div><br></div><div>&nbsp; &nbsp; {</div><div><br></div><div>&nbsp; &nbsp; &nbsp; // Başarılı bir yanıt aldıysak, yanıtı ResponseMemo'ya ekliyoruz</div><div><br></div><div>&nbsp; &nbsp; &nbsp; ResponseBody = clRest.Response;</div><div>&nbsp; &nbsp; &nbsp; ResponseBody2= Clomosy.StringListNew;</div><div>&nbsp; &nbsp; &nbsp; ResponseBody2.Delimiter = '"';</div><div><br></div><div>&nbsp; <span style="white-space:pre">		</span>ResponseBody2.DelimitedText = ResponseBody;</div><div><br></div><div>&nbsp; <span style="white-space:pre">		</span>ResponseBody=Clomosy.StringListItemString(ResponseBody2,10);//0. elemanı getirir</div><div><br></div><div>&nbsp; <span style="white-space:pre">		</span>ShowMessage(ResponseBody);</div><div>&nbsp; &nbsp; &nbsp;&nbsp;</div><div><br></div><div>&nbsp; &nbsp; &nbsp; ResponseMemo.Lines.Add('Gemini Yanıtı: ' + ResponseBody);</div><div>&nbsp; &nbsp; &nbsp;&nbsp;</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp;InputText.Text = '';</div><div><br></div><div>&nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; else</div><div><br></div><div>&nbsp; &nbsp; {</div><div><br></div><div>&nbsp; &nbsp; &nbsp; // Yanıt alınamazsa hata mesajı veriyoruz</div><div><br></div><div>&nbsp; &nbsp; &nbsp; ResponseMemo.Lines.Add('API isteği başarısız oldu.');</div><div><br></div><div>&nbsp; &nbsp; }</div><div><br></div><div>&nbsp; finally</div><div><br></div><div>&nbsp; &nbsp; clRest.Free;</div><div><br></div><div>&nbsp; }</div><div><br></div><div>}</div><div><br></div><div>&nbsp;</div><div><br></div><div>{</div><div><br></div><div>&nbsp; // Form ve bileşenleri oluşturuyoruz</div><div><br></div><div>&nbsp; Form1 = TclForm.Create(Self);</div><div><br></div><div>&nbsp;</div><div><br></div><div>&nbsp; // InputText (kullanıcının metin girdiği alan) oluşturuluyor</div><div><br></div><div>&nbsp; InputText = Form1.AddNewProEdit(Form1, 'InputText', 'Enter your query...');</div><div><br></div><div>&nbsp; InputText.Align = alTop;</div><div><br></div><div>&nbsp; InputText.Height = 45;</div><div><br></div><div>&nbsp; InputText.Margins.Top = 10;</div><div><br></div><div>&nbsp; InputText.Margins.Left = 10;</div><div><br></div><div>&nbsp; InputText.Margins.Right = 10;</div><div><br></div><div>&nbsp;</div><div><br></div><div>&nbsp; // Button1 (API çağrısını tetikleyen buton) oluşturuluyor</div><div><br></div><div>&nbsp; Button1 = Form1.AddNewButton(Form1, 'Button1', 'Send Request');</div><div><br></div><div>&nbsp; Button1.Align = alTop;</div><div><br></div><div>&nbsp; Button1.Margins.Top = 10;</div><div><br></div><div>&nbsp; Form1.AddNewEvent(Button1, tbeOnClick, 'BtnOnClick');</div><div><br></div><div>&nbsp;</div><div><br></div><div>&nbsp; // ResponseMemo (yanıtı gösterecek alan) oluşturuluyor</div><div><br></div><div>&nbsp; ResponseMemo = Form1.AddNewMemo(Form1, 'ResponseMemo', 'Response will appear here...');</div><div><br></div><div>&nbsp; ResponseMemo.Align = alTop;</div><div><br></div><div>&nbsp; ResponseMemo.Height = 200;</div><div><br></div><div>&nbsp; ResponseMemo.Margins.Top = 10;</div><div><br></div><div>&nbsp; ResponseMemo.ReadOnly = True;</div><div><br></div><div>&nbsp;</div><div><br></div><div>&nbsp; // Form çalıştırılıyor</div><div><br></div><div>&nbsp; Form1.Run;</div><div><br></div><div>}</div><div>yukardaki koda yapmak istediğim yapay zekadan gelen değerin parçalayıp cevap yazan yeri getirmek istedim yapay zekadan gelen değer</div><div>Gemini Yanıtı: {"candidates":&#091;{"content":{"parts":&#091;{"text":"Merhaba!&nbsp; Nasıl yardımcı olabilirim?\n"}&#093;,"role":"model"},"finishReason":"STOP","avgLogprobs":-0.018644950606606224}&#093;,"usageMetadata":{"promptTokenCount":3,"candidatesTokenCount":11,"totalTokenCount":14},"modelVersion":"gemini-1.5-flash-latest"}&nbsp;</div><div>bu şekilde gelemkte çift tırnağa göre bölmek istedim ancak sadece nasıl yazısını yazmakta nasıl yapabilirim&nbsp;</div>]]>
   </description>
   <pubDate>Wed, 27 Nov 2024 11:55:46 +0000</pubDate>
   <guid isPermaLink="true">https://forum.clomosy.com.tr/forum_posts.asp?TID=969&amp;PID=1914#1914</guid>
  </item> 
 </channel>
</rss>