Преглед изворни кода

fix: 问数会话删除按钮常显(原为悬停才现,几乎不可发现)+ 删除前二次确认(连带运行记录不可恢复)

KenZ1117 пре 2 недеља
родитељ
комит
120b2cb1dc
2 измењених фајлова са 6 додато и 3 уклоњено
  1. 3 0
      public/ask.js
  2. 3 3
      public/style.css

+ 3 - 0
public/ask.js

@@ -269,6 +269,9 @@
   }
 
   async function removeSession(sessionId) {
+    const meta = state.sessions.find((s) => s.sessionId === sessionId);
+    const label = String((meta && (meta.title || meta.lastQuestion)) || '该会话').slice(0, 24);
+    if (!window.confirm(`删除会话「${label}」?其全部运行记录将一并删除,不可恢复。`)) return;
     try {
       await jsonFetch(`/api/agent/sessions/${encodeURIComponent(sessionId)}?entity=${encodeURIComponent(state.entity)}`, { method: 'DELETE' });
     } catch { /* 删除失败不打扰 */ }

+ 3 - 3
public/style.css

@@ -976,10 +976,10 @@ main.content { padding: var(--page-padding-y) var(--page-padding-x) var(--page-p
 .ask-session-item.active { background: #fff7f3; border-color: #ffd9c7; }
 .ask-session-title { font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
 .ask-session-preview { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
-.ask-session-del { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border: none; border-radius: 6px; background: transparent; color: var(--text-3); cursor: pointer; display: none; align-items: center; justify-content: center; padding: 0; }
+.ask-session-del { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border: none; border-radius: 6px; background: transparent; color: var(--text-3); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; opacity: .4; }
 .ask-session-del svg { width: 13px; height: 13px; }
-.ask-session-item:hover .ask-session-del { display: inline-flex; }
-.ask-session-del:hover { background: #fdecec; color: var(--fail); }
+.ask-session-item:hover .ask-session-del { opacity: 1; }
+.ask-session-del:hover { background: #fdecec; color: var(--fail); opacity: 1; }
 
 /* 右侧舞台 */
 .ask-stage { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border-light); border-radius: 14px; }