nextcloud / integration_openai

OpenAI integration in Nextcloud
GNU Affero General Public License v3.0
49 stars 11 forks source link

No output after requesting service #6

Closed HomemadeAdvanced closed 1 year ago

HomemadeAdvanced commented 1 year ago

I added the app to the NC and then I added the ChatGPT API key to the NC. But when I want to test it, I write "/" in a talk group and I can select ChatGPT or Dalle. I write something in the text line and when I confirm to send it, nothing happens.

What am I doing wrong?

My DNS server resolves the ChatGPT API domain, but the ChatGPT API web page says that the key has "never" been used so far, so apparently no connection is happening.

julien-nc commented 1 year ago

Hi, When you say "nothing happens", is there really nothing happening?

HomemadeAdvanced commented 1 year ago

OpenAI completions request error ChatGptCustomPickerElement.vue:211 i {message: 'Request failed with status code 400', name: 'AxiosError', code: 'ERR_BAD_REQUEST', config: {…}, request: XMLHttpRequest, …}

I think it is because of the free plan I use. Because of what the NC log says I think I cannot use it with the API. The free plan browser version works for me. Kind of strange.

julien-nc commented 1 year ago

Thanks for the feedback. The next release will display more meaningful errors from the API responses.

What you get means you either ran out of credit or your free trial has expired. You can check that there: https://platform.openai.com/account/usage

The free plan browser version works for me.

What do you mean? Using ChatGPT from the OpenAI web interface does not require a valid API key. This integration uses their REST API which require to have credit and non-expired plan.

julien-nc commented 1 year ago

v1.0.4 is out.

Feel free to reopen if needed.

Nortrix0 commented 1 year ago

I'm having the same issue, only for text generation. I'm not over the limits, but I am getting these warnings for every character I type or button I press

NcButton.js:2 You need to fill either the text or the ariaLabel props in the button component. {text: undefined, ariaLabel: null}ariaLabel: nulltext: undefined[[Prototype]]: Object o {_uid: 385, _isVue: true, __v_skip: true, _scope: e, $options: {…}, …}

Nortrix0 commented 1 year ago

It does look like trying it in a new .md file does work

julien-nc commented 1 year ago

The warning triggered by the NcButton component is not related (and should not be triggered as the button text is defined...).

Switching to another file with Text should not have any effect either.

IMO this is more about OpenAI being sometimes overloaded and returning empty responses.

It would be interesting to know the content of the network response of the POST request made to apps/integration_openai/completions (triggered when you click the "Generate"button) when it fails.

Nortrix0 commented 1 year ago

Yes, it should be unrelated, but when doing DALL-E, which always worked, it did not spew those errors

But this is the POST of the apps/integration_openai/completions


xhr.js:220
POST https://nextcloud/apps/integration_openai/completions 400
  | (anonymous) | @ | xhr.js:220 -- | -- | -- | --   | e.exports | @ | xhr.js:16   | e.exports | @ | dispatchRequest.js:56   | d.request | @ | Axios.js:109   | (anonymous) | @ | Axios.js:144   | (anonymous) | @ | bind.js:9   | onInputEnter | @ | ChatGptCustomPickerElement.vue:246   | En | @ | vue.runtime.esm.js:3017   | n | @ | vue.runtime.esm.js:1815   | click | @ | NcButton.js:2   | En | @ | vue.runtime.esm.js:3017   | n | @ | vue.runtime.esm.js:1815   | a._wrapper | @ | vue.runtime.esm.js:7473
julien-nc commented 1 year ago

Thanks for the feedback.

I need the response content. You can get it in the network tab of the browser dev tools. Select the mentioned request and then check the content of the "response" tab on the right side.

Nortrix0 commented 1 year ago

Request URL: https://nextcloud/apps/integration_openai/completions Request Method: POST Status Code: 400 Remote Address: 45.27.82.162:443 Referrer Policy: no-referrer alt-svc: h3=":443"; ma=2592000 cache-control: no-cache, no-store, must-revalidate content-length: 207 content-security-policy: default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none' content-type: application/json; charset=utf-8 date: Mon, 10 Apr 2023 17:38:26 GMT expires: Thu, 19 Nov 1981 08:52:00 GMT feature-policy: autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none' pragma: no-cache referrer-policy: no-referrer server: Caddy server: Apache/2.4.56 (Debian) strict-transport-security: max-age=31536000; x-content-type-options: nosniff x-frame-options: SAMEORIGIN x-permitted-cross-domain-policies: none x-powered-by: PHP/8.1.17 x-request-id: IrMfWooKjhdYOGugnaTD x-robots-tag: noindex, nofollow x-xss-protection: 1; mode=block :authority: nextcloud :method: POST :path: /apps/integration_openai/completions :scheme: https accept: application/json, text/plain, / accept-encoding: gzip, deflate, br accept-language: en-US,en;q=0.9 content-length: 115 content-type: application/json cookie: nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; __Host-nc_sameSiteCookielax=true; __Host-nc_sameSiteCookiestrict=true; nc_username=nortrix0; oc_sessionPassphrase=Dc71oQQkwcrFA%2B7NYX8cK5XhuizYNvRsZILqn3MRobfv4VZSNlrSGf67Tm0rhMIqRh196O0qSM9boPwR7GgunAKdmiVYC2RsCTdA56Ey4XeKYx8Z9dOiHduJszWxhliG; oc8o7h6e132r=e0f086c87df894676cd4983fd2c91585; nc_token=ka%2BViLrTrimiA9Un0fT5UjkBq2CdNjzl; nc_session_id=e0f086c87df894676cd4983fd2c91585 dnt: 1 origin: https://nextcloud requesttoken: 9tnD5ouAMRzp5G8D5hNDSFagfLeKqbYGk1xCRm/xs3I=:saym0t6rdUawgF5UjVIQITzTEOXQ4fVAxTsKJDXe9Tc= sec-ch-ua: "Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "Windows" sec-fetch-dest: empty sec-fetch-mode: cors sec-fetch-site: same-origin user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36

Payload was: {prompt: "Give me the full story of the events of assassins creed", n: 1, maxTokens: 1000,…} maxTokens : 1000 model : "gpt-3.5-turbo" n : 1 prompt : "Give me the full story of the events of assassins creed"

julien-nc commented 1 year ago

This is the content of the "headers" tab. I need the response one.

Nortrix0 commented 1 year ago

Oh, sorry, having to speed read at work.

{"error":"cURL error 28: Operation timed out after 30001 milliseconds with 0 bytes received (see https:\/\/curl.haxx.se\/libcurl\/c\/libcurl-errors.html) for https:\/\/api.openai.com\/v1\/chat\/completions"}

julien-nc commented 1 year ago

Oh thanks a lot for taking time to help from work :grin: .

There we go. The request made from the Nextcloud server to the OpenAI API reaches a timeout. OpenAI is ofter overloaded.