diff --git a/app/src/ai/actions.ts b/app/src/ai/actions.ts
index 19622fdde..a906cb086 100644
--- a/app/src/ai/actions.ts
+++ b/app/src/ai/actions.ts
@@ -165,8 +165,8 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
focusByRange(protyle.toolbar.range);
});
let customHTML = "";
- window.siyuan.storage[Constants.LOCAL_AI].forEach((item: { name: string, memo: string }) => {
- customHTML += `
+ window.siyuan.storage[Constants.LOCAL_AI].forEach((item: { name: string, memo: string }, index: number) => {
+ customHTML += `
${escapeHtml(item.name)}
`;
@@ -251,7 +251,8 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
let target = event.target as HTMLElement;
while (target && !target.isSameNode(element)) {
if (target.classList.contains("b3-list-item__action")) {
- editDialog(target.previousElementSibling.textContent, target.parentElement.getAttribute("aria-label"));
+ const subItem = window.siyuan.storage[Constants.LOCAL_AI][target.parentElement.dataset.index]
+ editDialog(subItem.name, subItem.memo);
menu.close();
event.stopPropagation();
event.preventDefault();