MCPcopy Create free account
hub / github.com/codehamr/codehamr / postChat

Method postChat

internal/llm/llm.go:379–393  ·  view source on GitHub ↗

postChat dispatches via doPost; on a 400 rejecting reasoning it drops reasoning_effort for this Client's lifetime and retries once. Two wild flavours, both caught by substring match: newer OpenAI models ("reasoning_effort … not supported") and Ollama non-thinking models (" does not support th

(parent context.Context, body chatRequest)

Source from the content-addressed store, hash-verified

377 interFrame := min(idle, streamInterFrameTimeout)
378 var stalled, streaming atomic.Bool
379 window := atomic.Int64{}
380 window.Store(int64(idle))
381 watchdog := time.AfterFunc(idle, func() {
382 stalled.Store(true)
383 resp.Body.Close()
384 })
385
386 budget := cloud.FromHeaders(resp.Header)
387 ctxWindow := cloud.ContextWindowFromHeaders(resp.Header)
388 final, tokens, promptTokens, err := readSSE(parent, resp.Body, budget, out, func(output bool) {
389 if output {
390 streaming.Store(true)
391 window.Store(int64(interFrame))
392 }
393 watchdog.Reset(time.Duration(window.Load()))
394 })
395 watchdog.Stop()
396 if err != nil {

Callers 2

ProbeMethod · 0.95
sendChatMethod · 0.95

Calls 1

doPostMethod · 0.95

Tested by

no test coverage detected