mirror of
https://github.com/browseros-ai/BrowserOS.git
synced 2026-05-17 02:25:57 +00:00
fix: previous conversation history never injected on resume (#314)
Check session existence in ChatService before passing previousConversation to the agent. Only pass it for new sessions — existing sessions already have real conversation history in the GeminiClient.
This commit is contained in:
@@ -397,8 +397,7 @@ ${message}
|
||||
|
||||
// Inject previous conversation if resuming (no server-side history)
|
||||
let fullMessage = userQuery
|
||||
const hasHistory = this.client.getHistory().length > 0
|
||||
if (previousConversation && !hasHistory) {
|
||||
if (previousConversation) {
|
||||
fullMessage = `<previous_conversation>
|
||||
The user is resuming a previous conversation. Here is the conversation history for context:
|
||||
|
||||
|
||||
@@ -99,13 +99,14 @@ export class ChatService {
|
||||
isScheduledTask: request.isScheduledTask,
|
||||
}
|
||||
|
||||
const isNewSession = !sessionManager.has(request.conversationId)
|
||||
const agent = await sessionManager.getOrCreate(agentConfig, mcpServers)
|
||||
await agent.execute(
|
||||
request.message,
|
||||
rawStream,
|
||||
abortSignal,
|
||||
request.browserContext,
|
||||
request.previousConversation,
|
||||
isNewSession ? request.previousConversation : undefined,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user