refactor(CodeViewer): make children prop optional for improved flexibility

This commit is contained in:
suyao 2025-09-04 00:47:02 +08:00
parent a681c28a0a
commit 3d555943c4
No known key found for this signature in database
2 changed files with 7 additions and 4 deletions

View File

@ -19,7 +19,7 @@ interface CodeViewerProps {
* - Supports shiki aliases: c#/csharp, objective-c++/obj-c++/objc++, etc.
*/
language: string
children: React.ReactNode
children?: React.ReactNode
onHeightChange?: (scrollHeight: number) => void
/**
* Height of the scroll container.

View File

@ -337,9 +337,12 @@ const AiApiCallError = ({ error }: { error: SerializedAiSdkAPICallError }) => {
{error.responseBody && (
<ErrorDetailItem>
<ErrorDetailLabel>{t('error.responseBody')}:</ErrorDetailLabel>
<CodeViewer className="source-view" language="json" expanded>
{JSON.stringify(error.responseBody, null, 2)}
</CodeViewer>
<CodeViewer
className="source-view"
language="json"
expanded
value={JSON.stringify(error.responseBody, null, 2)}
/>
</ErrorDetailItem>
)}