kognetiks / kognetiks-chatbot

Kognetiks Chatbot for WordPress is a plugin that allows you to effortlessly integrate OpenAI's ChatGPT API into your website, providing a powerful, AI-driven chatbot for enhanced user experience and personalized support.
https://kognetiks.com/wordpress-plugins/
GNU General Public License v3.0
40 stars 22 forks source link

Error: Cannot start session when headers already sent #76

Open devaxel opened 3 months ago

devaxel commented 3 months ago

Hi. I followed the instructions to add the chatbot to a new wordpress page. When I type the first prompt, I retrieve the follwing errors in the errorlog: Warning: session_start(): Cannot start session when headers already sent in /kunden/384879_40764/hp/wp-content/plugins/chatbot-chatgpt/chatbot-chatgpt.php on line 65

The chatbot isn't responding. Any ideas what I have to change?

kognetiks commented 3 months ago

Hello Devaxel,

Where is the shortcode for the chatbot placed?

If placed in your header this might be a problem.

Can you remove the shortcode from whereever it is currenlty located.

Then create a draft page, add the short code in the middle of the page and save a draft.

Use the simplest of shortcodes:

image

You don't need to publish it, draft will be fine.

Then view the page, and see if the problem persists.

If so, I'll need to investage further.

However, if it works embedded in a page, then the problem is where/how originally embedded the shortcode.

Let me know what you discover as this will inform us as to what needs further investigation.

Stephen

devaxel commented 3 months ago

Thank for your reply. Could solve this. The error was caused by the Cookie-Banner Plugin (Borlabs Cookie).

Could you specify what kind of OpenAI-APIKey I have to configure in the Plugin? The User-APIKey, or the Project-APIKey?

Regards Axel

kognetiks commented 3 months ago

Hello Axel,

Project API keys have replaced user API keys.

Let me know if you have further qeustions.

Stephen

devaxel commented 3 months ago

Thanks Stephen. I tried it with two different OpenAI-Assistants, made with OpenAI-Playground in two different OpenAI-Projects. So I have two Project-APIKeys an two Assistant-IDs. One of them works like expected - everything is fine. The second Assistant expects an PDF-File and the OpenAI-Assistant should rephrasing scientific text of that PDF in simple language. In OpenAI-Playground this works. Using the Project-APIKey and the assistant-ID, the Plugin connects successfully. In the Chatbot-Plugin I can upload a PDF file and get the return "File upload successful" - but after this I get no answer from the Chatbot and aslo no signal, that the Plugin is waiting for a response. I also get no error. Any idea why I dont get any response? Is there another way to check for any errors?

kognetiks commented 3 months ago

Hello Axel,

What model are you using on the Assistant?

I've had difficulty using gpt-4o with an Assistants via the API.

When I use gpt-4-turbo with an Assistant via the API, it seems to work as expected.

Try changing the model to see if that makes a difference.

Stephen

devaxel commented 3 months ago

I will give it a try and give you a feedback tomorrow. Many thanks for your effort.