Skip to content

Commit

Permalink
Merge pull request #14 from b-boehne/main
Browse files Browse the repository at this point in the history
Make system prompt customizable.
  • Loading branch information
dave1010 authored Nov 8, 2023
2 parents b51abf6 + 5dd7593 commit 17a78b4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<up>` arrow key. Your cursor will be at the end of
Expand Down
6 changes: 5 additions & 1 deletion clipea
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 17a78b4

Please sign in to comment.