Skip to content

Commit 3350664

Browse files
sonianuj287Copilot
andauthored
Update apps/opik-frontend/src/lib/prettifyMessage.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 8b8f764 commit 3350664

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

apps/opik-frontend/src/lib/prettifyMessage.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,37 +208,37 @@ const isLLMMessagesObject = (obj: object): boolean => {
208208

209209
// Check for messages array with LLM format
210210
if ("messages" in objRecord && Array.isArray(objRecord.messages)) {
211-
return objRecord.messages.length > 1 && // Only use pretty mode for multiple messages
212-
objRecord.messages.every((msg: unknown) =>
211+
return objRecord.messages.every((msg: unknown) =>
213212
typeof msg === "object" &&
214213
msg !== null &&
215214
(("role" in (msg as Record<string, unknown>)) ||
216215
("type" in (msg as Record<string, unknown>))) &&
217216
"content" in (msg as Record<string, unknown>)
218-
);
217+
) &&
218+
objRecord.messages.length > 1; // Only use pretty mode for multiple messages
219219
}
220220

221221
// Check for input array (OpenAI Agents format)
222222
if ("input" in objRecord && Array.isArray(objRecord.input)) {
223-
return objRecord.input.length > 1 && // Only use pretty mode for multiple messages
224-
objRecord.input.every((msg: unknown) =>
223+
return objRecord.input.every((msg: unknown) =>
225224
typeof msg === "object" &&
226225
msg !== null &&
227226
"role" in (msg as Record<string, unknown>) &&
228227
"content" in (msg as Record<string, unknown>)
229-
);
228+
) &&
229+
objRecord.input.length > 1; // Only use pretty mode for multiple messages
230230
}
231231

232232
// Check for output array (OpenAI Agents format)
233233
if ("output" in objRecord && Array.isArray(objRecord.output)) {
234-
return objRecord.output.length > 1 && // Only use pretty mode for multiple messages
235-
objRecord.output.every((msg: unknown) =>
234+
return objRecord.output.every((msg: unknown) =>
236235
typeof msg === "object" &&
237236
msg !== null &&
238237
"role" in (msg as Record<string, unknown>) &&
239238
("content" in (msg as Record<string, unknown>) ||
240239
"type" in (msg as Record<string, unknown>))
241-
);
240+
) &&
241+
objRecord.output.length > 1; // Only use pretty mode for multiple messages
242242
}
243243

244244
return false;

0 commit comments

Comments
 (0)