mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-15 09:21:36 +00:00
fix(tui): stream legacy thinking deltas visibly
This commit is contained in:
parent
bc17310442
commit
7d68ea9501
2 changed files with 20 additions and 1 deletions
|
|
@ -123,6 +123,20 @@ describe('createGatewayEventHandler', () => {
|
|||
expect(appended[0]?.toolTokens).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('streams legacy thinking.delta into visible reasoning state', () => {
|
||||
vi.useFakeTimers()
|
||||
const appended: Msg[] = []
|
||||
const streamed = 'short streamed reasoning'
|
||||
|
||||
createGatewayEventHandler(buildCtx(appended))({ payload: { text: streamed }, type: 'thinking.delta' } as any)
|
||||
vi.runOnlyPendingTimers()
|
||||
|
||||
expect(getTurnState().reasoning).toBe(streamed)
|
||||
expect(getTurnState().reasoningActive).toBe(true)
|
||||
expect(getTurnState().reasoningTokens).toBe(estimateTokensRough(streamed))
|
||||
vi.useRealTimers()
|
||||
})
|
||||
|
||||
it('ignores fallback reasoning.available when streamed reasoning already exists', () => {
|
||||
const appended: Msg[] = []
|
||||
const streamed = 'short streamed reasoning'
|
||||
|
|
|
|||
|
|
@ -220,7 +220,12 @@ export function createGatewayEventHandler(ctx: GatewayEventHandlerContext): (ev:
|
|||
const text = ev.payload?.text
|
||||
|
||||
if (text !== undefined) {
|
||||
scheduleThinkingStatus(text ? String(text) : statusFromBusy())
|
||||
const value = String(text)
|
||||
scheduleThinkingStatus(value || statusFromBusy())
|
||||
|
||||
if (value) {
|
||||
turnController.recordReasoningDelta(value)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue