fix: openai error handling

This commit is contained in:
Timothy Jaeryang Baek
2025-08-11 17:00:06 +04:00
parent 8916a284bd
commit 97448e25ec
4 changed files with 36 additions and 6 deletions
+15 -1
View File
@@ -10,6 +10,20 @@
</div>
<div class=" self-center text-sm">
{typeof content === 'string' ? content : JSON.stringify(content)}
{#if typeof content === 'string'}
{content}
{:else if typeof content === 'object' && content !== null}
{#if content?.error && content?.error?.message}
{content.error.message}
{:else if content?.detail}
{content.detail}
{:else if content?.message}
{content.message}
{:else}
{JSON.stringify(content)}
{/if}
{:else}
{JSON.stringify(content)}
{/if}
</div>
</div>