Skip to content

Commit f99f1cd

Browse files
authored
fix(config): correct system_prompt type and callback usage (#1325)
Update the type annotation for system_prompt to allow nil and fix its initialization to use the shared prompt. Also, update the callback in prompts.lua to use response.content for line parsing, ensuring correct diagnostics extraction.
1 parent 02b97d8 commit f99f1cd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lua/CopilotChat/config.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
---@field blend number?
1515

1616
---@class CopilotChat.config.Shared
17-
---@field system_prompt string|fun(source: CopilotChat.source):string|nil
17+
---@field system_prompt nil|string|fun(source: CopilotChat.source):string
1818
---@field model string?
1919
---@field tools string|table<string>|nil
2020
---@field sticky string|table<string>|nil
@@ -53,7 +53,7 @@ return {
5353

5454
-- Shared config starts here (can be passed to functions at runtime and configured via setup function)
5555

56-
system_prompt = '{COPILOT_INSTRUCTIONS}', -- System prompt to use (can be specified manually in prompt via /).
56+
system_prompt = require('CopilotChat.config.prompts').COPILOT_INSTRUCTIONS.system_prompt, -- System prompt to use (can be specified manually in prompt via /).
5757

5858
model = 'gpt-4.1', -- Default model to use, see ':CopilotChatModels' for available models (can be specified manually in prompt via $).
5959
tools = nil, -- Default tool or array of tools (or groups) to share with LLM (can be specified manually in prompt via @).

lua/CopilotChat/config/prompts.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ If no issues found, confirm the code is well-written and explain why.
148148
system_prompt = '{COPILOT_REVIEW}',
149149
callback = function(response, source)
150150
local diagnostics = {}
151-
for line in response:gmatch('[^\r\n]+') do
151+
for line in response.content:gmatch('[^\r\n]+') do
152152
if line:find('^line=') then
153153
local start_line = nil
154154
local end_line = nil

0 commit comments

Comments
 (0)