diff options
| author | David Li <taweili@gmail.com> | 2023-12-04 16:17:48 +0800 |
|---|---|---|
| committer | David Li <taweili@gmail.com> | 2023-12-04 16:17:48 +0800 |
| commit | c487b7b37a9f9e2de82d386c30ea7d62097a847e (patch) | |
| tree | 7eaa0f59404afb970d69d410dba43ad7f0e1d060 /src/App.tsx | |
| parent | 5edf9a522deaed225d15724fe32d65124a5af590 (diff) | |
| download | ollama-logseq-c487b7b37a9f9e2de82d386c30ea7d62097a847e.tar.xz ollama-logseq-c487b7b37a9f9e2de82d386c30ea7d62097a847e.zip | |
Abstract out the prompt and block event functions
into a closure so it can be use to create new menu events
with different prompt prefix.
Diffstat (limited to 'src/App.tsx')
| -rw-r--r-- | src/App.tsx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/App.tsx b/src/App.tsx index 6ab84a8..3e50f38 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -4,9 +4,7 @@ import { convertToFlashCardFromEvent, DivideTaskIntoSubTasksFromEvent, ollamaUI, - summarizeBlockFromEvent, - promptFromBlockEvent, - expandBlockEvent + promptFromBlockEventClosure } from "./ollama"; import { useAppVisible } from "./utils"; @@ -48,10 +46,13 @@ function App() { } logseq.Editor.registerSlashCommand("ollama", ollamaUI) logseq.Editor.registerBlockContextMenuItem("Ollama: Create a flash card", convertToFlashCardFromEvent) - logseq.Editor.registerBlockContextMenuItem("Ollama: Summarize block", summarizeBlockFromEvent) logseq.Editor.registerBlockContextMenuItem("Ollama: Divide into subtasks", DivideTaskIntoSubTasksFromEvent) - logseq.Editor.registerBlockContextMenuItem("Ollama: Prompt from Block", promptFromBlockEvent) - logseq.Editor.registerBlockContextMenuItem("Ollama: Expand Block", expandBlockEvent) + logseq.Editor.registerBlockContextMenuItem("Ollama: Prompt from Block", promptFromBlockEventClosure()) + logseq.Editor.registerBlockContextMenuItem("Ollama: Summarize block", promptFromBlockEventClosure("Summarize: ")) + logseq.Editor.registerBlockContextMenuItem("Ollama: 总结 Block", promptFromBlockEventClosure("总结: ")) + logseq.Editor.registerBlockContextMenuItem("Ollama: Expand Block", promptFromBlockEventClosure("Expand: ")) + logseq.Editor.registerBlockContextMenuItem("Ollama: 扩展 Block", promptFromBlockEventClosure("扩展: ")) + logseq.App.registerCommandShortcut( { "binding": logseq.settings.shortcut }, ollamaUI |
