Skip to content

Commit bc1b4fe

Browse files
authored
fix: support new parse_chat handler (#67)
Signed-off-by: xhe <xw897002528@gmail.com>
1 parent 8c6ca9f commit bc1b4fe

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

lua/codecompanion/_extensions/history/title_generator.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,9 @@ function TitleGenerator:_make_adapter_request(chat, prompt, callback)
226226
local opts = self.opts.title_generation_opts or {}
227227
local adapter = vim.deepcopy(chat.adapter) --[[@as CodeCompanion.HTTPAdapter | CodeCompanion.ACPAdapter]]
228228
local settings = vim.deepcopy(chat.settings)
229+
local adapters = require("codecompanion.adapters")
229230
if opts.adapter then
230-
adapter = require("codecompanion.adapters").resolve(opts.adapter)
231+
adapter = adapters.resolve(opts.adapter)
231232
end
232233
-- Early return for ACP adapters like gemini-cli or claude-code
233234
if adapter.type == "acp" then
@@ -254,7 +255,12 @@ function TitleGenerator:_make_adapter_request(chat, prompt, callback)
254255
return callback(nil)
255256
end
256257
if data then
257-
local result = _adapter.handlers.chat_output(_adapter, data)
258+
local result = nil
259+
if _adapter.handlers.chat_output then
260+
result = _adapter.handlers.chat_output(_adapter, data)
261+
else
262+
result = adapters.call_handler(_adapter, "parse_chat", data)
263+
end
258264
if result and result.status then
259265
if result.status == CONSTANTS.STATUS_SUCCESS then
260266
local title = vim.trim(result.output.content or "")

0 commit comments

Comments
 (0)