@widgetic/chat 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -713,6 +713,15 @@
|
|
|
713
713
|
return false;
|
|
714
714
|
}
|
|
715
715
|
|
|
716
|
+
function isPlanLimitMessage(message: string | null | undefined): boolean {
|
|
717
|
+
if (!message) return false;
|
|
718
|
+
return /credit balance|free trial|not available in your plan|not available on the free plan|upgrade your plan|upgrade to a solo/i.test(message);
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
function openUpgradePlans() {
|
|
722
|
+
window.location.assign('/workspaces/personal/settings/billing');
|
|
723
|
+
}
|
|
724
|
+
|
|
716
725
|
function turnNeedsRetry(turn: ChatTurn, turnIndex: number): boolean {
|
|
717
726
|
// Never show Retry while a send/codegen is still running.
|
|
718
727
|
if (isLoading || isGenerating) return false;
|
|
@@ -1322,6 +1331,15 @@
|
|
|
1322
1331
|
|
|
1323
1332
|
{#if isCodegenFailure(reply) && isLastCodegenFailureInTurn(turn, reply) && turnNeedsRetry(turn, turnIndex)}
|
|
1324
1333
|
<div class="retry-codegen-row flex justify-start mt-1">
|
|
1334
|
+
{#if isPlanLimitMessage(reply.messageContent)}
|
|
1335
|
+
<button
|
|
1336
|
+
class="retry-codegen-btn"
|
|
1337
|
+
onclick={openUpgradePlans}
|
|
1338
|
+
title="Open plans and billing"
|
|
1339
|
+
>
|
|
1340
|
+
Upgrade
|
|
1341
|
+
</button>
|
|
1342
|
+
{:else}
|
|
1325
1343
|
<button
|
|
1326
1344
|
class="retry-codegen-btn"
|
|
1327
1345
|
onclick={() => handleRetryTurn(turn, turnIndex)}
|
|
@@ -1333,6 +1351,7 @@
|
|
|
1333
1351
|
</svg>
|
|
1334
1352
|
Retry
|
|
1335
1353
|
</button>
|
|
1354
|
+
{/if}
|
|
1336
1355
|
</div>
|
|
1337
1356
|
{/if}
|
|
1338
1357
|
</div>
|