mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
18 lines
565 B
TypeScript
18 lines
565 B
TypeScript
// Function to generate a Markdown representation of the current conversation
|
|
import { type Instance } from 'mobx-state-tree';
|
|
|
|
import { type IMessage } from '../../../stores/ClientChatStore';
|
|
|
|
export function formatConversationMarkdown(messages: Instance<typeof IMessage>[]): string {
|
|
return messages
|
|
.map(message => {
|
|
if (message.role === 'user') {
|
|
return `**You**: ${message.content}`;
|
|
} else if (message.role === 'assistant') {
|
|
return `**yachtpit-ai**: ${message.content}`;
|
|
}
|
|
return '';
|
|
})
|
|
.join('\n\n');
|
|
}
|