-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
Unable to activate system prompts #568
Comments
Hey @tlindgren Thanks for letting me know about this. I think the issue is that nothing is indicating that nothing is indicating that the system prompt is being used in the Smart Chat window. I just made a note about this to get it fixed. However, the system prompt should still be utilized by the chat. There are a couple ways that you can confirm this:
Here's a screenshot you can use for reference: If you confirm the system prompt is being included via either of the above steps but you feel like the chat isn't respecting the instructions, then it would be worth trying another chat model since some models pay more attention to system prompts that others. 🌴 |
Hi Brian, Thanks for getting back to me on this. Maybe I should back up to confirm how the feature is supposed to work. I'm assuming that after I designate a system prompt folder in settings, adding @ in the chat should pop up a list of my system prompts from that folder and then I can select the one I want to use. Do I have that correct? Or is there a different way I should be selecting a prompt. Tim |
@tlindgren that is correct, it should look something like this 🌴 |
Thanks, @brianpetro - here's what I'm seeing: https://vimeo.com/940101097/ed84772a9a?share=copy. When I type @, the prompts dialog doesn't appear as it does in your screenshot. N Let me know if you need more details/info Tim |
@tlindgren, thanks for the screenshot, that helps me better see what's going on. Are you copy & pasting the What if you type it in without anything else in the input box, does it work then? This feature is something that will be improved soon, but in the meantime, if you type the @ at the beginning without any other content it should work. If it still doesn't work then, check the developer console because there should be an error there you can screenshot so we can figure it out. 🌴 |
@tlindgren those errors are unrelated and are OK. Which operating system are you using? Does typing Thanks for your help in solving this |
@brianpetro [[ and /folder/ both work fine. I'm Sonoma 14.4.1 |
@tlindgren interesting. I'm kind of stumped on this one then. I'll let you know if I think of something. 🌴 |
Hi, I had a similar issue on Windows 11. But for me, both '[[' and '@' weren't working. After some tries I found a workaround using 'keydown' instead of 'keyup'. I'm not sure if this is the optimal solution, but it worked for me and may be a helpful starting point.
add_chat_input_listeners() {
super.add_chat_input_listeners();
const chat_input = this.container.querySelector(".sc-chat-form");
this.brackets_ct = 0;
this.prevent_input = false;
chat_input.addEventListener("keydown", this.key_down_handler.bind(this));
}
key_down_handler(e) {
const textarea = this.container.querySelector(".sc-chat-form textarea");
if (!["/", "@", "["].includes(e.key)) return;
const caret_pos = textarea.selectionStart;
if (e.key === "[") {
if (textarea.value[caret_pos - 1] === "[") {
e.preventDefault();
this.open_file_suggestion_modal();
return;
}
} else {
this.brackets_ct = 0;
}
if (e.key === "/") {
if (textarea.value.length === 0 || textarea.value[caret_pos - 1] === " ") {
e.preventDefault();
this.open_folder_suggestion_modal();
return;
}
}
if (e.key === "@") {
if (textarea.value.length === 0 || textarea.value[caret_pos - 1] === " ") {
e.preventDefault();
this.open_system_prompt_modal();
return;
}
}
} I also had to change this part as well to add the '@' or '[' character before the inserted text: var ScFileSelectModal = class extends FuzzySuggestModal {
constructor(app, env) {
super(app);
this.app = app;
this.env = env;
this.setPlaceholder("Type the name of a file...");
}
// get all markdown files
getItems() {
return this.app.vault.getMarkdownFiles().sort((a, b) => a.basename.localeCompare(b.basename));
}
getItemText(item) {
return item.basename;
}
onChooseItem(file) {
this.env.chat_ui.insert_selection("[" + file.basename + "]] ");
}
};
var ScFolderSelectModal = class extends FuzzySuggestModal {
constructor(app, env, folders) {
super(app);
this.app = app;
this.env = env;
this.folders = folders;
this.setPlaceholder("Type the name of a folder...");
}
getItems() {
return this.folders;
}
getItemText(item) {
return item;
}
onChooseItem(folder) {
this.env.chat_ui.insert_selection(folder + "/ ");
}
};
var ScSystemPromptSelectModal = class extends FuzzySuggestModal {
constructor(app, env) {
super(app);
this.app = app;
this.env = env;
this.setPlaceholder("Type the name of a system prompt...");
}
// getItems() { return this.env.system_prompts; }
getItems() {
return this.env.system_prompts;
}
getItemText(item) {
return item.basename;
}
onChooseItem(prompt) {
this.env.chat_ui.insert_selection('@"' + prompt.basename + '"');
}
};
} |
I was really excited to see the new system prompts feature but I can't seem to get it to work and I'm not sure if I'm doing something wrong. I have a system prompts folder saved and a note in the folder, but when I add the @ button in the chat, nothing happens.
I'm using version 2.1.50.
Thanks
The text was updated successfully, but these errors were encountered: