Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel
2026-06-11 09:40:01 +08:00
parent cbf89f7088
commit 7cfb37fc9f
4 changed files with 28 additions and 12 deletions

View File

@@ -666,6 +666,10 @@
background: var(--b3-list-hover);
}
.agent-chat__model-menu .b3-menu__item--highlight {
background: var(--b3-list-hover);
}
.agent-chat__model-menu .b3-menu__item--current {
background: transparent;
}

View File

@@ -207,7 +207,16 @@ export class AgentChat extends Model {
this.modelTrigger.addEventListener("keydown", (e: KeyboardEvent) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
if (this.modelMenu) { this.closeModelMenu(); } else { this.openModelMenu(); }
if (this.modelMenu) {
const option = this.modelOptions[this.modelMenuIndex];
if (option) {
this.selectedModel = option.id;
this.updateModelLabel();
}
this.closeModelMenu();
} else {
this.openModelMenu();
}
} else if (e.key === "ArrowDown") {
e.preventDefault();
if (!this.modelMenu) { this.openModelMenu(); return; }
@@ -251,6 +260,7 @@ export class AgentChat extends Model {
this.modelMenu = menu;
this.updateModelMenuHighlight();
menu.addEventListener("click", (e: MouseEvent) => {
e.stopPropagation();
const item = (e.target as HTMLElement).closest(".agent-chat__model-item") as HTMLElement;
if (item) {
this.selectedModel = item.getAttribute("data-id") || this.selectedModel;
@@ -280,7 +290,7 @@ export class AgentChat extends Model {
if (!this.modelMenu) { return; }
const items = this.modelMenu.querySelectorAll(".agent-chat__model-item");
for (let i = 0; i < items.length; i++) {
items[i].classList.toggle("b3-menu__item--current", i === this.modelMenuIndex);
items[i].classList.toggle("b3-menu__item--highlight", i === this.modelMenuIndex);
}
const current = items[this.modelMenuIndex] as HTMLElement;
if (current) { current.scrollIntoView({ block: "nearest" }); }
@@ -1309,7 +1319,7 @@ export class AgentChat extends Model {
const rollbackBtn = el.querySelector(".agent-chat__snapshot-rollback") as HTMLButtonElement;
rollbackBtn.addEventListener("click", () => {
const confirmText = (L.rollbackConfirm || "Rollback cannot be undone").replace("${name}", L.dataSnapshot || "Snapshot").replace("${time}", shortID);
confirmDialog("⚠ " + (L.rollback || "Rollback"), confirmText, () => {
confirmDialog("⚠ " + (L.rollback || "Rollback"), confirmText, () => {
fetchPost("/api/repo/checkoutRepo", {id: snapshotID}, () => {});
});
});

View File

@@ -789,11 +789,6 @@ func VacuumDataIndex() {
func FullReindex(needResetScroll bool) {
util.PushEndlessProgress(Conf.language(35))
cache.ClearTreeCache()
cache.ClearDocsIAL()
cache.ClearBlocksIAL()
cache.ClearAVCache()
task.AppendTask(task.DatabaseIndexFull, fullReindex)
task.AppendTask(task.DatabaseIndexRef, IndexRefs)
go func() {
@@ -813,6 +808,11 @@ func FullReindexDirect() {
}
func fullReindex() {
cache.ClearTreeCache()
cache.ClearDocsIAL()
cache.ClearBlocksIAL()
cache.ClearAVCache()
pushSQLInsertBlocksFTSMsg, pushSQLDeleteBlocksMsg = true, true
defer func() {
sql.FlushQueue()

View File

@@ -1012,6 +1012,9 @@ func checkoutRepo(id string) {
syncEnabled := Conf.Sync.Enabled
Conf.Sync.Enabled = false
Conf.Save()
if syncEnabled {
util.PushMsg(Conf.Language(134), 0)
}
// 回滚快照时默认为当前数据创建一个快照
// When rolling back a snapshot, a snapshot is created for the current data by default https://github.com/siyuan-note/siyuan/issues/12470
@@ -1033,10 +1036,9 @@ func checkoutRepo(id string) {
}
FullReindexDirect()
if syncEnabled {
task.AppendAsyncTaskWithDelay(task.PushMsg, 7*time.Second, util.PushMsg, Conf.Language(134), 0)
}
time.Sleep(time.Second)
FlushTxQueue()
task.AppendAsyncTaskWithDelay(task.ReloadUI, 1*time.Second, util.ReloadUI)
return
}