From 9e6f8e8d037a477c55939ece36ab7b000f876e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jason=20K=C3=B6lker?= Date: Wed, 24 Jan 2024 02:00:07 +0000 Subject: feat(chat): add `include` role to include files Files may be included in the chat by a special `include` role. Each file's contents will be added to an additional `user` role message with the files separated by `==> {path} <==` where `{path}` is the path to the file. Globbing is expanded out via `glob.glob` and relative apths to the current working directory (as determined by `getcwd()`) will be resolved to absolute paths. Example: ``` >>> user Generate documentation for the following files >>> include /home/user/myproject/src/../requirements.txt /home/user/myproject/**/*.py ``` Fixes: #69 --- doc/tags | 1 + doc/vim-ai.txt | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) (limited to 'doc') diff --git a/doc/tags b/doc/tags index dfac716..45ad6dd 100644 --- a/doc/tags +++ b/doc/tags @@ -7,4 +7,5 @@ vim-ai vim-ai.txt /*vim-ai* vim-ai-about vim-ai.txt /*vim-ai-about* vim-ai-commands vim-ai.txt /*vim-ai-commands* vim-ai-config vim-ai.txt /*vim-ai-config* +vim-ai-include vim-ai.txt /*vim-ai-include* vim-ai.txt vim-ai.txt /*vim-ai.txt* diff --git a/doc/vim-ai.txt b/doc/vim-ai.txt index f5f2cde..34765d7 100644 --- a/doc/vim-ai.txt +++ b/doc/vim-ai.txt @@ -104,6 +104,25 @@ Options: > Check OpenAI docs for more information: https://platform.openai.com/docs/api-reference/chat +INCLUDE FILES *vim-ai-include* + +To include files in the chat a special `include` role is used: > + + >>> user + + Generate documentation for the following files + + >>> include + + /home/user/myproject/requirements.txt + /home/user/myproject/**/*.py + +Each file's contents will be added to an additional `user` role message with +the files separated by `==> {path} <==`, where path is the path to the file. +Globbing is expanded out via `glob.gob` and relative paths to the current +working directory (as determined by `getcwd()`) will be resolved to absolute +paths. + *:AINewChat* :AINewChat {preset shortname}? spawn a new conversation with a given open -- cgit v1.2.3