Skip to content

Commit 33dd25b

Browse files
committed
ui: show current model at header
1 parent 4e1e69c commit 33dd25b

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

lua/CopilotChat/client.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ function Client:ask(opts)
624624
content = response_text,
625625
reasoning = response_reasoning,
626626
tool_calls = #tool_calls:values() > 0 and tool_calls:values() or nil,
627+
model = opts.model,
627628
},
628629
token_count = token_count,
629630
token_max_count = max_tokens,

lua/CopilotChat/ui/chat.lua

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -771,12 +771,22 @@ function Chat:render()
771771
local header_value = self.headers[message.role]
772772
local header_line = message.section.start_line - 2
773773

774+
local virt_text = {
775+
{ ' ' .. header_value .. ' ', 'CopilotChatHeader' },
776+
}
777+
778+
local model_info = ''
779+
if message.model then
780+
model_info = '(' .. message.model .. ')'
781+
table.insert(virt_text, { model_info, 'CopilotChatHeader' })
782+
end
783+
784+
local text_len = #header_value + 2 + #model_info
785+
table.insert(virt_text, { string.rep(self.separator, vim.go.columns - text_len - 1), 'CopilotChatSeparator' })
786+
774787
vim.api.nvim_buf_set_extmark(self.bufnr, highlight_ns, header_line, 0, {
775788
conceal = '',
776-
virt_text = {
777-
{ ' ' .. header_value .. ' ', 'CopilotChatHeader' },
778-
{ string.rep(self.separator, vim.go.columns - #header_value - 1), 'CopilotChatSeparator' },
779-
},
789+
virt_text = virt_text,
780790
virt_text_pos = 'overlay',
781791
priority = 2000, -- High priority to override other plugins if enabled
782792
strict = false,

0 commit comments

Comments
 (0)