aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--src/App.tsx1
-rw-r--r--src/main.tsx7
-rw-r--r--src/ollama.tsx3
4 files changed, 12 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index eabe0a3..6bc78d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -92,3 +92,4 @@ lerna-debug.log
# System Files
.DS_Store
Thumbs.db
+package-lock.json
diff --git a/src/App.tsx b/src/App.tsx
index 0a32968..230bc80 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -63,6 +63,7 @@ function App() {
logseq.Editor.registerBlockContextMenuItem("Ollama: Create a flash card", convertToFlashCardFromEvent)
logseq.Editor.registerBlockContextMenuItem("Ollama: Divide into subtasks", DivideTaskIntoSubTasksFromEvent)
logseq.Editor.registerBlockContextMenuItem("Ollama: Prompt from Block", promptFromBlockEventClosure())
+ logseq.Editor.registerBlockContextMenuItem("Ollama: Custom prompt on Block", promptFromBlockEventClosure(logseq.settings.custom_prompt_block))
logseq.Editor.registerBlockContextMenuItem("Ollama: Summarize block", promptFromBlockEventClosure("Summarize: "))
logseq.Editor.registerBlockContextMenuItem("Ollama: Expand Block", promptFromBlockEventClosure("Expand: "))
diff --git a/src/main.tsx b/src/main.tsx
index a78d85d..a544760 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -36,6 +36,13 @@ let settings: SettingSchemaDesc[] = [
description: "Shortcut to open plugin command pallete",
default: "mod+shift+o"
},
+ {
+ key: "custom_prompt_block",
+ type: "string",
+ title: "Custom prompt block",
+ description: "Define your custom prompt and use a block as context",
+ default: "Translate in French : "
+ },
]
diff --git a/src/ollama.tsx b/src/ollama.tsx
index 9d925db..e59c633 100644
--- a/src/ollama.tsx
+++ b/src/ollama.tsx
@@ -178,6 +178,7 @@ export async function summarizeBlock() {
const currentBlock = await logseq.Editor.getCurrentBlock()
let summaryBlock = await logseq.Editor.insertBlock(currentBlock!.uuid, `⌛Summarizing Block...`, { before: false })
const summary = await promptLLM(`Summarize the following ${currentBlock!.content}`);
+
await logseq.Editor.updateBlock(summaryBlock!.uuid, `Summary: ${summary}`)
} catch (e: any) {
logseq.App.showMsg(e.toString(), 'warning')
@@ -185,6 +186,8 @@ export async function summarizeBlock() {
}
}
+
+
async function getOllamaParametersFromBlockProperties(b: BlockEntity) {
const properties = await logseq.Editor.getBlockProperties(b.uuid);
const ollamaParameters: OllamaGenerateParameters = {}