@skydiveai/pi-server 0.1.0-beta.531 → 0.1.0-beta.564
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/dist/index.mjs +8 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1664,6 +1664,10 @@ async function loadHistoryIntoSession({ sm, messages, upToIdxExclusive, modelNam
|
|
|
1664
1664
|
}
|
|
1665
1665
|
}
|
|
1666
1666
|
}
|
|
1667
|
+
function messageTimestampMs(m) {
|
|
1668
|
+
const ts = m?.timestamp;
|
|
1669
|
+
return typeof ts === "number" && Number.isFinite(ts) ? ts : null;
|
|
1670
|
+
}
|
|
1667
1671
|
function piMessagesToOpenAI(messages) {
|
|
1668
1672
|
const out = [];
|
|
1669
1673
|
for (const m of messages) {
|
|
@@ -1692,6 +1696,8 @@ function piMessagesToOpenAI(messages) {
|
|
|
1692
1696
|
};
|
|
1693
1697
|
if (toolCalls.length) msg.tool_calls = toolCalls;
|
|
1694
1698
|
if (thinking.length) msg.x_thinking = thinking;
|
|
1699
|
+
const createdAtMs = messageTimestampMs(m);
|
|
1700
|
+
if (createdAtMs !== null) msg.x_created_at = createdAtMs;
|
|
1695
1701
|
out.push(msg);
|
|
1696
1702
|
continue;
|
|
1697
1703
|
}
|
|
@@ -1703,6 +1709,8 @@ function piMessagesToOpenAI(messages) {
|
|
|
1703
1709
|
content: text
|
|
1704
1710
|
};
|
|
1705
1711
|
if (m.isError) tm.x_is_error = true;
|
|
1712
|
+
const createdAtMs = messageTimestampMs(m);
|
|
1713
|
+
if (createdAtMs !== null) tm.x_created_at = createdAtMs;
|
|
1706
1714
|
out.push(tm);
|
|
1707
1715
|
continue;
|
|
1708
1716
|
}
|