diff --git a/core/commands/slash/share.ts b/core/commands/slash/share.ts index 55f4eef9c..c78b2ae4c 100644 --- a/core/commands/slash/share.ts +++ b/core/commands/slash/share.ts @@ -40,19 +40,23 @@ const ShareSlashCommand: SlashCommand = { run: async function* ({ ide, history, params }) { const now = new Date(); - let content = `This is a session transcript from [Continue](https://continue.dev) on ${now.toLocaleString()}.`; + let content = `### [Continue](https://continue.dev) session transcript\n Exported: ${now.toLocaleString()}`; - for (const msg of history) { + // As currently implemented, the /share command is by definition the last + // message in the chat history, this will omit it + for (const msg of history.slice(0, history.length - 1)) { let msgText = msg.content; msgText = stripImages(msg.content); - // if (msg.role === "user" && msgText.search("```") !== -1) { if (msg.role === "user" && msgText.search("```") > -1) { msgText = reformatCodeBlocks(msgText); } - content += `\n\n## ${ - msg.role === "user" ? "User" : "Assistant" + // format messages as blockquotes + msgText = msgText.replace(/^/gm, "> "); + + content += `\n\n#### ${ + msg.role === "user" ? "_User_" : "_Assistant_" }\n\n${msgText}`; }