Add link for rate limit errors (#956)

This commit is contained in:
Will Chen
2025-08-15 14:29:28 -07:00
committed by GitHub
parent 60b1f509e6
commit b06f658fc5

View File

@@ -18,22 +18,32 @@ export function ChatErrorBox({
{error} {error}
<span className="ml-1"> <span className="ml-1">
<ExternalLink href="https://dyad.sh/pro"> <ExternalLink href="https://dyad.sh/pro">
Access with Dyad Pro. Access with Dyad Pro
</ExternalLink> </ExternalLink>
</span> </span>{" "}
or switch to another model.
</ChatErrorContainer> </ChatErrorContainer>
); );
} }
// Important, this needs to come after the "free quota tier" check // Important, this needs to come after the "free quota tier" check
// because it also includes this URL in the error message // because it also includes this URL in the error message
if (error.includes("https://ai.google.dev/gemini-api/docs/rate-limits")) { if (
error.includes("Resource has been exhausted") ||
error.includes("https://ai.google.dev/gemini-api/docs/rate-limits")
) {
return ( return (
<ChatErrorContainer onDismiss={onDismiss}> <ChatErrorContainer onDismiss={onDismiss}>
{error} {error}
<span className="ml-1"> <span className="ml-1">
<ExternalLink href="https://dyad.sh/pro"> <ExternalLink href="https://dyad.sh/pro">
Upgrade to Dyad Pro. Upgrade to Dyad Pro
</ExternalLink>
</span>{" "}
or read the
<span className="ml-1">
<ExternalLink href="https://dyad.sh/docs/help/ai-rate-limit">
Rate limit troubleshooting guide.
</ExternalLink> </ExternalLink>
</span> </span>
</ChatErrorContainer> </ChatErrorContainer>