feat: add doNotSummarizeUserMessage option for HypaV3 and improve HypaV3 modal (#750)

# PR Checklist
- [x] Have you checked if it works normally in all models? *Ignore this
if it doesn't use models.*
- [x] Have you checked if it works normally in all web, local, and node
hosted versions? If it doesn't, have you blocked it in those versions?
- [x] Have you added type definitions?

# Description
This PR introduces following:
- Add doNotSummarizeUserMessage option to exclude user messages from
summarization
- Add early return logic to prevent unnecessary similarity checks when
summaries are empty
- Add length check before summarization
- Set to default settings when selecting HypaV3 on OtherBotSettings
- Add localization for HypaV3 settings and modal
- Change HypaV3 modal title
- Add import summary filtering and improve search in HypaV3
This commit is contained in:
kwaroran
2025-02-09 16:23:37 +09:00
committed by GitHub
11 changed files with 916 additions and 391 deletions

View File

@@ -770,5 +770,50 @@ export const languageChinese = {
"translatorPrompt": "翻译提示词",
"translateBeforeHTMLFormatting": "於 HTML 格式化前翻译",
"retranslate": "重新翻译",
"loading": "加载中"
}
"loading": "加载中",
"hypaV3Settings": {
"descriptionLabel": "HypaMemory V3 是一个使用总结和向量搜索的长期记忆系统。",
"supaMemoryPromptPlaceHolder": "留空以使用默认值",
"maxMemoryTokensRatioLabel": "最大记忆令牌比率(估计)",
"maxMemoryTokensRatioError": "无法计算最大记忆令牌比率",
"memoryTokensRatioLabel": "记忆令牌比率",
"extraSummarizationRatioLabel": "额外总结比率",
"maxChatsPerSummaryLabel": "每个总结的最大消息数",
"recentMemoryRatioLabel": "最近记忆比率",
"similarMemoryRatioLabel": "相似记忆比率",
"randomMemoryRatioLabel": "随机记忆比率",
"enableSimilarityCorrectionLabel": "启用相似度校正",
"preserveOrphanedMemoryLabel": "保留孤立记忆",
"applyRegexScriptWhenRerollingLabel": "重新生成时应用正则脚本",
"doNotSummarizeUserMessageLabel": "不要总结用户消息",
},
"hypaV3Modal": {
"titleLabel": "HypaV3",
"resetConfirmMessage": "此操作无法撤销。您要重置 HypaV3 数据吗?",
"resetConfirmSecondMessage": "此操作不可逆。您确实要重置 HypaV3 数据吗?",
"convertLabel": "尚无总结,但您可以将 HypaV2 数据转换为 V3。",
"convertButton": "转换为 V3",
"convertSuccessMessage": "成功将 HypaV2 数据转换为 V3",
"convertErrorMessage": "将 HypaV2 数据转换为 V3 失败:{0}",
"noSummariesLabel": "尚无总结",
"searchPlaceholder": "输入 #N、ID 或搜索关键词",
"summaryNumberLabel": "总结 #{0}",
"deleteAfterConfirmMessage": "删除此后的所有总结?",
"deleteAfterConfirmSecondMessage": "此操作无法撤销。您确定吗?",
"translationLabel": "翻译",
"rerolledSummaryLabel": "重新生成的总结",
"rerolledTranslationLabel": "重新生成的总结翻译",
"connectedMessageCountLabel": "关联消息 ({0})",
"connectedFirstMessageLabel": "第一条消息",
"connectedMessageRoleLabel": "{0} 的消息",
"connectedMessageNotFoundLabel": "未找到消息",
"connectedMessageLoadingError": "加载关联消息时出错:{0}",
"connectedMessageTranslationLabel": "翻译",
"nextSummarizationFirstMessageLabel": "第一条消息",
"nextSummarizationNoMessageIdLabel": "无消息 ID",
"nextSummarizationLabel": "HypaV3 将总结 [{0}]",
"nextSummarizationNoMessagesFoundLabel": "警告:未找到消息",
"nextSummarizationLoadingError": "加载下一个总结目标时出错:{0}",
"emptySelectedFirstMessageLabel": "警告:所选的第一条消息为空"
},
}

View File

