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

Function deriveChatDebugSeed

coderd/x/chatd/chatd.go:3478–3499  ·  view source on GitHub ↗
(messages []database.ChatMessage)

Source from the content-addressed store, hash-verified

3476}
3477
3478func deriveChatDebugSeed(messages []database.ChatMessage) (
3479 triggerMessageID int64,
3480 historyTipMessageID int64,
3481 triggerLabel string,
3482) {
3483 for i := len(messages) - 1; i >= 0; i-- {
3484 if messages[i].Role != database.ChatMessageRoleUser {
3485 continue
3486 }
3487 triggerMessageID = messages[i].ID
3488 if parts, parseErr := chatprompt.ParseContent(messages[i]); parseErr == nil {
3489 triggerLabel = contentBlocksToText(parts)
3490 }
3491 break
3492 }
3493
3494 if len(messages) > 0 {
3495 historyTipMessageID = messages[len(messages)-1].ID
3496 }
3497
3498 return triggerMessageID, historyTipMessageID, triggerLabel
3499}
3500
3501func prepareChatTurnDebugRun(
3502 ctx context.Context,

Callers 1

runChatMethod · 0.85

Calls 2

ParseContentFunction · 0.92
contentBlocksToTextFunction · 0.85

Tested by

no test coverage detected