( session: SessionInfo, messages: MessageWithParts[], options: TranscriptOptions, )
| 24 | } |
| 25 | |
| 26 | export function formatTranscript( |
| 27 | session: SessionInfo, |
| 28 | messages: MessageWithParts[], |
| 29 | options: TranscriptOptions, |
| 30 | ): string { |
| 31 | const providers = Model.index(options.providers) |
| 32 | let transcript = `# ${session.title}\n\n` |
| 33 | transcript += `**Session ID:** ${session.id}\n` |
| 34 | transcript += `**Created:** ${new Date(session.time.created).toLocaleString()}\n` |
| 35 | transcript += `**Updated:** ${new Date(session.time.updated).toLocaleString()}\n\n` |
| 36 | transcript += `---\n\n` |
| 37 | |
| 38 | for (const msg of messages) { |
| 39 | transcript += formatMessage(msg.info, msg.parts, options, providers) |
| 40 | transcript += `---\n\n` |
| 41 | } |
| 42 | |
| 43 | return transcript |
| 44 | } |
| 45 | |
| 46 | export function formatMessage( |
| 47 | msg: UserMessage | AssistantMessage, |
no test coverage detected