@meridianlabs/log-viewer 0.3.197 → 0.3.199
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/app/samples/chat/MessageContent.d.ts.map +1 -1
- package/lib/{utils → app/utils}/print.d.ts +2 -1
- package/lib/app/utils/print.d.ts.map +1 -0
- package/lib/index.js +49 -60
- package/lib/index.js.map +1 -1
- package/lib/styles/index.css +10 -0
- package/package.json +1 -1
- package/lib/utils/print.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageContent.d.ts","sourceRoot":"","sources":["../../../../src/app/samples/chat/MessageContent.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAC;AAChD,OAAO,EACL,YAAY,EACZ,WAAW,EACX,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,YAAY,EAGb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAYjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKpD,KAAK,aAAa,GACd,WAAW,GACX,gBAAgB,GAChB,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,eAAe,GACf,WAAW,GACX,WAAW,GACX,cAAc,CAAC;AAInB,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,aAAa,EAAE,CAAC;AAEpD,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,eAAe,CAAC;CAC1B;AAED,eAAO,MAAM,gBAAgB,GAC3B,SAAS,OAAO,KACf,OAAO,IAAI,aAOb,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAoDlD,CAAC;
|
|
1
|
+
{"version":3,"file":"MessageContent.d.ts","sourceRoot":"","sources":["../../../../src/app/samples/chat/MessageContent.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAC;AAChD,OAAO,EACL,YAAY,EACZ,WAAW,EACX,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,YAAY,EAGb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAYjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKpD,KAAK,aAAa,GACd,WAAW,GACX,gBAAgB,GAChB,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,eAAe,GACf,WAAW,GACX,WAAW,GACX,cAAc,CAAC;AAInB,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,aAAa,EAAE,CAAC;AAEpD,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,eAAe,CAAC;CAC1B;AAED,eAAO,MAAM,gBAAgB,GAC3B,SAAS,OAAO,KACf,OAAO,IAAI,aAOb,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAoDlD,CAAC;AAyRF,MAAM,MAAM,gBAAgB,CAAC,IAAI,EAAE,IAAI,SAAS,WAAW,IAAI,IAAI,SAAS,GAAG,GAC3E,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAChB,KAAK,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EvalSpec } from '../../@types/log';
|
|
1
2
|
/**
|
|
2
3
|
* Opens a new window and prints the provided HTML content with optional custom CSS for printing.
|
|
3
4
|
*
|
|
@@ -17,5 +18,5 @@ export declare const printHtml: (html: string, css: string) => void;
|
|
|
17
18
|
* const headingHtml = printHeadingHtml();
|
|
18
19
|
* console.log(headingHtml);
|
|
19
20
|
*/
|
|
20
|
-
export declare const printHeadingHtml: () => string;
|
|
21
|
+
export declare const printHeadingHtml: (evalSpec?: EvalSpec) => string;
|
|
21
22
|
//# sourceMappingURL=print.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"print.d.ts","sourceRoot":"","sources":["../../../src/app/utils/print.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,SAkClD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,GAAI,WAAW,QAAQ,KAAG,MAetD,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -99584,15 +99584,14 @@ const MessageContent = ({
|
|
|
99584
99584
|
};
|
|
99585
99585
|
const messageRenderers = {
|
|
99586
99586
|
text: {
|
|
99587
|
-
render: (key2, content2, isLast,
|
|
99587
|
+
render: (key2, content2, isLast, _context) => {
|
|
99588
99588
|
const c2 = content2;
|
|
99589
99589
|
const cites = c2.citations ?? [];
|
|
99590
99590
|
if (!c2.text && !cites.length) {
|
|
99591
99591
|
return void 0;
|
|
99592
99592
|
}
|
|
99593
99593
|
const purgeInternalContainers = (text2) => {
|
|
99594
|
-
const
|
|
99595
|
-
const internalTags = !isAssistantMessage ? ["internal", "content-internal"] : ["internal", "content-internal", "think"];
|
|
99594
|
+
const internalTags = ["internal", "content-internal"];
|
|
99596
99595
|
internalTags.forEach((tag) => {
|
|
99597
99596
|
const regex2 = new RegExp(`<${tag}[^>]*>[\\s\\S]*?<\\/${tag}>`, "gm");
|
|
99598
99597
|
text2 = text2.replace(regex2, "");
|
|
@@ -106611,7 +106610,7 @@ const ViewerOptionsPopover = ({
|
|
|
106611
106610
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$1d.fullWidth, styles$1d.fullWidthPadded), children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: styles$1d.logDir, children: logDir2 }) }),
|
|
106612
106611
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$1d.spacer) }),
|
|
106613
106612
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx("text-style-label", "text-style-secondary"), children: "Version" }),
|
|
106614
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(), children: "0.3.
|
|
106613
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(), children: "0.3.199-0-gffdb82c59" }),
|
|
106615
106614
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx("text-style-label", "text-style-secondary"), children: "Schema" }),
|
|
106616
106615
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(), children: DB_VERSION }),
|
|
106617
106616
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$1d.spacer) }),
|
|
@@ -166199,51 +166198,6 @@ const NoContentsPanel = ({ text: text2 }) => {
|
|
|
166199
166198
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: text2 })
|
|
166200
166199
|
] }) });
|
|
166201
166200
|
};
|
|
166202
|
-
const printHtml = (html2, css2) => {
|
|
166203
|
-
const printWindow = window.open("", "", "height=600,width=800");
|
|
166204
|
-
if (printWindow !== null) {
|
|
166205
|
-
printWindow.document.write("<html><head><title>Print</title>");
|
|
166206
|
-
printWindow.document.write(`
|
|
166207
|
-
<link rel="stylesheet" crossorigin="" href="./assets/index.css">
|
|
166208
|
-
<style>
|
|
166209
|
-
@media print {
|
|
166210
|
-
${css2}
|
|
166211
|
-
}
|
|
166212
|
-
</style>
|
|
166213
|
-
`);
|
|
166214
|
-
printWindow.document.write("</head><body>");
|
|
166215
|
-
printWindow.document.write(html2);
|
|
166216
|
-
printWindow.document.write("</body></html>");
|
|
166217
|
-
printWindow.document.close();
|
|
166218
|
-
printWindow.onload = function() {
|
|
166219
|
-
printWindow.focus();
|
|
166220
|
-
printWindow.print();
|
|
166221
|
-
printWindow.close();
|
|
166222
|
-
};
|
|
166223
|
-
} else {
|
|
166224
|
-
console.error("Print window failed to open.");
|
|
166225
|
-
}
|
|
166226
|
-
};
|
|
166227
|
-
const printHeadingHtml = () => {
|
|
166228
|
-
const taskEl = document.getElementById("task-title");
|
|
166229
|
-
const modelEl = document.getElementById("task-model");
|
|
166230
|
-
const timeEl = document.getElementById("task-created");
|
|
166231
|
-
if (!taskEl || !modelEl || !timeEl) {
|
|
166232
|
-
throw new Error(
|
|
166233
|
-
"Failed to compute heading HTML. The task, model, or time element can't be found."
|
|
166234
|
-
);
|
|
166235
|
-
}
|
|
166236
|
-
const task = taskEl.innerText;
|
|
166237
|
-
const model2 = modelEl.innerText;
|
|
166238
|
-
const time = timeEl.innerText;
|
|
166239
|
-
const headingHtml = `
|
|
166240
|
-
<div style="display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 0.5em; margin-bottom: 2em; justify-content: space-between; border-bottom: solid 1px silver;">
|
|
166241
|
-
<div style="font-weight: 600">${task}</div>
|
|
166242
|
-
<div style="text-align: center;">${model2}</div>
|
|
166243
|
-
<div style="text-align: right;">${time}</div>
|
|
166244
|
-
</div>`;
|
|
166245
|
-
return headingHtml;
|
|
166246
|
-
};
|
|
166247
166201
|
const messagesToStr = (messages2, options2) => {
|
|
166248
166202
|
const opts = {};
|
|
166249
166203
|
return messages2.map((msg) => messageToStr(msg, opts)).filter((str2) => str2 !== null).join("\n");
|
|
@@ -180021,6 +179975,11 @@ const transformers = () => {
|
|
|
180021
179975
|
matches: (node2) => node2.event.event === SPAN_BEGIN && node2.event["type"] === TYPE_SOLVER && node2.children.length === 2 && node2.children[0].event.event === SPAN_BEGIN && node2.children[0].event.type === TYPE_AGENT && node2.children[1].event.event === STATE,
|
|
180022
179976
|
process: (node2) => skipFirstChildNode(node2)
|
|
180023
179977
|
},
|
|
179978
|
+
{
|
|
179979
|
+
name: "unwrap_filtered-agent_solver",
|
|
179980
|
+
matches: (node2) => node2.event.event === SPAN_BEGIN && node2.event["type"] === TYPE_SOLVER && node2.children.length === 1 && node2.children[0].event.event === SPAN_BEGIN && node2.children[0].event.type === TYPE_AGENT,
|
|
179981
|
+
process: (node2) => skipFirstChildNode(node2)
|
|
179982
|
+
},
|
|
180024
179983
|
{
|
|
180025
179984
|
name: "unwrap_agent_solver w/store",
|
|
180026
179985
|
matches: (node2) => node2.event.event === SPAN_BEGIN && node2.event["type"] === TYPE_SOLVER && node2.children.length === 3 && node2.children[0].event.event === SPAN_BEGIN && node2.children[0].event.type === TYPE_AGENT && node2.children[1].event.event === STATE && node2.children[2].event.event === STORE,
|
|
@@ -180529,6 +180488,43 @@ const TranscriptPanel = memo((props) => {
|
|
|
180529
180488
|
);
|
|
180530
180489
|
}
|
|
180531
180490
|
});
|
|
180491
|
+
const printHtml = (html2, css2) => {
|
|
180492
|
+
const printWindow = window.open("", "", "height=600,width=800");
|
|
180493
|
+
if (printWindow !== null) {
|
|
180494
|
+
printWindow.document.write("<html><head><title>Print</title>");
|
|
180495
|
+
printWindow.document.write(`
|
|
180496
|
+
<link rel="stylesheet" crossorigin="" href="./assets/index.css">
|
|
180497
|
+
<style>
|
|
180498
|
+
@media print {
|
|
180499
|
+
${css2}
|
|
180500
|
+
}
|
|
180501
|
+
</style>
|
|
180502
|
+
`);
|
|
180503
|
+
printWindow.document.write("</head><body>");
|
|
180504
|
+
printWindow.document.write(html2);
|
|
180505
|
+
printWindow.document.write("</body></html>");
|
|
180506
|
+
printWindow.document.close();
|
|
180507
|
+
printWindow.onload = function() {
|
|
180508
|
+
printWindow.focus();
|
|
180509
|
+
printWindow.print();
|
|
180510
|
+
printWindow.close();
|
|
180511
|
+
};
|
|
180512
|
+
} else {
|
|
180513
|
+
console.error("Print window failed to open.");
|
|
180514
|
+
}
|
|
180515
|
+
};
|
|
180516
|
+
const printHeadingHtml = (evalSpec) => {
|
|
180517
|
+
const task = evalSpec?.task || "Unknown Task";
|
|
180518
|
+
const model2 = evalSpec?.model || "Unknown Model";
|
|
180519
|
+
const time = evalSpec?.created ? new Date(evalSpec.created).toLocaleString() : "Unknown Time";
|
|
180520
|
+
const headingHtml = `
|
|
180521
|
+
<div style="display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 0.5em; margin-bottom: 2em; justify-content: space-between; border-bottom: solid 1px silver;">
|
|
180522
|
+
<div style="font-weight: 600">${task}</div>
|
|
180523
|
+
<div style="text-align: center;">${model2}</div>
|
|
180524
|
+
<div style="text-align: right;">${time}</div>
|
|
180525
|
+
</div>`;
|
|
180526
|
+
return headingHtml;
|
|
180527
|
+
};
|
|
180532
180528
|
const SampleDisplay = ({
|
|
180533
180529
|
id,
|
|
180534
180530
|
scrollRef,
|
|
@@ -180626,8 +180622,8 @@ const SampleDisplay = ({
|
|
|
180626
180622
|
const filterRef = useRef(null);
|
|
180627
180623
|
const optionsRef = useRef(null);
|
|
180628
180624
|
const handlePrintClick = useCallback(() => {
|
|
180629
|
-
printSample(id, targetId);
|
|
180630
|
-
}, [id, targetId]);
|
|
180625
|
+
printSample(id, targetId, evalSpec);
|
|
180626
|
+
}, [id, targetId, evalSpec]);
|
|
180631
180627
|
const toggleFilter = useCallback(() => {
|
|
180632
180628
|
setShowing(!isShowing);
|
|
180633
180629
|
}, [setShowing, isShowing]);
|
|
@@ -181052,7 +181048,7 @@ const metadataViewsForSample = (id, scrollRef, sample2) => {
|
|
|
181052
181048
|
}
|
|
181053
181049
|
return sampleMetadatas;
|
|
181054
181050
|
};
|
|
181055
|
-
const printSample = (id, targetId) => {
|
|
181051
|
+
const printSample = (id, targetId, evalSpec) => {
|
|
181056
181052
|
const targetTabEl = document.querySelector(
|
|
181057
181053
|
`#${escapeSelector(targetId)} .sample-tab.tab-pane.show.active`
|
|
181058
181054
|
);
|
|
@@ -181061,7 +181057,7 @@ const printSample = (id, targetId) => {
|
|
|
181061
181057
|
if (targetEl) {
|
|
181062
181058
|
const headingId = `sample-heading-${id}`;
|
|
181063
181059
|
const headingEl = document.getElementById(headingId);
|
|
181064
|
-
const headingHtml = printHeadingHtml();
|
|
181060
|
+
const headingHtml = printHeadingHtml(evalSpec);
|
|
181065
181061
|
const css2 = `
|
|
181066
181062
|
html { font-size: 9pt }
|
|
181067
181063
|
/* Allow content to break anywhere without any forced page breaks */
|
|
@@ -181074,13 +181070,6 @@ const printSample = (id, targetId) => {
|
|
|
181074
181070
|
page-break-after: auto;
|
|
181075
181071
|
}
|
|
181076
181072
|
/* Specifically disable all page breaks for divs */
|
|
181077
|
-
div {
|
|
181078
|
-
break-inside: auto;
|
|
181079
|
-
page-break-inside: auto;
|
|
181080
|
-
}
|
|
181081
|
-
body > .transcript-step {
|
|
181082
|
-
break-inside: avoid;
|
|
181083
|
-
}
|
|
181084
181073
|
body{
|
|
181085
181074
|
-webkit-print-color-adjust:exact !important;
|
|
181086
181075
|
print-color-adjust:exact !important;
|