Skip to content

Commit

Permalink
add a demo
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasJamesCrawford committed Apr 1, 2023
1 parent bf947cf commit b6c8ed5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

This is a simple extension to work with the [openai completions API](https://platform.openai.com/docs/api-reference/completions).

![A demo using the plugin](./demo.gif)

It combines your visual selection with a prompt and either performs a direct edit `:OpenAICompletionEdit` or just presents the result `:OpenAICompletion`.

It requires `curl` and the env var `OPENAI_API_KEY` to be set.
Expand Down
Binary file added demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions lua/openai/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ end
local function edit(input, instruction)
local prompt = instruction .. " (" ..
vim.api.nvim_buf_get_option(0, "filetype") ..
'). \n\n' .. input .. '\n\n. ' ..
"Do not return anything except the edited text."
'). \n\n' .. input

return call_api(prompt)
end
Expand Down

0 comments on commit b6c8ed5

Please sign in to comment.