Aesthetic tweaks to output format

This commit is contained in:
Peter Zaback 2024-04-19 14:29:30 -05:00
parent 2565fa4f41
commit d71f4f70d8

View file

@ -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}`;
}