Files
brave-core/components
Jocelyn Liu 0b1e640fa9 [Leo] [BYOM] Add support of title generation (#30992)
This PR changes ConversationHandler::OnEngineCompletionComplete which is
called when an assistance response generation is completed. When we
received the completion of the first assistant response in the
conversation, for engines which require a client side title generation
(all custom models), after reporting the conversation history updates
from the agent response to UI, we keep request_in_progress_ to be true
and send a separate title generation request. Previous actions which
happen in the end of assistance completion will be performed after title
generation is done regardless of whether the title generation is
successful or not.

This PR also implements GenerateConversationTitle in OAI engine, which
mimics what we do on the server side for conversation API engines. We
first create messages with attach associated content up to 1200 chars
each. Then append a message for requesting title using the same title
prompt we have on server side, which would include first user turn's
text or the first assistant response's text (if there are uploaded
files) in the content. Lastly, append a message for seeding the
response and use </title> as the stop sequence. A successful title
response with title less than 100 chars will be used to update the
conversation title, otherwise it would just be dropped or failed
silently.
2025-09-04 15:35:48 -07:00
..
2025-08-19 19:54:15 +01:00
2025-09-01 20:10:34 +07:00