0

CHAT GBT in Ninox

Ich versuche, Chat GBTin Ninox durch eine Formel zu integrieren, die über eine Schaltfläche ausgeführt wird. Das Problem ist, dass die Antwort immer leer ist.. Ich habe auch die Funktion "alert" ausprobiert, aber es ändert nichts. Wo könnte es hängen?

let auth := {
        Authorization: "Bearer API-KODEX",
        'Content-Type': "application/json"
    };
let url := "https://chatgpt-api.shn.hk/v1/completions";
let payload := {
        Question: "TEXT FRAGE"
    };
let response := http("POST", url, auth, payload);
Testo := text(response.result.item(choices, 0).text)

3 Antworten

null
    • T_Bartzsch
    • vor 9 Monaten
    • Gemeldet - anzeigen

    Als erstes: API Calls als "do as server" ausführen...

    Dann: bevor du im response immer tiefer navigierst (.result.choices.text), was sagt dir denn text(response)? 

    Ist das ein OpenAPI Projekt?

      • Walcher_Messebau
      • vor 9 Monaten
      • Gemeldet - anzeigen

      T. Bartzsch Hallo! Ich habe gesehen dass es eine kostenlose Version gibt ohne API. 

      Allerdings ändert sich hier auch der Link vom Endpoint. 

      https://freechatgpt.chat

      Ich kann mir gut vorstellen dass in diesem Fall so ein Script nicht Funktionieren kann:

      let auth := {
              'Content-Type': "application/json"
          };
      let url := "https://free.churchless.tech/v1/chat/completions";
      let payload := {
              Question: "Quanti giorni ci sono in una settimana"
          };
      let response := do as server
              http("POST", url, auth, {})
          end;
      Testo := text(response)

      Wenn ich jetzt mit diesen Script den .Response kontrolliere, bekomme ich folgende Meldung:

      {"result":"<!DOCTYPE html>\n<!--[if lt IE 7]> <html class=\"no-js ie6 oldie\" lang=\"en-US\"> <![endif]-->\n<!--[if IE 7]>    <html class=\"no-js ie7 oldie\" lang=\"en-US\"> <![endif]-->\n<!--[if IE 8]>    <html class=\"no-js ie8 oldie\" lang=\"en-US\"> <![endif]-->\n<!--[if gt IE 8]><!--> <html class=\"no-js\" lang=\"en-US\"> <!--<![endif]-->\n<head>\n<title>Attention Required! | Cloudflare</title>\n<meta charset=\"UTF-8\" />\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\" />\n<meta name=\"robots\" content=\"noindex, nofollow\" />\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />\n<link rel=\"stylesheet\" id=\"cf_styles-css\" href=\"/cdn-cgi/styles/cf.errors.css\" />\n<!--[if lt IE 9]><link rel=\"stylesheet\" id='cf_styles-ie-css' href=\"/cdn-cgi/styles/cf.errors.ie.css\" /><![endif]-->\n<style>body{margin:0;padding:0}</style>\n\n\n<!--[if gte IE 10]><!-->\n<script>\n  if (!navigator.cookieEnabled) {\n    window.addEventListener('DOMContentLoaded', function () {\n      var cookieEl = document.getElementById('cookie-alert');\n      cookieEl.style.display = 'block';\n    })\n  }\n</script>\n<!--<![endif]-->\n\n\n</head>\n<body>\n  <div id=\"cf-wrapper\">\n    <div class=\"cf-alert cf-alert-error cf-cookie-error\" id=\"cookie-alert\" data-translate=\"enable_cookies\">Please enable cookies.</div>\n    <div id=\"cf-error-details\" class=\"cf-error-details-wrapper\">\n      <div class=\"cf-wrapper cf-header cf-error-overview\">\n        <h1 data-translate=\"block_headline\">Sorry, you have been blocked</h1>\n        <h2 class=\"cf-subheadline\"><span data-translate=\"unable_to_access\">You are unable to access</span> churchless.tech</h2>\n      </div><!-- /.header -->\n\n      <div class=\"cf-section cf-highlight\">\n        <div class=\"cf-wrapper\">\n          <div class=\"cf-screenshot-container cf-screenshot-full\">\n            \n              <span class=\"cf-no-screenshot error\"></span>\n            \n          </div>\n        </div>\n      </div><!-- /.captcha-container -->\n\n      <div class=\"cf-section cf-wrapper\">\n        <div class=\"cf-columns two\">\n          <div class=\"cf-column\">\n            <h2 data-translate=\"blocked_why_headline\">Why have I been blocked?</h2>\n\n            <p data-translate=\"blocked_why_detail\">This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.</p>\n          </div>\n\n          <div class=\"cf-column\">\n            <h2 data-translate=\"blocked_resolve_headline\">What can I do to resolve this?</h2>\n\n            <p data-translate=\"blocked_resolve_detail\">You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page.</p>\n          </div>\n        </div>\n      </div><!-- /.section -->\n\n      <div class=\"cf-error-footer cf-wrapper w-240 lg:w-full py-10 sm:py-4 sm:px-8 mx-auto text-center sm:text-left border-solid border-0 border-t border-gray-300\">\n  <p class=\"text-13\">\n    <span class=\"cf-footer-item sm:block sm:mb-1\">Cloudflare Ray ID: <strong class=\"font-semibold\">7cf7c2165ddb68eb</strong></span>\n    <span class=\"cf-footer-separator sm:hidden\">&bull;</span>\n    <span id=\"cf-footer-item-ip\" class=\"cf-footer-item hidden sm:block sm:mb-1\">\n      Your IP:\n      <button type=\"button\" id=\"cf-footer-ip-reveal\" class=\"cf-footer-ip-reveal-btn\">Click to reveal</button>\n      <span class=\"hidden\" id=\"cf-footer-ip\">92.205.29.56</span>\n      <span class=\"cf-footer-separator sm:hidden\">&bull;</span>\n    </span>\n    <span class=\"cf-footer-item sm:block sm:mb-1\"><span>Performance &amp; security by</span> <a rel=\"noopener noreferrer\" href=\"https://www.cloudflare.com/5xx-error-landing\" id=\"brand_link\" target=\"_blank\">Cloudflare</a></span>\n    \n  </p>\n  <script>(function(){function d(){var b=a.getElementById(\"cf-footer-item-ip\"),c=a.getElementById(\"cf-footer-ip-reveal\");b&&\"classList\"in b&&(b.classList.remove(\"hidden\"),c.addEventListener(\"click\",function(){c.classList.add(\"hidden\");a.getElementById(\"cf-footer-ip\").classList.remove(\"hidden\")}))}var a=document;document.addEventListener&&a.addEventListener(\"DOMContentLoaded\",d)})();</script>\n</div><!-- /.error-footer -->\n\n\n    </div><!-- /#cf-error-details -->\n  </div><!-- /#cf-wrapper -->\n\n  <script>\n  window._cf_translation = {};\n  \n  \n</script>\n\n</body>\n</html>

      Laut mir muss hier in der zweiten Zeile  keine Autorisierungsheader angegeben werden, sondern man muss ein JSON-Objekt erstellen, das den Hauptteil der Anfrage enthält. Nur habe ich keine Ahnung wie oder vielleicht liege ich einfach falsch 

    • Head of Product Design
    • toby
    • vor 9 Monaten
    • Gemeldet - anzeigen

    Hallo,

     

    ich habe zu dem Thema einen kleines Tutorial geschrieben: https://www.linkedin.com/pulse/tutorial-automate-business-email-responses-ninox-openai-treppmann/?trackingId=e3ylT9IMT%2BCp7FsR16y10A%3D%3D

     

    Aber hier ein Beispiel:

    let eineVariable := “falls wir eine Variable, wie z.B. ein Feldwert benutzen wollen”;
    let promptToComplete := “TEXT FRAGE mit " +eineVariable +" wird an ChatGPT geschickt;
    let url := "https://api.openai.com/v1/engines/text-davinci-003/completions";
    let maxTokens := 1024;
    let apiKey := "[OPENAI_API_KEY]";
    let requestBody := {prompt: promptToComplete,max_tokens: maxTokens,temperature: 0.7};
    
    let response := do as serverhttp("POST", url, {'Content-Type': "application/json",Authorization: "Bearer " + apiKey}, requestBody)end;
    
    let responseText := first(response.result.choices);
    let responseTextWithWhitespaceRemoved := replacex(text(responseText.text), "^\s+", "");
    
    Texto := text(responseTextWithWhitespaceRemoved);

     

    Probier das mal aus und schau ob es für dich funktioniert.

Content aside

  • vor 9 MonatenZuletzt aktiv
  • 3Antworten
  • 208Ansichten
  • 4 Folge bereits