fix: 允许删除内置块,仅保护兼容块

- 删除按钮 disabled 条件从 non-custom 改为 legacyPrompt
- 后端守卫同步更新,内置块可删除,兼容块禁止删除
This commit is contained in:
Youzini-afk
2026-03-25 22:27:52 +08:00
parent 88f29c2321
commit bc47dfd2e5

View File

@@ -2206,7 +2206,7 @@ function _renderTaskBlockListItem(block, index, state) {
data-task-action="delete-block"
data-block-id="${_escHtml(block.id)}"
type="button"
${block.type === "custom" ? "" : "disabled"}
${block.type === "legacyPrompt" ? "disabled" : ""}
>
删除
</button>
@@ -2661,8 +2661,8 @@ function _deleteTaskBlock(blockId) {
const index = blocks.findIndex((item) => item.id === blockId);
if (index < 0) return null;
const block = blocks[index];
if (block.type !== "custom") {
toastr.info("只有自定义块可以删除", "ST-BME");
if (block.type === "legacyPrompt") {
toastr.info("兼容块不可删除", "ST-BME");
return null;
}
blocks.splice(index, 1);