mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Trigger voice chat via keyboard shortcut in Khoj side pane
Quickly trigger voice chat from Khoj side pane using Keyboard shortcuts
This commit is contained in:
parent
3723904512
commit
cffc14a46a
1 changed files with 6 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
import { ItemView, MarkdownRenderer, WorkspaceLeaf, request, requestUrl, setIcon } from 'obsidian';
|
||||
import { ItemView, MarkdownRenderer, Scope, WorkspaceLeaf, request, requestUrl, setIcon } from 'obsidian';
|
||||
import * as DOMPurify from 'dompurify';
|
||||
import { KhojSetting } from 'src/settings';
|
||||
import { KhojPaneView } from 'src/pane_view';
|
||||
|
@ -28,6 +28,10 @@ export class KhojChatView extends KhojPaneView {
|
|||
constructor(leaf: WorkspaceLeaf, setting: KhojSetting) {
|
||||
super(leaf, setting);
|
||||
|
||||
// Register Modal Keybindings to send voice message
|
||||
this.scope = new Scope(this.app.scope);
|
||||
this.scope.register(["Mod"], 's', async (event) => { await this.speechToText(event); });
|
||||
|
||||
this.waitingForLocation = true;
|
||||
|
||||
fetch("https://ipapi.co/json")
|
||||
|
@ -958,7 +962,7 @@ export class KhojChatView extends KhojPaneView {
|
|||
|
||||
sendMessageTimeout: NodeJS.Timeout | undefined;
|
||||
mediaRecorder: MediaRecorder | undefined;
|
||||
async speechToText(event: MouseEvent | TouchEvent) {
|
||||
async speechToText(event: MouseEvent | TouchEvent | KeyboardEvent) {
|
||||
event.preventDefault();
|
||||
const transcribeButton = <HTMLButtonElement>this.contentEl.getElementsByClassName("khoj-transcribe")[0];
|
||||
const chatInput = <HTMLTextAreaElement>this.contentEl.getElementsByClassName("khoj-chat-input")[0];
|
||||
|
|
Loading…
Add table
Reference in a new issue