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

Callers 2

ProbeMethod · 0.95
sendChatMethod · 0.95

Calls 1

doPostMethod · 0.95

Tested by

no test coverage detected