Remove duplicate session copy-header helpers after integration

This commit is contained in:
pewdiepie-archdaemon
2026-10-26 16:30:56 +00:00
parent e461a6b5c5
commit fdb2a330d9
-79
View File
@@ -122,85 +122,6 @@ async function _copyChatHeaderFor(s) {
});
}
// === copy-chat header (debug trace block) ===
function _toolSurfaceLabel(mode) {
const m = String(mode == null ? '' : mode).toLowerCase();
if (m === 'full') return 'Regular tools';
if (m === 'compact') return 'Ajax Compact';
if (m === 'spec') return 'Ajax Spec (router)';
if (m === 'none') return 'Tools off';
if (!m) return 'Auto';
return 'unknown';
}
function _formatJst(now) {
const jst = new Date(now.getTime() + 9 * 60 * 60 * 1000);
const p = (n) => String(n).padStart(2, '0');
return `${jst.getUTCFullYear()}-${p(jst.getUTCMonth() + 1)}-${p(jst.getUTCDate())} ${p(jst.getUTCHours())}:${p(jst.getUTCMinutes())}`;
}
function _buildCopyChatHeader(info) {
const version = info.version || 'unknown';
const build = info.build || 'unknown';
const commit = (info.sourceCommit || 'unknown').slice(0, 8);
const model = info.model || 'unknown';
const endpointUrl = info.endpointUrl || 'unknown';
const toolSurface = info.toolSurface || 'unknown';
const copiedAt = info.copiedAt ? _formatJst(info.copiedAt) : 'unknown';
const sessionId = info.sessionId || 'unknown';
return [
'--- Odysseus info ---',
`Odysseus: ${version} | Harness build: ${build} | Commit: ${commit}`,
`Model: ${model} @ ${endpointUrl} | Tool surface: ${toolSurface}`,
`Copied: ${copiedAt} JST | Session: ${sessionId}`,
'----------------------',
].join('\n');
}
// === end copy-chat header ===
async function _copyChatHeaderFor(s) {
let version = 'unknown';
let build = 'unknown';
let sourceCommit = 'unknown';
try {
const res = await fetch(`${API_BASE}/api/version`);
const v = await res.json();
if (v && typeof v === 'object') {
version = v.version || 'unknown';
build = v.build || 'unknown';
sourceCommit = v.source_commit || 'unknown';
}
} catch (_) {}
let toolSurface = 'unknown';
try {
const res = await fetch(`${API_BASE}/api/model-endpoints`);
if (res.ok) {
const eps = await res.json();
const list = Array.isArray(eps) ? eps : [];
const model = (s && s.model) || '';
const ep = list.find((x) => x && (
(s && s.endpoint_id != null && x.id === s.endpoint_id) ||
(s && s.endpoint_url && x.base_url === s.endpoint_url)
));
if (ep && ep.model_tool_modes && model) {
toolSurface = _toolSurfaceLabel(ep.model_tool_modes[model]);
}
}
} catch (_) {}
return _buildCopyChatHeader({
version,
build,
sourceCommit,
model: (s && s.model) || undefined,
endpointUrl: (s && s.endpoint_url) || undefined,
toolSurface,
sessionId: (s && s.id) || undefined,
copiedAt: new Date(),
});
}
function _shouldPreserveStartupComposer(msgInput) {
if (!msgInput || !msgInput.value) return false;
if (window.__odysseusComposerUserEdited) return true;