MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / buildFinalMessages

Function buildFinalMessages

scripts/export-deepseek-session-traces.ts:219–234  ·  view source on GitHub ↗
(row: SessionRow)

Source from the content-addressed store, hash-verified

217}
218
219function buildFinalMessages(row: SessionRow): ChatMessage[] {
220 const request = getRequest(row)
221 const messages = [...getMessages(request)]
222 const response = row.response?.trim()
223
224 if (response && !hasSameAssistantText(messages, response)) {
225 messages.push({
226 role: 'assistant',
227 content: row.response,
228 ...(row.reasoning_text ? { reasoning_content: row.reasoning_text } : {}),
229 source_message_id: row.id,
230 })
231 }
232
233 return messages
234}
235
236async function fetchCandidateSessions(args: Args): Promise<CandidateRow[]> {
237 const targetStructs = TARGETS.flatMap((target) =>

Callers 1

buildTraceFunction · 0.85

Calls 3

getRequestFunction · 0.85
getMessagesFunction · 0.85
hasSameAssistantTextFunction · 0.85

Tested by

no test coverage detected