MCPcopy
hub / github.com/xcanwin/KeepChatGPT / buildConversationRecordFromPayload

Function buildConversationRecordFromPayload

KeepChatGPT.user.js:2045–2068  ·  view source on GitHub ↗
(
        payload,
        fallbackConversationId = "",
    )

Source from the content-addressed store, hash-verified

2043 };
2044
2045 const buildConversationRecordFromPayload = function (
2046 payload,
2047 fallbackConversationId = "",
2048 ) {
2049 if (!payload || typeof payload !== "object") {
2050 return null;
2051 }
2052 const conversationId =
2053 payload.conversation_id || payload.id || fallbackConversationId;
2054 const updateTime = normalizeConversationUpdateTime(
2055 payload.update_time || payload.create_time,
2056 );
2057 if (!conversationId || !updateTime) {
2058 return null;
2059 }
2060 const previewMessage = findConversationMessageForPreview(payload);
2061 return {
2062 id: conversationId,
2063 title: payload.title || "",
2064 update_time: updateTime,
2065 last: extractConversationPreview(previewMessage),
2066 model: extractConversationModel(previewMessage),
2067 };
2068 };
2069
2070 const extractConversationIdFromPageUrl = function () {
2071 const matched = location.pathname.match(

Callers 2

hookFetchFunction · 0.85

Tested by

no test coverage detected