Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setting for toggling inversion of enter and shift+enter to send message vs going to next line #361

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion dist/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"minAppVersion": "1.1.0",
"authorUrl": "https://wfhbrian.com",
"isDesktopOnly": true,
"version": "1.6.34"
}
"version": "1.6.35"
}
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"minAppVersion": "1.1.0",
"authorUrl": "https://wfhbrian.com",
"isDesktopOnly": true,
"version": "1.6.34"
}
"version": "1.6.35"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-smart-connections",
"version": "1.6.34",
"version": "1.6.35",
"description": "Link and chat with your notes using ChatGPT and embedding artificial intelligence from OpenAI.",
"main": "main.js",
"scripts": {
Expand Down
12 changes: 10 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const DEFAULT_SETTINGS = {
skip_sections: false,
smart_chat_model: "gpt-3.5-turbo-16k",
view_open: true,
use_shift_to_send: true,
version: "",
};
const MAX_EMBED_STRING_LENGTH = 25000;
Expand Down Expand Up @@ -2444,6 +2445,13 @@ class SmartConnectionsSettingsTab extends Obsidian.PluginSettingTab {
this.plugin.settings.skip_sections = value;
await this.plugin.saveSettings(true);
}));

// use shift to send
new Obsidian.Setting(containerEl).setName("use_shift_to_send").setDesc("When enabled, Enter goes to the next line and Shift+Enter sends the message. Otherwise, Enter sents the message and Shift+Enter goes to the next line.").addToggle((toggle) => toggle.setValue(this.plugin.settings.use_shift_to_send).onChange(async (value) => {
this.plugin.settings.use_shift_to_send = value;
await this.plugin.saveSettings(true);
}));

// test file writing by creating a test file, then writing additional data to the file, and returning any error text if it fails
containerEl.createEl("h3", {
text: "Test File Writing"
Expand Down Expand Up @@ -2752,7 +2760,7 @@ class SmartConnectionsChatView extends Obsidian.ItemView {
});

chat_input.addEventListener("keydown", (e) => {
if (e.key === "Enter" && e.shiftKey) {
if (e.key === "Enter" && (!this.plugin.settings.use_shift_to_send || e.shiftKey)) {
e.preventDefault();
if(this.prevent_input){
console.log("wait until current response is finished");
Expand Down Expand Up @@ -3855,4 +3863,4 @@ class ScStreamer {
}
}

module.exports = SmartConnectionsPlugin;
module.exports = SmartConnectionsPlugin;