From 5dd759337b0fe8cfd383874a32f670b667916fdc Mon Sep 17 00:00:00 2001 From: b-boehne Date: Wed, 8 Nov 2023 13:35:52 +0000 Subject: [PATCH] add option to customize system prompt and add proper documentation to readme --- README.md | 12 ++++++++++++ clipea | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cff90a7..4907325 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,18 @@ This allows it to give better responses. ?? install curl ?? compare README.md to my clipboard +#### Custom Prompt + +You can customize your prompt by creating a prompt file in your home directory. + + ~/.config/clipea/system-prompt.txt + +You might wanna start by copying the default prompt: + + cp $(dirname $(readlink -f $(which clipea)))/system-prompt.txt ~/.config/clipea/system-prompt.txt + +Then edit `~/.config/clipea/system-prompt.txt` to your liking, but be aware that environment info is always added to the end of the prompt. + ### ⤴️ Feedback and editing Just use your shell history by pressing the `` arrow key. Your cursor will be at the end of diff --git a/clipea b/clipea index 5eb0966..5da1420 100755 --- a/clipea +++ b/clipea @@ -16,7 +16,11 @@ $env = [ // 'cwd' => getcwd(), ]; -$system = file_get_contents(CLIPEA_DIR . '/system-prompt.txt') . json_encode($env); +$systemPromptFile = CLIPEA_DIR . '/system-prompt.txt'; +if (file_exists($_SERVER['HOME'] . '/.config/clipea/system-prompt.txt')) { + $systemPromptFile = $_SERVER['HOME'] . '/.config/clipea/system-prompt.txt'; +} +$system = file_get_contents($systemPromptFile) . json_encode($env); function get_input(array $argv) {