fix(editor): Fix chat crashing when rendering output-parsed content (#11210)

This commit is contained in:
oleg
2024-10-11 09:47:10 +02:00
committed by GitHub
parent 1078fa662a
commit 4aaebfd435

View File

@@ -384,7 +384,12 @@ function extractResponseMessage(responseData?: IDataObject) {
if (!matchedPath) return JSON.stringify(responseData, null, 2);
return get(responseData, matchedPath) as string;
const matchedOutput = get(responseData, matchedPath);
if (typeof matchedOutput === 'object') {
return '```json\n' + JSON.stringify(matchedOutput, null, 2) + '\n```';
}
return matchedOutput?.toString() ?? '';
}
async function sendMessage(message: string, files?: File[]) {