MCPcopy Create free account
hub / github.com/anomalyco/opencode / formatAssistantHeader

Function formatAssistantHeader

packages/tui/src/util/transcript.ts:67–82  ·  view source on GitHub ↗
(
  msg: AssistantMessage,
  includeMetadata: boolean,
  providers?: Provider[] | ReadonlyMap<string, Provider>,
)

Source from the content-addressed store, hash-verified

65}
66
67export function formatAssistantHeader(
68 msg: AssistantMessage,
69 includeMetadata: boolean,
70 providers?: Provider[] | ReadonlyMap<string, Provider>,
71): string {
72 if (!includeMetadata) {
73 return `## Assistant\n\n`
74 }
75
76 const duration =
77 msg.time.completed && msg.time.created ? ((msg.time.completed - msg.time.created) / 1000).toFixed(1) + "s" : ""
78
79 const modelName = Model.name(providers, msg.providerID, msg.modelID)
80
81 return `## Assistant (${Locale.titlecase(msg.agent)} · ${modelName}${duration ? ` · ${duration}` : ""})\n\n`
82}
83
84export function formatPart(part: Part, options: TranscriptOptions): string {
85 if (part.type === "text" && !part.synthetic) {

Callers 2

transcript.test.tsFile · 0.90
formatMessageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected