Skip to content

Commit

Permalink
prompt escape tentative fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nbonamy committed Nov 5, 2024
1 parent 3f07373 commit b340420
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/screens/PromptAnywhere.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ onMounted(() => {
audioPlayer.addListener(onAudioPlayerStatus)
onEvent('audio-noise-detected', () => audioPlayer.stop)
// shotcuts work better at document level
document.addEventListener('keyup', onKeyUp)
document.addEventListener('keydown', onKeyDown)
// other stuff
isMas.value = window.api.isMasBuild
Expand All @@ -124,10 +128,6 @@ onUnmounted(() => {
const onShow = () => {
// shotcuts work better at document level
document.addEventListener('keyup', onKeyUp)
document.addEventListener('keydown', onKeyDown)
// see if chat is not that old
if (chat.value !== null) {
if (lastSeenChat == null || lastSeenChat.uuid !== chat.value.uuid || lastSeenChat.when < Date.now() - promptChatTimeout) {
Expand Down Expand Up @@ -162,7 +162,7 @@ const initChat = () => {
// init thread
chat.value = new Chat()
chat.value.title = null
chat.value.addMessage(new Message('system', store.config.instructions.default))
chat.value.addMessage(new Message('system', generator.getSystemInstructions()))
// reset stuff
response.value = null
Expand Down Expand Up @@ -203,7 +203,7 @@ const onKeyDown = (ev: KeyboardEvent) => {
const isCommand = !ev.shiftKey && !ev.altKey && (ev.metaKey || ev.ctrlKey)
const isShiftCommand = ev.shiftKey && !ev.altKey && (ev.metaKey || ev.ctrlKey)
// now check
if (isCommand && ev.key == 'x') {
ev.preventDefault()
onClear()
Expand Down Expand Up @@ -307,9 +307,9 @@ const onClose = () => {
// cleanup
cleanUp()
// remove listeners
document.removeEventListener('keyup', onKeyUp)
document.removeEventListener('keydown', onKeyDown)
// // remove listeners
// document.removeEventListener('keyup', onKeyUp)
// document.removeEventListener('keydown', onKeyDown)
// done
window.api.anywhere.close()
Expand Down

0 comments on commit b340420

Please sign in to comment.