fix: 修复标题归属并更新发布包
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
'use strict';
|
||||
|
||||
const ASSET_VERSION = '20260702-visible-no-rerender';
|
||||
const CURRENT_FRONTEND_ASSET_VERSION = normalizeFrontendAssetVersion(window.ccWebFrontendAssetVersion);
|
||||
let frontendAssetVersionReloadRequested = false;
|
||||
const WS_URL = `${location.protocol === 'https:' ? 'wss' : 'ws'}://${location.host}/ws`;
|
||||
const RENDER_DEBOUNCE = 100;
|
||||
const COMPOSER_SUGGESTION_DEBOUNCE = 120;
|
||||
@@ -88,6 +90,20 @@
|
||||
const SESSION_LOAD_OVERLAY_TIMEOUT_MS = 12_000;
|
||||
const SESSION_LOAD_REQUEST_TIMEOUT_MS = 45_000;
|
||||
const SESSION_RESUME_FALLBACK_MS = 1_500;
|
||||
|
||||
function normalizeFrontendAssetVersion(value) {
|
||||
const version = String(value || '').trim().toLowerCase();
|
||||
return /^[a-f0-9]{16,64}$/.test(version) ? version : '';
|
||||
}
|
||||
|
||||
function shouldReloadForFrontendAssetVersion(serverVersion, loadedVersion = CURRENT_FRONTEND_ASSET_VERSION) {
|
||||
const normalizedServerVersion = normalizeFrontendAssetVersion(serverVersion);
|
||||
const normalizedLoadedVersion = normalizeFrontendAssetVersion(loadedVersion);
|
||||
if (!normalizedServerVersion || !normalizedLoadedVersion) return false;
|
||||
if (normalizedServerVersion === normalizedLoadedVersion || frontendAssetVersionReloadRequested) return false;
|
||||
frontendAssetVersionReloadRequested = true;
|
||||
return true;
|
||||
}
|
||||
const PENDING_SLASH_DRAFT_LIMIT = 30;
|
||||
|
||||
const MODEL_OPTIONS = [
|
||||
@@ -1582,6 +1598,7 @@
|
||||
function buildUserOutlineTimelineItems(messageItems, titleHistory = []) {
|
||||
const timeline = [];
|
||||
const timelineMessages = [];
|
||||
const anchoredTitleEvents = new Map();
|
||||
(Array.isArray(messageItems) ? messageItems : []).forEach((message, order) => {
|
||||
const messageIndex = Number(message.messageIndex);
|
||||
const timestampMs = Date.parse(String(message.timestamp || ''));
|
||||
@@ -1609,7 +1626,7 @@
|
||||
}, null);
|
||||
const anchor = exactAnchor || precedingAnchor;
|
||||
const anchorMessageIndex = Number.isFinite(anchor?.messageIndex) ? anchor.messageIndex : null;
|
||||
timeline.push({
|
||||
const titleItem = {
|
||||
type: 'title',
|
||||
label: event.title,
|
||||
timestamp: anchor?.timestamp || event.changedAt,
|
||||
@@ -1620,8 +1637,14 @@
|
||||
sortPosition: anchorMessageIndex !== null ? anchorMessageIndex * 2 - 1 : event.messageIndex * 2 - 1,
|
||||
sortTime: Number.isFinite(timestampMs) ? timestampMs : null,
|
||||
sortOrder: order,
|
||||
});
|
||||
};
|
||||
if (anchorMessageIndex !== null) {
|
||||
anchoredTitleEvents.set(anchorMessageIndex, titleItem);
|
||||
} else {
|
||||
timeline.push(titleItem);
|
||||
}
|
||||
});
|
||||
anchoredTitleEvents.forEach((titleItem) => timeline.push(titleItem));
|
||||
timeline.sort((left, right) => {
|
||||
if (Number.isFinite(left.sortPosition) && Number.isFinite(right.sortPosition) && left.sortPosition !== right.sortPosition) {
|
||||
return left.sortPosition - right.sortPosition;
|
||||
@@ -6709,6 +6732,10 @@
|
||||
switch (msg.type) {
|
||||
case 'auth_result':
|
||||
if (msg.success) {
|
||||
if (shouldReloadForFrontendAssetVersion(msg.frontendAssetVersion)) {
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
const shouldLoadInitialSession = !initialSessionListHandled && !currentSessionId;
|
||||
authToken = msg.token;
|
||||
wsAuthenticated = true;
|
||||
|
||||
@@ -386,6 +386,7 @@
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.9.1/mermaid.min.js"></script>
|
||||
<script src="vendor/echarts.min.js?v=5.6.0"></script>
|
||||
<script src="app.js?v=20260805-usage-loading-inline"></script>
|
||||
<script>window.ccWebFrontendAssetVersion = '__CC_WEB_FRONTEND_ASSET_VERSION__';</script>
|
||||
<script src="app.js?v=__CC_WEB_FRONTEND_ASSET_VERSION__"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user