Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions doc/codecompanion.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,29 @@ configuration and can be changed via:
})
<

The keymaps for accepting and rejecting the diff sit within the `inline`
configuration and can be changed via:

>lua
require("codecompanion").setup({
strategies = {
inline = {
keymaps = {
accept_change = {
modes = { n = "gda" }, -- gDiffAccept
},
reject_change = {
modes = { n = "gdr" }, -- gDiffReject
},
always_accept = {
modes = { n = "gdt" },
},
},
},
},
})
<


USER INTERFACE (UI) ~

Expand Down Expand Up @@ -2333,7 +2356,7 @@ The fastest way to copy an LLM’s code output is with `gy`. This will yank the
nearest codeblock.


APPLYING AN LLM€�S EDITS TO A BUFFER OR FILE ~
APPLYING AN LLMS EDITS TO A BUFFER OR FILE ~

The |codecompanion-usage-chat-buffer-tools-files| tool, combined with the
|codecompanion-usage-chat-buffer-variables.html-buffer| variable or
Expand Down Expand Up @@ -3846,7 +3869,7 @@ OpenAI adapter.
as a great reference to understand how they’re working with the output of the
API

OPENAI€�S API OUTPUT
OPENAIS API OUTPUT

If we reference the OpenAI documentation
<https://platform.openai.com/docs/guides/text-generation/chat-completions-api>
Expand Down
11 changes: 10 additions & 1 deletion lua/codecompanion/strategies/chat/ui/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,16 @@ function UI:render(context, messages, opts)
end

local trimempty = not (msg.role == "user" and msg.content == "")
for _, text in ipairs(vim.split(msg.content or "", "\n", { plain = true, trimempty = trimempty })) do
local display_content = msg.content or ""
-- For anthropic adapter, the tool output is in msg.content.content
if type(display_content) == "table" then
if type(msg.content.content) == "string" then
display_content = msg.content.content
else
display_content = "[Message Cannot Be Displayed]"
end
end
for _, text in ipairs(vim.split(display_content or "", "\n", { plain = true, trimempty = trimempty })) do
table.insert(lines, text)
end

Expand Down