Allow deleting specific HypaV3 summaries if orphaned
This commit is contained in:
@@ -800,6 +800,7 @@ export const languageChinese = {
|
||||
"noSummariesLabel": "尚无总结",
|
||||
"searchPlaceholder": "输入 #N、ID 或搜索关键词",
|
||||
"summaryNumberLabel": "总结 #{0}",
|
||||
"deleteThisConfirmMessage": "删除此摘要?",
|
||||
"deleteAfterConfirmMessage": "删除此后的所有总结?",
|
||||
"deleteAfterConfirmSecondMessage": "此操作无法撤销。您确定吗?",
|
||||
"translationLabel": "翻译",
|
||||
|
||||
@@ -464,6 +464,7 @@ export const languageGerman = {
|
||||
"noSummariesLabel": "Noch keine Zusammenfassungen",
|
||||
"searchPlaceholder": "Geben Sie #N, ID oder Suchanfrage ein",
|
||||
"summaryNumberLabel": "Zusammenfassung #{0}",
|
||||
"deleteThisConfirmMessage": "Diese Zusammenfassung löschen?",
|
||||
"deleteAfterConfirmMessage": "Alle Zusammenfassungen nach dieser löschen?",
|
||||
"deleteAfterConfirmSecondMessage": "Diese Aktion kann nicht rückgängig gemacht werden. Sind Sie wirklich sicher?",
|
||||
"translationLabel": "Übersetzung",
|
||||
|
||||
@@ -1036,6 +1036,7 @@ export const languageEnglish = {
|
||||
noSummariesLabel: "No summaries yet",
|
||||
searchPlaceholder: "Enter #N, ID, or query",
|
||||
summaryNumberLabel: "Summary #{0}",
|
||||
deleteThisConfirmMessage: "Delete this summary?",
|
||||
deleteAfterConfirmMessage: "Delete all summaries after this one?",
|
||||
deleteAfterConfirmSecondMessage: "This action cannot be undone. Are you really sure?",
|
||||
translationLabel: "Translation",
|
||||
|
||||
@@ -709,6 +709,7 @@ export const languageSpanish = {
|
||||
"noSummariesLabel": "Aún no hay resúmenes",
|
||||
"searchPlaceholder": "Ingrese #N, ID o búsqueda",
|
||||
"summaryNumberLabel": "Resumen #{0}",
|
||||
"deleteThisConfirmMessage": "¿Eliminar este resumen?",
|
||||
"deleteAfterConfirmMessage": "¿Eliminar todos los resúmenes después de este?",
|
||||
"deleteAfterConfirmSecondMessage": "Esta acción no se puede deshacer. ¿Está realmente seguro?",
|
||||
"translationLabel": "Traducción",
|
||||
|
||||
@@ -955,6 +955,7 @@ export const languageKorean = {
|
||||
"noSummariesLabel": "아직 요약이 없습니다",
|
||||
"searchPlaceholder": "#N, ID 또는 검색어 입력",
|
||||
"summaryNumberLabel": "요약 #{0}",
|
||||
"deleteThisConfirmMessage": "이 요약을 삭제하시겠습니까?",
|
||||
"deleteAfterConfirmMessage": "이 요약 이후의 모든 요약을 삭제하시겠습니까?",
|
||||
"deleteAfterConfirmSecondMessage": "이 작업은 되돌릴 수 없습니다. 정말 삭제하시겠습니까?",
|
||||
"translationLabel": "번역",
|
||||
|
||||
@@ -438,6 +438,7 @@ export const LanguageVietnamese = {
|
||||
"noSummariesLabel": "Chưa có tóm tắt nào",
|
||||
"searchPlaceholder": "Nhập #N, ID hoặc từ khóa",
|
||||
"summaryNumberLabel": "Tóm tắt #{0}",
|
||||
"deleteThisConfirmMessage": "Xóa bản tóm tắt này?",
|
||||
"deleteAfterConfirmMessage": "Xóa tất cả các tóm tắt sau tóm tắt này?",
|
||||
"deleteAfterConfirmSecondMessage": "Hành động này không thể hoàn tác. Bạn có chắc chắn không?",
|
||||
"translationLabel": "Bản dịch",
|
||||
|
||||
@@ -833,6 +833,7 @@ export const languageChineseTraditional = {
|
||||
"noSummariesLabel": "尚無摘要",
|
||||
"searchPlaceholder": "輸入 #N、ID 或搜尋關鍵字",
|
||||
"summaryNumberLabel": "摘要 #{0}",
|
||||
"deleteThisConfirmMessage": "刪除此摘要?",
|
||||
"deleteAfterConfirmMessage": "刪除此摘要之後的所有摘要?",
|
||||
"deleteAfterConfirmSecondMessage": "此操作無法撤銷。您確定要這樣做嗎?",
|
||||
"translationLabel": "翻譯",
|
||||
|
||||
@@ -404,23 +404,23 @@
|
||||
summaryUIState.isTranslating = false;
|
||||
}
|
||||
|
||||
function isRerollable(summaryIndex: number): boolean {
|
||||
function isOrphan(summaryIndex: number): boolean {
|
||||
const summary = hypaV3DataState.summaries[summaryIndex];
|
||||
|
||||
for (const chatMemo of summary.chatMemos) {
|
||||
if (!getMessageFromChatMemo(chatMemo)) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
async function toggleReroll(summaryIndex: number): Promise<void> {
|
||||
const summaryUIState = summaryUIStates[summaryIndex];
|
||||
|
||||
if (summaryUIState.isRerolling) return;
|
||||
if (!isRerollable(summaryIndex)) return;
|
||||
if (isOrphan(summaryIndex)) return;
|
||||
|
||||
summaryUIState.isRerolling = true;
|
||||
summaryUIState.rerolledText = "Loading...";
|
||||
@@ -1074,12 +1074,32 @@
|
||||
<button
|
||||
class="p-2 text-zinc-400 hover:text-zinc-200 transition-colors"
|
||||
tabindex="-1"
|
||||
disabled={!isRerollable(i)}
|
||||
disabled={isOrphan(i)}
|
||||
onclick={async () => await toggleReroll(i)}
|
||||
>
|
||||
<RefreshCw class="w-4 h-4" />
|
||||
</button>
|
||||
|
||||
<!-- Delete This Button -->
|
||||
<button
|
||||
class="p-2 text-zinc-400 hover:text-rose-300 transition-colors"
|
||||
tabindex="-1"
|
||||
disabled={!isOrphan(i)}
|
||||
onclick={async () => {
|
||||
if (
|
||||
await alertConfirm(language.hypaV3Modal.deleteThisConfirmMessage)
|
||||
) {
|
||||
hypaV3DataState.summaries = hypaV3DataState.summaries.filter(
|
||||
(_, index) => index !== i
|
||||
);
|
||||
}
|
||||
|
||||
showHypaV3Alert();
|
||||
}}
|
||||
>
|
||||
<Trash2Icon class="w-4 h-4" />
|
||||
</button>
|
||||
|
||||
<!-- Delete After Button -->
|
||||
<button
|
||||
class="p-2 text-zinc-400 hover:text-rose-300 transition-colors"
|
||||
|
||||
Reference in New Issue
Block a user