Skip to content

Commit

Permalink
Let chat on page work on any page. Add keyboard shortcut for it
Browse files Browse the repository at this point in the history
  • Loading branch information
justyns committed Feb 22, 2024
1 parent 116a6d2 commit d9f5303
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sbai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function summarizeNote() {
if (selectedTextInfo.text.length > 0) {
const noteName = await editor.getCurrentPage();
const response = await chatWithOpenAI(
"You are an AI Note assistant here to help summarize your personal notes.",
"You are an AI Note assistant here to help summarize the user's personal notes.",
[{
role: "user",
content:
Expand Down
2 changes: 1 addition & 1 deletion scripts/update-readme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async function updateReadme(tag: string) {

// Extract documentation for each command using jsdoc/tsdoc comments
for (const [key, value] of Object.entries(commands)) {
if (typeof value === "object" && value.path) {
if (typeof value === "object" && value.path && value.command?.name) {
const docs = extractDocsForFunction(value.path);
console.log(`Documentation for ${key}: ${docs}`);
commandsMarkdown += `- **${value.command.name}**: ${docs}\n`;
Expand Down
4 changes: 3 additions & 1 deletion silverbullet-ai.plug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ functions:
streamChatOnPage:
path: sbai.ts:streamChatOnPage
command:
name: "AI: Chat on current page"
name: "AI: Chat on current page"
key: "Ctrl-Shift-Enter"
mac: "Cmd-Shift-Enter"
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function convertPageToMessages() {
const pageText = await editor.getText();
const lines = pageText.split("\n");
const messages = [];
let currentRole = "";
let currentRole = "user";
let contentBuffer = "";

lines.forEach((line) => {
Expand Down

0 comments on commit d9f5303

Please sign in to comment.