MCPcopy Index your code
hub / github.com/coder/coder / selectManualTitleTurnIndexes

Function selectManualTitleTurnIndexes

coderd/x/chatd/quickgen.go:677–695  ·  view source on GitHub ↗
(turns []manualTitleTurn)

Source from the content-addressed store, hash-verified

675}
676
677func selectManualTitleTurnIndexes(turns []manualTitleTurn) []int {
678 firstUserIndex := slices.IndexFunc(turns, func(turn manualTitleTurn) bool {
679 return turn.role == string(database.ChatMessageRoleUser)
680 })
681 if firstUserIndex == -1 {
682 return nil
683 }
684
685 windowStart := max(0, len(turns)-recentTurnWindow)
686 selected := make([]int, 0, recentTurnWindow+1)
687 if firstUserIndex < windowStart {
688 selected = append(selected, firstUserIndex)
689 }
690 for i := windowStart; i < len(turns); i++ {
691 selected = append(selected, i)
692 }
693
694 return selected
695}
696
697func buildManualTitleContext(
698 turns []manualTitleTurn,

Callers 2

generateManualTitleFunction · 0.85

Calls

no outgoing calls

Tested by 1