generated from silverbulletmd/silverbullet-plug-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from justyns/template-options
Remove duplicate description field in aiPrompt templates
- Loading branch information
Showing
9 changed files
with
6 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ import { | |
space, | ||
system, | ||
} from "@silverbulletmd/silverbullet/syscalls"; | ||
import { queryObjects } from "./utils.ts"; | ||
import { query } from "./utils.ts"; | ||
import { renderTemplate } from "https://deno.land/x/[email protected]/plugs/template/api.ts"; | ||
import type { | ||
CompleteEvent, | ||
|
@@ -28,9 +28,9 @@ export async function aiPromptSlashComplete( | |
if (!supportsPlugSlashComplete()) { | ||
return; | ||
} | ||
const allTemplates = await queryObjects("template", { | ||
filter: ["attr", ["attr", "aiprompt"], "slashCommand"], | ||
}, 5); | ||
const allTemplates = await query( | ||
"template where aiprompt and aiprompt.slashCommand", | ||
); | ||
return { | ||
options: allTemplates.map((template) => { | ||
const aiPromptTemplate = template.aiprompt!; | ||
|
@@ -58,10 +58,7 @@ export async function insertAiPromptFromTemplate( | |
let selectedTemplate; | ||
|
||
if (!SlashCompletions || !SlashCompletions.templatePage) { | ||
// TODO: I don't really understand how this filter works. I'd rather have it check for a #aiPrompt tag instead of an aiprompt.description property | ||
const aiPromptTemplates = await queryObjects("template", { | ||
filter: ["attr", ["attr", "aiprompt"], "description"], | ||
}); | ||
const aiPromptTemplates = await query("template where aiprompt"); | ||
|
||
selectedTemplate = await editor.filterBox( | ||
"Prompt Template", | ||
|