Support loading ACP sessions if agent can (#2889)
This commit is contained in:
@@ -1320,8 +1320,7 @@ function M._stream_acp(opts)
|
|||||||
if not session_id then
|
if not session_id then
|
||||||
M._create_acp_session_and_continue(opts, acp_client)
|
M._create_acp_session_and_continue(opts, acp_client)
|
||||||
else
|
else
|
||||||
if opts.just_connect_acp_client then return end
|
M._load_acp_session_and_continue(opts, acp_client, session_id)
|
||||||
M._continue_stream_acp(opts, acp_client, session_id)
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
return
|
return
|
||||||
@@ -1357,6 +1356,23 @@ function M._create_acp_session_and_continue(opts, acp_client)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param opts AvanteLLMStreamOptions
|
||||||
|
---@param acp_client avante.acp.ACPClient
|
||||||
|
---@param session_id string
|
||||||
|
function M._load_acp_session_and_continue(opts, acp_client, session_id)
|
||||||
|
local project_root = Utils.root.get()
|
||||||
|
acp_client:load_session(session_id, project_root, {}, function(_, err)
|
||||||
|
if err then
|
||||||
|
-- Failed to load session, create a new one. It happens after switching acp providers
|
||||||
|
M._create_acp_session_and_continue(opts, acp_client)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if opts.just_connect_acp_client then return end
|
||||||
|
M._continue_stream_acp(opts, acp_client, session_id)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
---@param opts AvanteLLMStreamOptions
|
---@param opts AvanteLLMStreamOptions
|
||||||
---@param acp_client avante.acp.ACPClient
|
---@param acp_client avante.acp.ACPClient
|
||||||
---@param session_id string
|
---@param session_id string
|
||||||
|
|||||||
Reference in New Issue
Block a user