mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-30 19:03:01 +01:00
Show Khoj Obsidian commands even if no connection to server
Server connection check can be a little flaky in Obsidian. Don't gate the commands behind it to improve usability of Khoj. Previously the commands would get disabled when server connection check failed, even though server was actually accessible
This commit is contained in:
parent
36bf42a860
commit
f9420e1209
1 changed files with 3 additions and 15 deletions
|
@ -16,33 +16,21 @@ export default class Khoj extends Plugin {
|
||||||
this.addCommand({
|
this.addCommand({
|
||||||
id: 'search',
|
id: 'search',
|
||||||
name: 'Search',
|
name: 'Search',
|
||||||
checkCallback: (checking) => {
|
callback: () => { new KhojSearchModal(this.app, this.settings).open(); }
|
||||||
if (!checking && this.settings.connectedToBackend)
|
|
||||||
new KhojSearchModal(this.app, this.settings).open();
|
|
||||||
return this.settings.connectedToBackend;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add similar notes command. It can only be triggered from the editor
|
// Add similar notes command. It can only be triggered from the editor
|
||||||
this.addCommand({
|
this.addCommand({
|
||||||
id: 'similar',
|
id: 'similar',
|
||||||
name: 'Find similar notes',
|
name: 'Find similar notes',
|
||||||
editorCheckCallback: (checking) => {
|
editorCallback: () => { new KhojSearchModal(this.app, this.settings, true).open(); }
|
||||||
if (!checking && this.settings.connectedToBackend)
|
|
||||||
new KhojSearchModal(this.app, this.settings, true).open();
|
|
||||||
return this.settings.connectedToBackend;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add chat command. It can be triggered from anywhere
|
// Add chat command. It can be triggered from anywhere
|
||||||
this.addCommand({
|
this.addCommand({
|
||||||
id: 'chat',
|
id: 'chat',
|
||||||
name: 'Chat',
|
name: 'Chat',
|
||||||
checkCallback: (checking) => {
|
callback: () => { new KhojChatModal(this.app, this.settings).open(); }
|
||||||
if (!checking && this.settings.connectedToBackend)
|
|
||||||
new KhojChatModal(this.app, this.settings).open();
|
|
||||||
return this.settings.connectedToBackend;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create an icon in the left ribbon.
|
// Create an icon in the left ribbon.
|
||||||
|
|
Loading…
Reference in a new issue