@@ -435,4 +435,49 @@ export const languageGerman = {
appendNameNAI: "Namen an NAI anhängen",
customStopWords: "Benutzerdefinierte Stoppwörter",
useAdvancedEditor: "Erweiterten Editor verwenden",
"hypaV3Settings": {
"descriptionLabel": "HypaMemory V3 ist ein Langzeitgedächtnissystem, das sowohl Zusammenfassung als auch Vektorsuche verwendet.",
"supaMemoryPromptPlaceHolder": "Leer lassen für Standardeinstellung",
"maxMemoryTokensRatioLabel": "Maximales Gedächtnis-Token-Verhältnis (Geschätzt)",
"maxMemoryTokensRatioError": "Maximales Gedächtnis-Token-Verhältnis kann nicht berechnet werden",
"memoryTokensRatioLabel": "Gedächtnis-Token-Verhältnis",
"extraSummarizationRatioLabel": "Zusätzliches Zusammenfassungsverhältnis",
"maxChatsPerSummaryLabel": "Maximale Nachrichten pro Zusammenfassung",
"recentMemoryRatioLabel": "Verhältnis der jüngsten Erinnerungen",
"similarMemoryRatioLabel": "Verhältnis ähnlicher Erinnerungen",
"randomMemoryRatioLabel": "Verhältnis zufälliger Erinnerungen",
"enableSimilarityCorrectionLabel": "Ähnlichkeitskorrektur aktivieren",
"preserveOrphanedMemoryLabel": "Verwaiste Erinnerungen bewahren",
"applyRegexScriptWhenRerollingLabel": "Regex-Skript beim Neugenerieren anwenden",
"doNotSummarizeUserMessageLabel": "Benutzernachrichten nicht zusammenfassen",
},
"hypaV3Modal": {
"titleLabel": "HypaV3",
"resetConfirmMessage": "Diese Aktion kann nicht rückgängig gemacht werden. Möchten Sie die HypaV3-Daten zurücksetzen?",
"resetConfirmSecondMessage": "Diese Aktion ist unwiderruflich. Möchten Sie die HypaV3-Daten wirklich zurücksetzen?",
"convertLabel": "Noch keine Zusammenfassungen, aber Sie können HypaV2-Daten zu V3 konvertieren.",
"convertButton": "Zu V3 konvertieren",
"convertSuccessMessage": "HypaV2-Daten erfolgreich zu V3 konvertiert",
"convertErrorMessage": "Konvertierung von HypaV2 zu V3 fehlgeschlagen: {0}",
"noSummariesLabel": "Noch keine Zusammenfassungen",
"searchPlaceholder": "Geben Sie #N, ID oder Suchanfrage ein",
"summaryNumberLabel": "Zusammenfassung #{0}",
"deleteAfterConfirmMessage": "Alle Zusammenfassungen nach dieser löschen?",
"deleteAfterConfirmSecondMessage": "Diese Aktion kann nicht rückgängig gemacht werden. Sind Sie wirklich sicher?",
"translationLabel": "Übersetzung",
"rerolledSummaryLabel": "Neu generierte Zusammenfassung",
"rerolledTranslationLabel": "Übersetzung der neu generierten Zusammenfassung",
"connectedMessageCountLabel": "Verbundene Nachrichten ({0})",
"connectedFirstMessageLabel": "Erste Nachricht",
"connectedMessageRoleLabel": "Nachricht von {0}",
"connectedMessageNotFoundLabel": "Nachricht nicht gefunden",
"connectedMessageLoadingError": "Fehler beim Laden der verbundenen Nachricht: {0}",
"connectedMessageTranslationLabel": "Übersetzung",
"nextSummarizationFirstMessageLabel": "Erste Nachricht",
"nextSummarizationNoMessageIdLabel": "Keine Nachrichten-ID",
"nextSummarizationLabel": "HypaV3 wird [{0}] zusammenfassen",
"nextSummarizationNoMessagesFoundLabel": "WARNUNG: Keine Nachrichten gefunden",
"nextSummarizationLoadingError": "Fehler beim Laden des nächsten Zusammenfassungsziels: {0}",
"emptySelectedFirstMessageLabel": "WARNUNG: Ausgewählte erste Nachricht ist leer"
},
}

View File

