fix: add X-Hermes-Session-Id header to preserve tool context across turns (#240)
Fixes #237 When web-ui sends a chat message, it includes conversation_history with only user and assistant messages — tool calls and tool results are filtered out. Meanwhile, it sends session_id in the request body but does NOT pass the X-Hermes-Session-Id header. Without the header, the gateway falls back to using the incomplete conversation_history from the body, so the AI agent loses context about previous tool calls, especially after idle periods. Fix: Pass X-Hermes-Session-Id as a request header so the gateway loads complete session history from the session DB (including tool messages). Co-authored-by: 356252190-star <356252190-star@users.noreply.github.com>
This commit is contained in:
@@ -41,9 +41,14 @@ export interface RunEvent {
|
||||
}
|
||||
|
||||
export async function startRun(body: StartRunRequest): Promise<StartRunResponse> {
|
||||
const headers: Record<string, string> = {}
|
||||
if (body.session_id) {
|
||||
headers['X-Hermes-Session-Id'] = body.session_id
|
||||
}
|
||||
return request<StartRunResponse>('/api/hermes/v1/runs', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
headers,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user