Add notification feature with permission handling and UI toggle

This commit is contained in:
kwaroran
2024-12-02 04:42:13 +09:00
parent 0e292bd690
commit 18ea5aff4e
4 changed files with 41 additions and 0 deletions

View File

@@ -1330,6 +1330,22 @@ export async function sendChat(chatProcessIndex = -1,arg:{
})
}
if(DBState.db.notification){
try {
const permission = await Notification.requestPermission()
if(permission === 'granted'){
const noti = new Notification('RisuAI', {
body: result
})
noti.onclick = () => {
window.focus()
}
}
} catch (error) {
}
}
chatProcessStage.set(4)
peerSync()