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:
shivammittal274
2026-02-10 23:15:13 +05:30
committed by GitHub
parent 5fe94f74ac
commit 9508e2334b
2 changed files with 3 additions and 3 deletions

View File

@@ -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:

View File

@@ -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,
)
}