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 23 forks source link

Customize error message #74

Open dbwinger opened 1 month ago

dbwinger commented 1 month ago

We're getting errors occasionally when OpenAI gives an error response. I'm wondering if there's currently a way, or you might consider providing a way to replace the generic error message with our own custom message (rich text), so we could have something like:

"Sorry, it appears our chat isn't working right now. If you're looking for an insurance quote, please fill out our form here"

...and not appear quite as useless if OpenAI currently is.

kognetiks commented 1 month ago

Hello dbwinger,

Yes, of course I can provide an alternative "error" response.

Do you have any insight into the nature of the error message you are getting?

Is it one of the messages below?

image

Or is it the actual error message coming back from the OpenAI?

Depending on where in the process the error occured, you might get both a specific error and an additional message.

image

Let me know so that I can tackle the problem where it is occuring in the code.

In the meantime, I'll starting thinking about where/how to add some customization.

This is an excellent idea! Thank you for suggesting it.

Stephen

dbwinger commented 1 month ago

Thanks Stephan!

I didn't take a screenshot, but I will next time. I think it was the "Oops! Something went wrong on our end. Please try again later". I suppose I don't have a problem with showing your error messages. Some of them could be helpful to the user. But if there could be a way to add an additional message to direct the user to another resource - in our case our lead form - that would be great.

Thanks for the great plugin by the way.

Daryl

kognetiks commented 1 month ago

Daryl,

Thank you for the feedback.

Let me see if I can quickly add a custom message instead of the OpenAI messages.

I can alter the code so that it write the error to the WP error log message instead of appending it.

I can alter the code so that you can add a custom message.

Let me see what I can do real quick.

I'm about to release Ver 2.0.3 and will try to get something into this release - which I'm looking to publish shortly.

Stephen

kognetiks commented 1 month ago

image

image

image

You would enter the custom error message like this on the "Messages" tab.

Sorry, it appears our chat isn't working right now. If you're looking for support, click here.

You'll also need to turn Chatbot Diagnostis from "Off" to "Error".

And you will also need to turn WordPress error logging on.

This will be release when I push Version 2.0.3 to production.

dbwinger commented 1 month ago

This looks like it will accomplish what I'm looking for. Thanks so much!

kognetiks commented 1 month ago

Just released V2.0.3 to production. If you update to the latest version you should be able to action now. Let me if you have issues. I'll leave this item open for now.

dbwinger commented 1 month ago

Thanks. Are you saying that I need to enable WP_DEBUG for this feature to work?

kognetiks commented 1 month ago

No, you DO NOT need to enable WP_DEBUG. It will work without turning it on.

In the next release I'll add a custom log function that will handling log keeping just for the chatbot errors.