@@ -841,6 +841,50 @@ export const languageEnglish = {
banCharacterset: 'Auto Regenerate On Characterset',
checkCorruption: "Check Corruption",
showPromptComparison: "Show Prompt Comparison",
hypaV3Desc: "HypaMemory V3 is a long-term memory system that use both summarized data and vector search.",
inlayErrorResponse: "Inlay Error Response",
}
hypaV3Settings: {
descriptionLabel: "HypaMemory V3 is a long-term memory system that uses both summarization and vector search.",
supaMemoryPromptPlaceHolder: "Leave it blank to use default",
maxMemoryTokensRatioLabel: "Max Memory Tokens Ratio (Estimated)",
maxMemoryTokensRatioError: "Unable to calculate Max Memory Tokens Ratio",
memoryTokensRatioLabel: "Memory Tokens Ratio",
extraSummarizationRatioLabel: "Extra Summarization Ratio",
maxChatsPerSummaryLabel: "Max Messages Per Summary",
recentMemoryRatioLabel: "Recent Memory Ratio",
similarMemoryRatioLabel: "Similar Memory Ratio",
randomMemoryRatioLabel: "Random Memory Ratio",
enableSimilarityCorrectionLabel: "Enable Similarity Correction",
preserveOrphanedMemoryLabel: "Preserve Orphaned Memory",
applyRegexScriptWhenRerollingLabel: "Apply Regex Script When Rerolling",
doNotSummarizeUserMessageLabel: "Do Not Summarize User Message",
},
hypaV3Modal: {
titleLabel: "HypaV3",
resetConfirmMessage: "This action cannot be undone. Do you want to reset HypaV3 data?",
resetConfirmSecondMessage: "This action is irreversible. Do you really, really want to reset HypaV3 data?",
convertLabel: "No summaries yet, but you may convert HypaV2 data to V3.",
convertButton: "Convert to V3",
convertSuccessMessage: "Successfully converted HypaV2 data to V3",
convertErrorMessage: "Failed to convert HypaV2 data to V3: {0}",
noSummariesLabel: "No summaries yet",
searchPlaceholder: "Enter #N, ID, or query",
summaryNumberLabel: "Summary #{0}",
deleteAfterConfirmMessage: "Delete all summaries after this one?",
deleteAfterConfirmSecondMessage: "This action cannot be undone. Are you really sure?",
translationLabel: "Translation",
rerolledSummaryLabel: "Rerolled Summary",
rerolledTranslationLabel: "Rerolled Summary Translation",
connectedMessageCountLabel: "Connected Messages ({0})",
connectedFirstMessageLabel: "First Message",
connectedMessageRoleLabel: "{0}'s Message",
connectedMessageNotFoundLabel: "Message not found",
connectedMessageLoadingError: "Error loading connected message: {0}",
connectedMessageTranslationLabel: "Translation",
nextSummarizationFirstMessageLabel: "First Message",
nextSummarizationNoMessageIdLabel: "No Message ID",
nextSummarizationLabel: "HypaV3 will summarize [{0}]",
nextSummarizationNoMessagesFoundLabel: "WARN: No messages found",
nextSummarizationLoadingError: "Error loading next summarization target: {0}",
emptySelectedFirstMessageLabel: "WARN: Selected first message is empty",
},
}

View File

@@ -680,4 +680,49 @@ export const languageSpanish = {
parameters: "Parámetros",
sizeAndSpeed: "Tamaño y Velocidad",
useLegacyGUI: "Usar Interfaz Legacy",
"hypaV3Settings": {
"descriptionLabel": "HypaMemory V3 es un sistema de memoria a largo plazo que utiliza tanto resúmenes como búsqueda vectorial.",
"supaMemoryPromptPlaceHolder": "Dejar en blanco para usar el valor predeterminado",
"maxMemoryTokensRatioLabel": "Ratio Máximo de Tokens de Memoria (Estimado)",
"maxMemoryTokensRatioError": "No se puede calcular el ratio máximo de tokens de memoria",
"memoryTokensRatioLabel": "Ratio de Tokens de Memoria",
"extraSummarizationRatioLabel": "Ratio de Resumen Adicional",
"maxChatsPerSummaryLabel": "Mensajes Máximos por Resumen",
"recentMemoryRatioLabel": "Ratio de Memoria Reciente",
"similarMemoryRatioLabel": "Ratio de Memoria Similar",
"randomMemoryRatioLabel": "Ratio de Memoria Aleatoria",
"enableSimilarityCorrectionLabel": "Activar Corrección de Similitud",
"preserveOrphanedMemoryLabel": "Preservar Memoria Huérfana",
"applyRegexScriptWhenRerollingLabel": "Aplicar Script Regex al Regenerar",
"doNotSummarizeUserMessageLabel": "No Resumir Mensajes del Usuario",
},
"hypaV3Modal": {
"titleLabel": "HypaV3",
"resetConfirmMessage": "Esta acción no se puede deshacer. ¿Desea restablecer los datos de HypaV3?",
"resetConfirmSecondMessage": "Esta acción es irreversible. ¿Está realmente seguro de querer restablecer los datos de HypaV3?",
"convertLabel": "Aún no hay resúmenes, pero puede convertir datos de HypaV2 a V3.",
"convertButton": "Convertir a V3",
"convertSuccessMessage": "Datos de HypaV2 convertidos exitosamente a V3",
"convertErrorMessage": "Error al convertir datos de HypaV2 a V3: {0}",
"noSummariesLabel": "Aún no hay resúmenes",
"searchPlaceholder": "Ingrese #N, ID o búsqueda",
"summaryNumberLabel": "Resumen #{0}",
"deleteAfterConfirmMessage": "¿Eliminar todos los resúmenes después de este?",
"deleteAfterConfirmSecondMessage": "Esta acción no se puede deshacer. ¿Está realmente seguro?",
"translationLabel": "Traducción",
"rerolledSummaryLabel": "Resumen Regenerado",
"rerolledTranslationLabel": "Traducción del Resumen Regenerado",
"connectedMessageCountLabel": "Mensajes Conectados ({0})",
"connectedFirstMessageLabel": "Primer Mensaje",
"connectedMessageRoleLabel": "Mensaje de {0}",
"connectedMessageNotFoundLabel": "Mensaje no encontrado",
"connectedMessageLoadingError": "Error al cargar mensaje conectado: {0}",
"connectedMessageTranslationLabel": "Traducción",
"nextSummarizationFirstMessageLabel": "Primer Mensaje",
"nextSummarizationNoMessageIdLabel": "Sin ID de Mensaje",
"nextSummarizationLabel": "HypaV3 resumirá [{0}]",
"nextSummarizationNoMessagesFoundLabel": "ADVERTENCIA: No se encontraron mensajes",
"nextSummarizationLoadingError": "Error al cargar el siguiente objetivo de resumen: {0}",
"emptySelectedFirstMessageLabel": "ADVERTENCIA: El primer mensaje seleccionado está vacío"
},
}

View File

@@ -767,4 +767,49 @@ export const languageKorean = {
"translateBeforeHTMLFormatting": "HTML 포맷 전 번역",
"retranslate": "다시 번역",
"loading": "로딩중",
}
"hypaV3Settings": {
"descriptionLabel": "HypaMemory V3는 요약과 벡터 검색을 모두 사용하는 장기 기억 시스템입니다.",
"supaMemoryPromptPlaceHolder": "기본값을 사용하려면 비워두세요",
"maxMemoryTokensRatioLabel": "최대 메모리 토큰 비율 (추정)",
"maxMemoryTokensRatioError": "최대 메모리 토큰 비율을 계산할 수 없습니다",
"memoryTokensRatioLabel": "메모리 토큰 비율",
"extraSummarizationRatioLabel": "추가 요약 비율",
"maxChatsPerSummaryLabel": "요약당 최대 메시지 수",
"recentMemoryRatioLabel": "최근 메모리 비율",
"similarMemoryRatioLabel": "유사 메모리 비율",
"randomMemoryRatioLabel": "무작위 메모리 비율",
"enableSimilarityCorrectionLabel": "유사도 보정 활성화",
"preserveOrphanedMemoryLabel": "고아 메모리 보존",
"applyRegexScriptWhenRerollingLabel": "재생성 시 정규식 스크립트 적용",
"doNotSummarizeUserMessageLabel": "유저 메시지 요약하지 않기",
},
"hypaV3Modal": {
"titleLabel": "HypaV3",
"resetConfirmMessage": "이 작업은 되돌릴 수 없습니다. HypaV3 데이터를 초기화하시겠습니까?",
"resetConfirmSecondMessage": "이 작업은 복구할 수 없습니다. 정말로, 정말로 HypaV3 데이터를 초기화하시겠습니까?",
"convertLabel": "아직 요약이 없지만, HypaV2 데이터를 V3로 변환할 수 있습니다.",
"convertButton": "V3로 변환",
"convertSuccessMessage": "HypaV2 데이터를 V3로 성공적으로 변환했습니다",
"convertErrorMessage": "HypaV2 데이터를 V3로 변환하는데 실패했습니다: {0}",
"noSummariesLabel": "아직 요약이 없습니다",
"searchPlaceholder": "#N, ID 또는 검색어 입력",
"summaryNumberLabel": "요약 #{0}",
"deleteAfterConfirmMessage": "이 요약 이후의 모든 요약을 삭제하시겠습니까?",
"deleteAfterConfirmSecondMessage": "이 작업은 되돌릴 수 없습니다. 정말 삭제하시겠습니까?",
"translationLabel": "번역",
"rerolledSummaryLabel": "재생성된 요약",
"rerolledTranslationLabel": "재생성된 요약 번역",
"connectedMessageCountLabel": "연결된 메시지 ({0})",
"connectedFirstMessageLabel": "첫 메시지",
"connectedMessageRoleLabel": "{0}의 메시지",
"connectedMessageNotFoundLabel": "메시지를 찾을 수 없습니다",
"connectedMessageLoadingError": "연결된 메시지를 불러오는 동안 오류 발생: {0}",
"connectedMessageTranslationLabel": "번역",
"nextSummarizationFirstMessageLabel": "첫 메시지",
"nextSummarizationNoMessageIdLabel": "메시지 ID 없음",
"nextSummarizationLabel": "HypaV3가 [{0}]를 요약할 예정입니다",
"nextSummarizationNoMessagesFoundLabel": "경고: 메시지를 찾을 수 없습니다",
"nextSummarizationLoadingError": "다음 요약 대상을 불러오는 동안 오류 발생: {0}",
"emptySelectedFirstMessageLabel": "경고: 선택된 첫 메시지가 비어있습니다"
},
}

