MCPcopy Create free account
hub / github.com/microsoft/Webwright / contentToText

Function contentToText

assets/compare_trajectory/app.js:303–324  ·  view source on GitHub ↗
(content)

Source from the content-addressed store, hash-verified

301}
302
303function contentToText(content) {
304 if (typeof content === 'string') {
305 return content;
306 }
307 if (Array.isArray(content)) {
308 return content.map((part) => {
309 if (typeof part === 'string') {
310 return part;
311 }
312 if (part && typeof part === 'object') {
313 if (typeof part.text === 'string') {
314 return part.text;
315 }
316 if (typeof part.content === 'string') {
317 return part.content;
318 }
319 }
320 return part ? JSON.stringify(part) : '';
321 }).filter(Boolean).join('\n\n');
322 }
323 return content ? JSON.stringify(content) : '';
324}
325
326function normalizeObservation(message) {
327 const extra = message && message.extra ? message.extra : {};

Callers 2

normalizeObservationFunction · 0.85
normalizeTrajectoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected