(null);
const warning = `
{% callout type="warning" title="Always double check!" %}
This feature is still in Alpha.
The results may not be accurate, so please always double check with our documentation.
{% /callout %}
-
`;
const handleSubmit = async () => {
@@ -38,6 +39,20 @@ export function FeatureAi(): JSX.Element {
);
};
+ const handleFeedback = (type: 'good' | 'bad') => {
+ try {
+ sendCustomEvent('ai_feedback', 'ai', type, undefined, {
+ query,
+ result: finalResult,
+ });
+ setToastMessage(null);
+ setTimeout(() => setToastMessage('Thank you for your feedback!'), 100);
+ } catch (error) {
+ setToastMessage(null);
+ setTimeout(() => setToastMessage('Feedback was not sent.'), 100);
+ }
+ };
+
return (
- sendCustomEvent('ai_feedback', 'ai', 'good', undefined, {
- query,
- result: finalResult,
- })
- }
+ onClick={() => handleFeedback('good')}
>
Answer was helpful{' '}
@@ -97,12 +107,7 @@ export function FeatureAi(): JSX.Element {
>
) : null}
+ {toastMessage && }
{error ? There was an error: {error['message']}
: null}
);