View File

@@ -409,4 +409,49 @@ export const LanguageVietnamese = {
module: "Mô-đun",
modules: "Mô-đun",
useAdvancedEditor: "Sử dụng trình biên tập nâng cao",
}
"hypaV3Settings": {
"descriptionLabel": "HypaMemory V3 là hệ thống bộ nhớ dài hạn sử dụng cả tóm tắt và tìm kiếm vector.",
"supaMemoryPromptPlaceHolder": "Để trống để sử dụng giá trị mặc định",
"maxMemoryTokensRatioLabel": "Tỷ lệ Token Bộ nhớ Tối đa (Ước tính)",
"maxMemoryTokensRatioError": "Không thể tính toán Tỷ lệ Token Bộ nhớ Tối đa",
"memoryTokensRatioLabel": "Tỷ lệ Token Bộ nhớ",
"extraSummarizationRatioLabel": "Tỷ lệ Tóm tắt Bổ sung",
"maxChatsPerSummaryLabel": "Số Tin nhắn Tối đa cho mỗi Tóm tắt",
"recentMemoryRatioLabel": "Tỷ lệ Bộ nhớ Gần đây",
"similarMemoryRatioLabel": "Tỷ lệ Bộ nhớ Tương tự",
"randomMemoryRatioLabel": "Tỷ lệ Bộ nhớ Ngẫu nhiên",
"enableSimilarityCorrectionLabel": "Bật Hiệu chỉnh Độ tương tự",
"preserveOrphanedMemoryLabel": "Giữ Bộ nhớ Mồ côi",
"applyRegexScriptWhenRerollingLabel": "Áp dụng Script Regex khi Tạo lại",
"doNotSummarizeUserMessageLabel": "Không Tóm tắt Tin nhắn Người dùng",
},
"hypaV3Modal": {
"titleLabel": "HypaV3",
"resetConfirmMessage": "Hành động này không thể hoàn tác. Bạn có muốn đặt lại dữ liệu HypaV3 không?",
"resetConfirmSecondMessage": "Hành động này không thể khôi phục. Bạn có thực sự chắc chắn muốn đặt lại dữ liệu HypaV3 không?",
"convertLabel": "Chưa có tóm tắt nào, nhưng bạn có thể chuyển đổi dữ liệu HypaV2 sang V3.",
"convertButton": "Chuyển đổi sang V3",
"convertSuccessMessage": "Đã chuyển đổi thành công dữ liệu HypaV2 sang V3",
"convertErrorMessage": "Chuyển đổi dữ liệu HypaV2 sang V3 thất bại: {0}",
"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}",
"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",
"rerolledSummaryLabel": "Tóm tắt đã Tạo lại",
"rerolledTranslationLabel": "Bản dịch Tóm tắt đã Tạo lại",
"connectedMessageCountLabel": "Tin nhắn Liên kết ({0})",
"connectedFirstMessageLabel": "Tin nhắn Đầu tiên",
"connectedMessageRoleLabel": "Tin nhắn của {0}",
"connectedMessageNotFoundLabel": "Không tìm thấy tin nhắn",
"connectedMessageLoadingError": "Lỗi khi tải tin nhắn liên kết: {0}",
"connectedMessageTranslationLabel": "Bản dịch",
"nextSummarizationFirstMessageLabel": "Tin nhắn Đầu tiên",
"nextSummarizationNoMessageIdLabel": "Không có ID Tin nhắn",
"nextSummarizationLabel": "HypaV3 sẽ tóm tắt [{0}]",
"nextSummarizationNoMessagesFoundLabel": "CẢNH BÁO: Không tìm thấy tin nhắn",
"nextSummarizationLoadingError": "Lỗi khi tải mục tiêu tóm tắt tiếp theo: {0}",
"emptySelectedFirstMessageLabel": "CẢNH BÁO: Tin nhắn đầu tiên được chọn trống"
},
}

View File

