chore: rebuild CentOS7 release package
This commit is contained in:
@@ -9878,8 +9878,32 @@
|
||||
// --- Import Native Session Modal ---
|
||||
let _onNativeSessions = null;
|
||||
|
||||
function appendImportVisibilityToggle(body, options) {
|
||||
const hiddenCount = Number(options?.hiddenCount || 0);
|
||||
if (!body || hiddenCount <= 0) return;
|
||||
const row = document.createElement('label');
|
||||
row.className = 'import-filter-row';
|
||||
row.innerHTML = `
|
||||
<span class="import-filter-copy">
|
||||
<span class="import-filter-title">显示已导入会话</span>
|
||||
<span class="import-filter-meta">已隐藏 ${hiddenCount} 个 cc-web 已存在的会话</span>
|
||||
</span>
|
||||
<span class="settings-switch">
|
||||
<input type="checkbox" ${options.showImported ? 'checked' : ''}>
|
||||
<span class="settings-switch-track" aria-hidden="true">
|
||||
<span class="settings-switch-thumb"></span>
|
||||
</span>
|
||||
</span>
|
||||
`;
|
||||
const input = row.querySelector('input');
|
||||
input.addEventListener('change', () => options.onToggle(!!input.checked));
|
||||
body.appendChild(row);
|
||||
}
|
||||
|
||||
function showImportSessionModal() {
|
||||
if (currentAgent !== 'claude') return;
|
||||
let nativeGroups = [];
|
||||
let showImported = false;
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'modal-overlay';
|
||||
overlay.id = 'import-session-overlay';
|
||||
@@ -9907,15 +9931,40 @@
|
||||
overlay.querySelector('#is-close-btn').addEventListener('click', close);
|
||||
overlay.addEventListener('click', (e) => { if (e.target === overlay) close(); });
|
||||
|
||||
_onNativeSessions = (groups) => {
|
||||
function renderNativeSessions() {
|
||||
const body = overlay.querySelector('#is-body');
|
||||
if (!body) return;
|
||||
if (!groups || groups.length === 0) {
|
||||
if (!nativeGroups || nativeGroups.length === 0) {
|
||||
body.innerHTML = `${buildAgentContextCard('claude', '从 Claude 原生历史导入', '读取 ~/.claude/projects/ 下的会话文件,恢复对话文本与工具调用,并保留 Claude 侧续接上下文。')}<div class="modal-empty">未找到本地 CLI 会话</div>`;
|
||||
return;
|
||||
}
|
||||
body.innerHTML = buildAgentContextCard('claude', '从 Claude 原生历史导入', '读取 ~/.claude/projects/ 下的会话文件,恢复对话文本与工具调用,并保留 Claude 侧续接上下文。');
|
||||
for (const group of groups) {
|
||||
const hiddenCount = nativeGroups.reduce((sum, group) => (
|
||||
sum + (Array.isArray(group.sessions) ? group.sessions.filter((sess) => sess.alreadyImported).length : 0)
|
||||
), 0);
|
||||
appendImportVisibilityToggle(body, {
|
||||
hiddenCount,
|
||||
showImported,
|
||||
onToggle: (next) => {
|
||||
showImported = next;
|
||||
renderNativeSessions();
|
||||
},
|
||||
});
|
||||
|
||||
const visibleGroups = nativeGroups
|
||||
.map((group) => ({
|
||||
...group,
|
||||
sessions: showImported
|
||||
? (group.sessions || [])
|
||||
: (group.sessions || []).filter((sess) => !sess.alreadyImported),
|
||||
}))
|
||||
.filter((group) => group.sessions.length > 0);
|
||||
if (visibleGroups.length === 0) {
|
||||
body.insertAdjacentHTML('beforeend', `<div class="modal-empty">已隐藏 ${hiddenCount} 个已导入会话,打开上方开关可查看。</div>`);
|
||||
return;
|
||||
}
|
||||
|
||||
for (const group of visibleGroups) {
|
||||
const groupEl = document.createElement('div');
|
||||
groupEl.className = 'import-group';
|
||||
// Convert slug dir to readable path
|
||||
@@ -9959,6 +10008,11 @@
|
||||
}
|
||||
body.appendChild(groupEl);
|
||||
}
|
||||
}
|
||||
|
||||
_onNativeSessions = (groups) => {
|
||||
nativeGroups = Array.isArray(groups) ? groups : [];
|
||||
renderNativeSessions();
|
||||
};
|
||||
|
||||
send({ type: 'list_native_sessions' });
|
||||
@@ -9967,6 +10021,8 @@
|
||||
function showImportCodexSessionModal() {
|
||||
if (!isCodexLikeAgent(currentAgent)) return;
|
||||
const importAgent = currentAgent;
|
||||
let codexItems = [];
|
||||
let showImported = false;
|
||||
const label = AGENT_LABELS[importAgent] || 'Codex';
|
||||
const contextTitle = importAgent === 'codexapp'
|
||||
? '从 Codex App rollout 历史导入'
|
||||
@@ -10001,16 +10057,32 @@
|
||||
overlay.querySelector('#ics-close-btn').addEventListener('click', close);
|
||||
overlay.addEventListener('click', (e) => { if (e.target === overlay) close(); });
|
||||
|
||||
_onCodexSessions = (items) => {
|
||||
function renderCodexSessions() {
|
||||
const body = overlay.querySelector('#ics-body');
|
||||
if (!body) return;
|
||||
if (!items || items.length === 0) {
|
||||
if (!codexItems || codexItems.length === 0) {
|
||||
body.innerHTML = `${buildAgentContextCard(importAgent, contextTitle, contextCopy)}<div class="modal-empty">未找到本地 ${escapeHtml(label)} 会话</div>`;
|
||||
return;
|
||||
}
|
||||
|
||||
body.innerHTML = buildAgentContextCard(importAgent, contextTitle, contextCopy);
|
||||
items.forEach((sess) => {
|
||||
const hiddenCount = codexItems.filter((sess) => sess.alreadyImported).length;
|
||||
appendImportVisibilityToggle(body, {
|
||||
hiddenCount,
|
||||
showImported,
|
||||
onToggle: (next) => {
|
||||
showImported = next;
|
||||
renderCodexSessions();
|
||||
},
|
||||
});
|
||||
|
||||
const visibleItems = showImported ? codexItems : codexItems.filter((sess) => !sess.alreadyImported);
|
||||
if (visibleItems.length === 0) {
|
||||
body.insertAdjacentHTML('beforeend', `<div class="modal-empty">已隐藏 ${hiddenCount} 个已导入会话,打开上方开关可查看。</div>`);
|
||||
return;
|
||||
}
|
||||
|
||||
visibleItems.forEach((sess) => {
|
||||
const item = document.createElement('div');
|
||||
item.className = 'import-item';
|
||||
|
||||
@@ -10043,6 +10115,12 @@
|
||||
source.textContent = sess.source;
|
||||
tags.appendChild(source);
|
||||
}
|
||||
if ((sess.duplicateCount || 0) > 1) {
|
||||
const merged = document.createElement('span');
|
||||
merged.className = 'import-item-tag';
|
||||
merged.textContent = `合并 ${sess.duplicateCount} 条`;
|
||||
tags.appendChild(merged);
|
||||
}
|
||||
|
||||
info.appendChild(titleEl);
|
||||
info.appendChild(meta);
|
||||
@@ -10064,6 +10142,11 @@
|
||||
item.appendChild(btn);
|
||||
body.appendChild(item);
|
||||
});
|
||||
}
|
||||
|
||||
_onCodexSessions = (items) => {
|
||||
codexItems = Array.isArray(items) ? items : [];
|
||||
renderCodexSessions();
|
||||
};
|
||||
|
||||
send({ type: 'list_codex_sessions', agent: importAgent });
|
||||
|
||||
@@ -5396,6 +5396,33 @@ html[data-theme='coolvibe'] .settings-back:hover {
|
||||
}
|
||||
|
||||
/* === Import Session List === */
|
||||
.import-filter-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin: 12px 0 14px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 8px;
|
||||
background: var(--bg-secondary);
|
||||
cursor: pointer;
|
||||
}
|
||||
.import-filter-copy {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
}
|
||||
.import-filter-title {
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
.import-filter-meta {
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.import-group {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user