Skip to content
Snippets Groups Projects
Unverified Commit d037ab27 authored by Sean Hatfield's avatar Sean Hatfield Committed by GitHub
Browse files

[FEAT] Generic error messages for embed chat widget (#1861)


* give generic error messages for embed chat widget

* give generic errors on embed chat errors but log to console

* lint

---------

Co-authored-by: default avatartimothycarambat <rambat1010@gmail.com>
parent f553f07e
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,7 @@ const HistoricalMessage = forwardRef( ...@@ -16,6 +16,7 @@ const HistoricalMessage = forwardRef(
const textSize = !!embedderSettings.settings.textSize const textSize = !!embedderSettings.settings.textSize
? `allm-text-[${embedderSettings.settings.textSize}px]` ? `allm-text-[${embedderSettings.settings.textSize}px]`
: "allm-text-sm"; : "allm-text-sm";
if (error) console.error(`ANYTHING_LLM_CHAT_WIDGET_ERROR: ${error}`);
return ( return (
<div className="py-[5px]"> <div className="py-[5px]">
...@@ -66,7 +67,7 @@ const HistoricalMessage = forwardRef( ...@@ -66,7 +67,7 @@ const HistoricalMessage = forwardRef(
Could not respond to message. Could not respond to message.
</span> </span>
<p className="allm-text-xs allm-font-mono allm-mt-2 allm-border-l-2 allm-border-red-500 allm-pl-2 allm-bg-red-300 allm-p-2 allm-rounded-sm"> <p className="allm-text-xs allm-font-mono allm-mt-2 allm-border-l-2 allm-border-red-500 allm-pl-2 allm-bg-red-300 allm-p-2 allm-rounded-sm">
{error} Server error
</p> </p>
</div> </div>
) : ( ) : (
......
...@@ -8,6 +8,7 @@ import { formatDate } from "@/utils/date"; ...@@ -8,6 +8,7 @@ import { formatDate } from "@/utils/date";
const PromptReply = forwardRef( const PromptReply = forwardRef(
({ uuid, reply, pending, error, sources = [] }, ref) => { ({ uuid, reply, pending, error, sources = [] }, ref) => {
if (!reply && sources.length === 0 && !pending && !error) return null; if (!reply && sources.length === 0 && !pending && !error) return null;
if (error) console.error(`ANYTHING_LLM_CHAT_WIDGET_ERROR: ${error}`);
if (pending) { if (pending) {
return ( return (
...@@ -54,9 +55,7 @@ const PromptReply = forwardRef( ...@@ -54,9 +55,7 @@ const PromptReply = forwardRef(
> >
<Warning className="allm-h-4 allm-w-4 allm-mb-1 allm-inline-block" />{" "} <Warning className="allm-h-4 allm-w-4 allm-mb-1 allm-inline-block" />{" "}
Could not respond to message. Could not respond to message.
<span className="allm-text-xs"> <span className="allm-text-xs">Server error</span>
Reason: {error || "unknown"}
</span>
</span> </span>
</div> </div>
</div> </div>
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment