fix: tweak error display in ttd (#10668)

fix: better error handling for ttd
This commit is contained in:
David Luzar
2026-01-17 18:17:04 +01:00
committed by GitHub
parent 5a73b9a363
commit 0443511954
4 changed files with 28 additions and 4 deletions
@@ -339,12 +339,21 @@ $verticalBreakpoint: 861px;
gap: 0.5rem; gap: 0.5rem;
} }
&__error_message {
background: var(--color-warning-background);
color: var(--color-warning-color);
padding: 0.5rem 0.75rem;
border-radius: var(--border-radius-md);
margin-top: 1rem;
font-size: 0.875rem;
}
&__error-link { &__error-link {
display: flex; display: flex;
align-items: center; align-items: center;
background: none; background: none;
border: none; border: none;
color: var(--color-primary);
cursor: pointer; cursor: pointer;
font-size: 0.875rem; font-size: 0.875rem;
font-weight: 500; font-weight: 500;
@@ -352,6 +361,14 @@ $verticalBreakpoint: 861px;
margin-top: 1rem; margin-top: 1rem;
text-decoration: underline; text-decoration: underline;
font-family: inherit; font-family: inherit;
color: var(--link-color);
&:hover {
color: var(--link-color-hover);
}
&:active {
color: var(--link-color-active);
}
&:disabled { &:disabled {
cursor: not-allowed; cursor: not-allowed;
@@ -123,8 +123,13 @@ export const ChatMessage: React.FC<{
{message.error ? ( {message.error ? (
<> <>
<div className="chat-message__error">{message.content}</div> <div className="chat-message__error">{message.content}</div>
{message.errorType !== "parse" && (
<div className="chat-message__error_message">
Error: {message.error || t("chat.errors.generationFailed")}
</div>
)}
{message.errorType === "parse" && allowFixingParseError && ( {message.errorType === "parse" && allowFixingParseError && (
<> <div className="chat-message__error_message">
<p>{t("chat.errors.invalidDiagram")}</p> <p>{t("chat.errors.invalidDiagram")}</p>
<div className="chat-message__error-actions"> <div className="chat-message__error-actions">
{onMermaidTabClick && ( {onMermaidTabClick && (
@@ -147,7 +152,7 @@ export const ChatMessage: React.FC<{
</button> </button>
)} )}
</div> </div>
</> </div>
)} )}
</> </>
) : ( ) : (
@@ -32,7 +32,7 @@ export type StreamChunk =
type: "error"; type: "error";
error: { error: {
message: string; message: string;
code?: string; status?: number;
}; };
}; };
+2
View File
@@ -26,6 +26,8 @@
--island-bg-color-alt: #fff; --island-bg-color-alt: #fff;
--keybinding-color: var(--color-gray-40); --keybinding-color: var(--color-gray-40);
--link-color: #{$color-blue-7}; --link-color: #{$color-blue-7};
--link-color-hover: #{$color-blue-8};
--link-color-active: #{$color-blue-2};
--overlay-bg-color: #{color.adjust(#fff, $alpha: -0.12)}; --overlay-bg-color: #{color.adjust(#fff, $alpha: -0.12)};
--popup-bg-color: var(--island-bg-color); --popup-bg-color: var(--island-bg-color);
--popup-secondary-bg-color: #{$color-gray-1}; --popup-secondary-bg-color: #{$color-gray-1};