Skip to content

Conversation

learningbizz
Copy link
Contributor

Creating this as a PR to confirm my understanding of this situation:

The getResult() method returns a parsed JSON object if its a JSON string, or already an object, or double encoded JSON string, passing the isString to false, and a string if its just a simple string.

If this is the case, then the result from this getResult should be the one used to calculate the length of the JSON, not the previous object passed from the backend. Also, there is no need to stringify again if its done above

Do u also agree?

return (
<CodeBlock
language={strResult?.length > MAX_LENGTH_JSON_PREVIEW ? '' : 'json'}
bgColor={toolResponse.isError ? 'bg-destructive-muted' : undefined}
>
{JSON.stringify(result, null, 2)}
{strResult}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still parses well the tool response

Image

@andresgutgon
Copy link
Contributor

Ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants