feat(hub): add archive quote AI coach review from inner light page
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -566,6 +566,9 @@
|
||||
'<button type="button" class="archive-del-btn archive-quote-del-btn" data-id="' +
|
||||
q.id +
|
||||
'">删除</button>' +
|
||||
'<button type="button" class="ghost archive-quote-ai-btn" data-id="' +
|
||||
q.id +
|
||||
'">AI对话</button>' +
|
||||
"</div></div>"
|
||||
: "") +
|
||||
"</div>"
|
||||
@@ -591,6 +594,12 @@
|
||||
void deleteQuote(btn.getAttribute("data-id"));
|
||||
});
|
||||
});
|
||||
elQuotesList.querySelectorAll(".archive-quote-ai-btn").forEach(function (btn) {
|
||||
btn.addEventListener("click", function (ev) {
|
||||
ev.stopPropagation();
|
||||
startQuoteAiChat(btn.getAttribute("data-id"));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function loadQuotes() {
|
||||
@@ -645,6 +654,34 @@
|
||||
setStatus("语录已保存");
|
||||
}
|
||||
|
||||
const ARCHIVE_QUOTE_AI_KEY = "hub_archive_quote_ai";
|
||||
|
||||
function startQuoteAiChat(quoteId) {
|
||||
const q = findQuote(quoteId);
|
||||
const content = q && String(q.content || "").trim();
|
||||
if (!q || !content) {
|
||||
setStatus("语录内容为空,无法发起 AI 对话");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
sessionStorage.setItem(
|
||||
ARCHIVE_QUOTE_AI_KEY,
|
||||
JSON.stringify({
|
||||
quote_date: q.quote_date || "",
|
||||
content: content,
|
||||
})
|
||||
);
|
||||
} catch (_) {
|
||||
setStatus("无法保存跳转数据");
|
||||
return;
|
||||
}
|
||||
if (typeof window.hubNavigateTo === "function") {
|
||||
window.hubNavigateTo("/ai");
|
||||
return;
|
||||
}
|
||||
location.href = "/ai";
|
||||
}
|
||||
|
||||
async function deleteQuote(id) {
|
||||
if (!id || !window.confirm("确定删除这条复盘语录?")) return;
|
||||
const r = await apiFetch("/api/archive/quotes/" + id, { method: "DELETE" });
|
||||
|
||||
Reference in New Issue
Block a user