mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
fix(web): show Pi reasoning effort (#1303)
This commit is contained in:
@@ -6,7 +6,10 @@ import { I18nProvider } from '@/lib/i18n-context'
|
||||
import { ToastProvider } from '@/lib/toast-context'
|
||||
import { resolveSessionHeaderMachineLabel, SessionHeader } from './SessionHeader'
|
||||
|
||||
afterEach(() => cleanup())
|
||||
afterEach(() => {
|
||||
cleanup()
|
||||
localStorage.clear()
|
||||
})
|
||||
|
||||
function baseSession(overrides: Partial<Session> = {}): Session {
|
||||
return {
|
||||
@@ -79,6 +82,55 @@ describe('SessionHeader', () => {
|
||||
expect(screen.queryByText('reasoning default')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('shows Pi ordinary effort as reasoning metadata', () => {
|
||||
renderHeader(baseSession({
|
||||
metadata: { flavor: 'pi', path: '/repo', host: 'machine' },
|
||||
modelReasoningEffort: null,
|
||||
effort: 'max'
|
||||
}))
|
||||
|
||||
expect(screen.getByTestId('session-header-reasoning')).toHaveTextContent('reasoning max')
|
||||
})
|
||||
|
||||
it('keeps model reasoning effort for Codex and hides ordinary effort for non-Pi flavors', () => {
|
||||
const { rerender } = renderHeader(baseSession({
|
||||
modelReasoningEffort: 'xhigh',
|
||||
effort: 'max'
|
||||
}))
|
||||
|
||||
expect(screen.getByTestId('session-header-reasoning')).toHaveTextContent('reasoning xhigh')
|
||||
|
||||
rerender(
|
||||
<QueryClientProvider client={new QueryClient()}>
|
||||
<ToastProvider>
|
||||
<I18nProvider>
|
||||
<SessionHeader
|
||||
session={baseSession({
|
||||
metadata: { flavor: 'claude', path: '/repo', host: 'machine' },
|
||||
modelReasoningEffort: null,
|
||||
effort: 'max'
|
||||
})}
|
||||
onBack={vi.fn()}
|
||||
api={null}
|
||||
/>
|
||||
</I18nProvider>
|
||||
</ToastProvider>
|
||||
</QueryClientProvider>
|
||||
)
|
||||
|
||||
expect(screen.queryByTestId('session-header-reasoning')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('hides Pi reasoning metadata when the header reasoning setting is disabled', () => {
|
||||
localStorage.setItem('hapi-session-header-metadata', JSON.stringify({ reasoning: false }))
|
||||
renderHeader(baseSession({
|
||||
metadata: { flavor: 'pi', path: '/repo', host: 'machine' },
|
||||
effort: 'max'
|
||||
}))
|
||||
|
||||
expect(screen.queryByTestId('session-header-reasoning')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('shows machine label and relative last-active age in the meta row', () => {
|
||||
const fiveMinutesAgo = Date.now() - 5 * 60_000
|
||||
renderHeader(baseSession({
|
||||
|
||||
Reference in New Issue
Block a user