OvidijusParsiunas / deep-chat

Fully customizable AI chatbot component for your website
https://deepchat.dev
MIT License
1.27k stars 176 forks source link

Allow customization or removal of the caution message #32

Closed devpulse01 closed 8 months ago

devpulse01 commented 8 months ago

Hi Ovidijus,

I'm using deep-chat in a scenario where users can provide their own API keys. There's currently a hardcoded caution message that's automatically displayed when no key is set, generated by the createCautionText function.

private static createCautionText() {
    const cautionElement = document.createElement('a');
    cautionElement.classList.add('insert-key-input-help-text');
    cautionElement.innerText = 'Please exercise CAUTION when inserting your API key outside of deepchat.dev or localhost!!';
    return cautionElement;
}

Would it be possible to add the ability to customize or hide/remove this message? Thanks!

OvidijusParsiunas commented 8 months ago

Hey @devpulse01, customization of the key insertion view is a feature that I will be implementing later in the future. Because I currently have a lot of other ones in priority I can't focus in on that one at the moment. Nevertheless, I have created a temporary property inside the deep-chat-dev package (and deep-chat-react-dev for React) version 9.0.46, called _insertKeyViewStyles that will allow you to remove the caution text.

This is the _insertKeyViewStyles property's object value type:

{ displayCautionText?: boolean }

This is how you can use it in the html markup and will need to tailor it to your framework syntax of choice:

_insertKeyViewStyles='{"displayCautionText": false}'

Just to note, the dev packages are used exactly the same as the regular ones except their package names are different. The reason why I have inserted this property there is because I am going to shortly be releasing a new feature for toggling the submit button, hence the component has already undergone a lot of changes and I don't want to ship it just yet. When the new feature will be released to the core deep-chat packages - the _insertKeyViewStyles will also be released with it. I will update this thread when that happens.

Let me know if this change worked for you. Thanks!

devpulse01 commented 8 months ago

Thank you so much! I'll try this.

OvidijusParsiunas commented 8 months ago

I will be closing this issue now but if you experience any other you can always raise another issue. Thanks!

devpulse01 commented 7 months ago

This works perfectly