From 0878f2fcc319ad0c5bd02d35b082becdc0666ad3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 16 Jul 2024 09:04:48 +0000 Subject: [PATCH 1/5] chore: auto-generate vimdoc --- doc/gp.nvim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/gp.nvim.txt b/doc/gp.nvim.txt index 3571eb6..58eaeac 100644 --- a/doc/gp.nvim.txt +++ b/doc/gp.nvim.txt @@ -252,7 +252,7 @@ options might get deprecated and so on - it’s better to change only things where the default doesn’t fit your needs. -https://github.com/Robitx/gp.nvim/blob/2169a731aec0108ad545b68bd95ef705e6c0e27b/lua/gp/config.lua#L8-L569 +https://github.com/Robitx/gp.nvim/blob/3adf3dc7589f54cf7af887879c995aa9846aace5/lua/gp/config.lua#L8-L568 ============================================================================== From 5cc8a4e10daee252187124537eba428c5abfa839 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron <886074+teto@users.noreply.github.com> Date: Tue, 2 Apr 2024 15:48:11 +0200 Subject: [PATCH 2/5] add .editorconfig to help contributions set tab by default --- .editorconfig | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ee48062 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +root = true + +[*] +indent_style = tab +indent_size = 1 +tab_width = 4 +end_of_line = lf +insert_final_newline = true +charset = utf-8 + From 44f62561f3992e8d245cdb7f13c5716fdf7984b8 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron <886074+teto@users.noreply.github.com> Date: Mon, 25 Mar 2024 15:46:43 +0100 Subject: [PATCH 3/5] make it possible tu use `:GpWhisper ` so this can be changed on the fly. --- lua/gp/init.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lua/gp/init.lua b/lua/gp/init.lua index 68755ea..a0d14f0 100644 --- a/lua/gp/init.lua +++ b/lua/gp/init.lua @@ -1161,7 +1161,7 @@ M.prepare_commands = function() end M.cmd["Whisper" .. command] = function(params) - M.Whisper(function(text) + M.Whisper(M.config.whisper_language, function(text) vim.schedule(function() cmd(params, text) end) @@ -3200,7 +3200,7 @@ M.Prompt = function(params, target, prompt, model, template, system_template, wh end ---@param callback function # callback function(text) -M.Whisper = function(callback) +M.Whisper = function(language, callback) -- make sure sox is installed if vim.fn.executable("sox") == 0 then M.error("sox is not installed") @@ -3356,7 +3356,7 @@ M.Whisper = function(callback) .. M.config.openai_api_key .. '" -H "Content-Type: multipart/form-data" ' .. '-F model="whisper-1" -F language="' - .. M.config.whisper_language + .. language .. '" -F file="@final.mp3" ' .. '-F response_format="json"' @@ -3459,7 +3459,14 @@ M.cmd.Whisper = function(params) end_line = params.line2 end - M.Whisper(function(text) + local args = vim.split(params.args, " ") + + local language = config.whisper_language + if args[1] ~= "" then + language = args[1] + end + + M.Whisper(language, function(text) if not vim.api.nvim_buf_is_valid(buf) then return end From 6a7a78fc78f249f31cd99c3c8d9c4e419684aa53 Mon Sep 17 00:00:00 2001 From: "Matthieu C." <886074+teto@users.noreply.github.com> Date: Wed, 17 Jul 2024 12:03:03 +0200 Subject: [PATCH 4/5] doc: updated GpWhisper doc in README --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5dc79c6..ad34507 100644 --- a/README.md +++ b/README.md @@ -311,12 +311,15 @@ Provides custom context per repository: ## Speech commands -#### `:GpWhisper` +#### `:GpWhisper` {lang?} Transcription replaces the current line, visual selection or range in the current buffer. Use your mouth to ask a question in a chat buffer instead of writing it by hand, dictate some comments for the code, notes or even your next novel.. For the rest of the whisper commands, the transcription is used as an editable prompt for the equivalent non whisper command - `GpWhisperRewrite` dictates instructions for `GpRewrite` etc. +You can override the default language by setting {lang} with the 2 letter +shortname of your language (e.g. "en" for English, "fr" for French etc). + #### `:GpWhisperRewrite` Similar to `:GpRewrite`, but the prompt instruction dialog uses transcribed spoken instructions. From a55dbda45210c99375d7301319ec8421305dbd1d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Jul 2024 10:29:39 +0000 Subject: [PATCH 5/5] chore: auto-generate vimdoc --- doc/gp.nvim.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/gp.nvim.txt b/doc/gp.nvim.txt index 58eaeac..bde9f29 100644 --- a/doc/gp.nvim.txt +++ b/doc/gp.nvim.txt @@ -1,4 +1,4 @@ -*gp.nvim.txt* For NVIM v0.8.0 Last change: 2024 July 16 +*gp.nvim.txt* For NVIM v0.8.0 Last change: 2024 July 17 ============================================================================== Table of Contents *gp.nvim-table-of-contents* @@ -396,7 +396,7 @@ Provides custom context per repository: SPEECH COMMANDS *gp.nvim-speech-commands* -:GpWhisper *:GpWhisper* +:GpWhisper {lang?} *:GpWhisper* Transcription replaces the current line, visual selection or range in the current buffer. Use your mouth to ask a question in a chat buffer instead of @@ -407,6 +407,9 @@ For the rest of the whisper commands, the transcription is used as an editable prompt for the equivalent non whisper command - `GpWhisperRewrite` dictates instructions for `GpRewrite` etc. +You can override the default language by setting {lang} with the 2 letter +shortname of your language (e.g. "en" for English, "fr" for French etc). + :GpWhisperRewrite *:GpWhisperRewrite*