@@ -802,7 +802,51 @@ export const languageChineseTraditional = {
"banCharacterset": "自動重新生成字符集",
"checkCorruption": "檢查損壞",
"showPromptComparison": "顯示提示比較",
"hypaV3Desc": "HypaMemory V3 是一個長期記憶系統,使用摘要資料和向量搜尋。",
"inlayErrorResponse": "嵌入錯誤回應",
"APIPool": "API 工具"
"APIPool": "API 工具",
"hypaV3Settings": {
"descriptionLabel": "HypaMemory V3 是一個使用摘要和向量搜索的長期記憶系統。",
"supaMemoryPromptPlaceHolder": "留空以使用預設值",
"maxMemoryTokensRatioLabel": "最大記憶標記比率(估計)",
"maxMemoryTokensRatioError": "無法計算最大記憶標記比率",
"memoryTokensRatioLabel": "記憶標記比率",
"extraSummarizationRatioLabel": "額外摘要比率",
"maxChatsPerSummaryLabel": "每個摘要的最大訊息數",
"recentMemoryRatioLabel": "最近記憶比率",
"similarMemoryRatioLabel": "相似記憶比率",
"randomMemoryRatioLabel": "隨機記憶比率",
"enableSimilarityCorrectionLabel": "啟用相似度校正",
"preserveOrphanedMemoryLabel": "保留孤立記憶",
"applyRegexScriptWhenRerollingLabel": "重新生成時應用正則表達式腳本",
"doNotSummarizeUserMessageLabel": "不要摘要用戶訊息"
},
"hypaV3Modal": {
"titleLabel": "HypaV3 數據",
"resetConfirmMessage": "此操作無法撤銷。您要重置 HypaV3 數據嗎?",
"resetConfirmSecondMessage": "此操作不可逆。您真的確定要重置 HypaV3 數據嗎?",
"convertLabel": "尚無摘要,但您可以將 HypaV2 數據轉換為 V3。",
"convertButton": "轉換為 V3",
"convertSuccessMessage": "成功將 HypaV2 數據轉換為 V3",
"convertErrorMessage": "無法將 HypaV2 數據轉換為 V3{0}",
"noSummariesLabel": "尚無摘要",
"searchPlaceholder": "輸入 #N、ID 或搜尋關鍵字",
"summaryNumberLabel": "摘要 #{0}",
"deleteAfterConfirmMessage": "刪除此摘要之後的所有摘要?",
"deleteAfterConfirmSecondMessage": "此操作無法撤銷。您確定要這樣做嗎?",
"translationLabel": "翻譯",
"rerolledSummaryLabel": "重新生成的摘要",
"rerolledTranslationLabel": "重新生成的摘要翻譯",
"connectedMessageCountLabel": "關聯訊息({0}",
"connectedFirstMessageLabel": "第一條訊息",
"connectedMessageRoleLabel": "{0} 的訊息",
"connectedMessageNotFoundLabel": "找不到訊息",
"connectedMessageLoadingError": "載入關聯訊息時出錯:{0}",
"connectedMessageTranslationLabel": "翻譯",
"nextSummarizationFirstMessageLabel": "第一條訊息",
"nextSummarizationNoMessageIdLabel": "無訊息 ID",
"nextSummarizationLabel": "HypaV3 將摘要 [{0}]",
"nextSummarizationNoMessagesFoundLabel": "警告:找不到訊息",
"nextSummarizationLoadingError": "載入下一個摘要目標時出錯:{0}",
"emptySelectedFirstMessageLabel": "警告:選定的第一條訊息為空"
},
}

File diff suppressed because it is too large Load Diff

View File

@@ -467,6 +467,15 @@
DBState.db.hypav2 = false
DBState.db.hanuraiEnable = false
DBState.db.hypaV3 = true
DBState.db.hypaV3Settings.memoryTokensRatio = 0.2
DBState.db.hypaV3Settings.extraSummarizationRatio = 0
DBState.db.hypaV3Settings.maxChatsPerSummary = 4
DBState.db.hypaV3Settings.recentMemoryRatio = 0.4
DBState.db.hypaV3Settings.similarMemoryRatio = 0.4
DBState.db.hypaV3Settings.enableSimilarityCorrection = false
DBState.db.hypaV3Settings.preserveOrphanedMemory = false
DBState.db.hypaV3Settings.processRegexScript = false
DBState.db.hypaV3Settings.doNotSummarizeUserMessage = false
} else {
DBState.db.supaModelType = 'none'
DBState.db.memoryAlgorithmType = 'none'
@@ -508,47 +517,46 @@
<span class="text-textcolor">{language.hypaAllocatedTokens}</span>
<NumberInput size="sm" marginBottom bind:value={DBState.db.hypaAllocatedTokens} min={100} />
{:else if DBState.db.hypaV3}
<span class="mb-2 text-textcolor2 text-sm text-wrap break-words max-w-full">{language.hypaV3Desc}</span>
<span class="mb-2 text-textcolor2 text-sm text-wrap break-words max-w-full">{language.hypaV3Settings.descriptionLabel}</span>
<span class="text-textcolor mt-4">{language.SuperMemory} {language.model}</span>
<SelectInput className="mt-2 mb-2" bind:value={DBState.db.supaModelType}>
<OptionInput value="distilbart">distilbart-cnn-6-6 (Free/Local)</OptionInput>
<OptionInput value="subModel">{language.submodel}</OptionInput>
</SelectInput>
{#if DBState.db.supaModelType === "instruct35"}
<span class="text-textcolor">OpenAI API Key</span>
<TextInput marginBottom size="sm" bind:value={DBState.db.supaMemoryKey} />
{/if}
<span class="text-textcolor">{language.summarizationPrompt} <Help key="summarizationPrompt"/></span>
<div class="mb-2">
<TextAreaInput size="sm" placeholder="Leave it blank to use default" bind:value={DBState.db.supaMemoryPrompt} />
<TextAreaInput size="sm" placeholder={language.hypaV3Settings.supaMemoryPromptPlaceHolder} bind:value={DBState.db.supaMemoryPrompt} />
</div>
<span class="text-textcolor">Max Memory Tokens Ratio (Estimated)</span>
{#await getMaxMemoryRatio() then maxMemoryRatio}
<span class="text-textcolor">{language.hypaV3Settings.maxMemoryTokensRatioLabel}</span>
<NumberInput marginBottom disabled size="sm" value={maxMemoryRatio} />
{:catch error}
<span class="text-textcolor">{error}</span>
<span class="text-red-400">{language.hypaV3Settings.maxMemoryTokensRatioError}</span>
{/await}
<span class="text-textcolor">Memory Tokens Ratio</span>
<span class="text-textcolor">{language.hypaV3Settings.memoryTokensRatioLabel}</span>
<SliderInput marginBottom min={0} max={1} step={0.01} fixed={2} bind:value={DBState.db.hypaV3Settings.memoryTokensRatio} />
<span class="text-textcolor">Extra Summarization Ratio</span>
<span class="text-textcolor">{language.hypaV3Settings.extraSummarizationRatioLabel}</span>
<SliderInput marginBottom min={0} max={1 - DBState.db.hypaV3Settings.memoryTokensRatio} step={0.01} fixed={2} bind:value={DBState.db.hypaV3Settings.extraSummarizationRatio} />
<span class="text-textcolor">Max Chats Per Summary</span>
<span class="text-textcolor">{language.hypaV3Settings.maxChatsPerSummaryLabel}</span>
<NumberInput marginBottom size="sm" min={1} bind:value={DBState.db.hypaV3Settings.maxChatsPerSummary} />
<span class="text-textcolor">Recent Memory Ratio</span>
<span class="text-textcolor">{language.hypaV3Settings.recentMemoryRatioLabel}</span>
<SliderInput marginBottom min={0} max={1} step={0.01} fixed={2} bind:value={DBState.db.hypaV3Settings.recentMemoryRatio} />
<span class="text-textcolor">Similar Memory Ratio</span>
<span class="text-textcolor">{language.hypaV3Settings.similarMemoryRatioLabel}</span>
<SliderInput marginBottom min={0} max={1} step={0.01} fixed={2} bind:value={DBState.db.hypaV3Settings.similarMemoryRatio} />
<span class="text-textcolor">Random Memory Ratio</span>
<span class="text-textcolor">{language.hypaV3Settings.randomMemoryRatioLabel}</span>
<NumberInput marginBottom disabled size="sm" value={parseFloat((1 - DBState.db.hypaV3Settings.recentMemoryRatio - DBState.db.hypaV3Settings.similarMemoryRatio).toFixed(2))} />
<div class="flex mb-2">
<Check name="Enable Similarity Correction" bind:check={DBState.db.hypaV3Settings.enableSimilarityCorrection} />
<Check name={language.hypaV3Settings.enableSimilarityCorrectionLabel} bind:check={DBState.db.hypaV3Settings.enableSimilarityCorrection} />
</div>
<div class="flex mb-2">
<Check name="Preserve Orphaned Memory" bind:check={DBState.db.hypaV3Settings.preserveOrphanedMemory} />
<Check name={language.hypaV3Settings.preserveOrphanedMemoryLabel} bind:check={DBState.db.hypaV3Settings.preserveOrphanedMemory} />
</div>
<div class="flex mb-2">
<Check name="Process Regex Script (Reroll Only)" bind:check={DBState.db.hypaV3Settings.processRegexScript} />
</div>
<Check name={language.hypaV3Settings.applyRegexScriptWhenRerollingLabel} bind:check={DBState.db.hypaV3Settings.processRegexScript} />
</div>
<div class="flex mb-2">
<Check name={language.hypaV3Settings.doNotSummarizeUserMessageLabel} bind:check={DBState.db.hypaV3Settings.doNotSummarizeUserMessage} />
</div>
{:else if (DBState.db.supaModelType !== 'none' && DBState.db.hypav2 === false && DBState.db.hypaV3 === false)}
<span class="mb-2 text-textcolor2 text-sm text-wrap break-words max-w-full">{language.supaDesc}</span>
<span class="text-textcolor mt-4">{language.SuperMemory} {language.model}</span>

View File

@@ -421,6 +421,12 @@ export async function hypaMemoryV3(
continue;
}
if (db.hypaV3Settings.doNotSummarizeUserMessage && chat.role === "user") {
console.log(`[HypaV3] Skipping user role at index ${i}`);
continue;
}
toSummarize.push(chat);
}
@@ -436,23 +442,25 @@ export async function hypaMemoryV3(
}
// Attempt summarization
const summarizeResult = await retryableSummarize(toSummarize);
if (toSummarize.length > 0) {
const summarizeResult = await retryableSummarize(toSummarize);
if (!summarizeResult.success) {
return {
currentTokens,
chats,
error: `[HypaV3] Summarization failed after maximum retries: ${summarizeResult.data}`,
memory: toSerializableHypaV3Data(data),
};
if (!summarizeResult.success) {
return {
currentTokens,
chats,
error: `[HypaV3] Summarization failed after maximum retries: ${summarizeResult.data}`,
memory: toSerializableHypaV3Data(data),
};
}
data.summaries.push({
text: summarizeResult.data,
chatMemos: new Set(toSummarize.map((chat) => chat.memo)),
isImportant: false,
});
}
data.summaries.push({
text: summarizeResult.data,
chatMemos: new Set(toSummarize.map((chat) => chat.memo)),
isImportant: false,
});
currentTokens -= toSummarizeTokens;
startIdx = endIdx;
}
@@ -469,6 +477,37 @@ export async function hypaMemoryV3(
availableMemoryTokens
);
// Early return if no summaries
if (data.summaries.length === 0) {
// Generate final memory prompt
const memory = encapsulateMemoryPrompt("");
const newChats: OpenAIChat[] = [
{
role: "system",
content: memory,
memo: "supaMemory",
},
...chats.slice(startIdx),
];
console.log(
"[HypaV3] Exiting function:",
"\nCurrent Tokens:",
currentTokens,
"\nAll chats, including memory prompt:",
newChats,
"\nMemory Data:",
data
);
return {
currentTokens,
chats: newChats,
memory: toSerializableHypaV3Data(data),
};
}
const selectedSummaries: Summary[] = [];
const randomMemoryRatio =
1 -

View File

@@ -474,13 +474,14 @@ export function setDatabase(data:Database){
data.reasoningEffort ??= 0
data.hypaV3Settings = {
memoryTokensRatio: data.hypaV3Settings?.memoryTokensRatio ?? 0.2,
extraSummarizationRatio: data.hypaV3Settings?.extraSummarizationRatio ?? 0.2,
extraSummarizationRatio: data.hypaV3Settings?.extraSummarizationRatio ?? 0,
maxChatsPerSummary: data.hypaV3Settings?.maxChatsPerSummary ?? 4,
recentMemoryRatio: data.hypaV3Settings?.recentMemoryRatio ?? 0.4,
similarMemoryRatio: data.hypaV3Settings?.similarMemoryRatio ?? 0.4,
enableSimilarityCorrection: data.hypaV3Settings?.enableSimilarityCorrection ?? false,
preserveOrphanedMemory: data.hypaV3Settings?.preserveOrphanedMemory ?? false,
processRegexScript: data.hypaV3Settings?.processRegexScript ?? false
processRegexScript: data.hypaV3Settings?.processRegexScript ?? false,
doNotSummarizeUserMessage: data.hypaV3Settings?.doNotSummarizeUserMessage ?? false
}
changeLanguage(data.language)
setDatabaseLite(data)
@@ -894,6 +895,7 @@ export interface Database{
enableSimilarityCorrection: boolean
preserveOrphanedMemory: boolean
processRegexScript: boolean
doNotSummarizeUserMessage: boolean
},
OaiCompAPIKeys: {[key:string]:string}
inlayErrorResponse:boolean