diff --git a/core/commands/slash/share.ts b/core/commands/slash/share.ts index 64754960a..151d7e389 100644 --- a/core/commands/slash/share.ts +++ b/core/commands/slash/share.ts @@ -1,10 +1,11 @@ +import path from "path"; import { SlashCommand } from "../.."; import { stripImages } from "../../llm/countTokens"; const ShareSlashCommand: SlashCommand = { name: "share", description: "Download and share this session", - run: async function* ({ ide, history }) { + run: async function* ({ ide, history, params }) { let content = `This is a session transcript from [Continue](https://continue.dev) on ${new Date().toLocaleString()}.`; for (const msg of history) { @@ -13,10 +14,14 @@ const ShareSlashCommand: SlashCommand = { }\n\n${stripImages(msg.content)}`; } - const continueDir = await ide.getContinueDir(); - const path = `${continueDir}/session.md`; - await ide.writeFile(path, content); - await ide.openFile(path); + let outputDir = params?.outputDir; + if (!outputDir) { + outputDir = await ide.getContinueDir(); + } + + const outPath = path.join(outputDir, `session.md`); + await ide.writeFile(outPath, content); + await ide.openFile(outPath); yield `The session transcript has been saved to a markdown file at \`${path}\`.`; }, diff --git a/core/config/default.ts b/core/config/default.ts index 131479800..4a7bdf628 100644 --- a/core/config/default.ts +++ b/core/config/default.ts @@ -39,7 +39,8 @@ export const defaultConfig: SerializedContinueConfig = { }, { name: "share", - description: "Export this session as markdown", + description: "Export the current chat session to markdown", + params: { ouputDir: "Directory in which to export this session" }, }, { name: "cmd", @@ -110,7 +111,8 @@ export const defaultConfigJetBrains: SerializedContinueConfig = { }, { name: "share", - description: "Export this session as markdown", + description: "Export the current chat session to markdown", + params: { ouputDir: "Directory in which to export this session" }, }, ], customCommands: [ diff --git a/docs/docs/config-file-migration.md b/docs/docs/config-file-migration.md index 5184785d5..d67dad265 100644 --- a/docs/docs/config-file-migration.md +++ b/docs/docs/config-file-migration.md @@ -131,7 +131,8 @@ After the "Full example" these examples will only show the relevant portion of t }, { "name": "share", - "description": "Download and share this session", + "description": "Export the current chat session to markdown", + "params": { "ouputDir": "Directory in which to export this session" }, "step": "ShareSessionStep" }, { diff --git a/docs/docs/customization/slash-commands.md b/docs/docs/customization/slash-commands.md index da8ac0d43..d521b09eb 100644 --- a/docs/docs/customization/slash-commands.md +++ b/docs/docs/customization/slash-commands.md @@ -43,7 +43,8 @@ Type "/share" to generate a shareable markdown transcript of your current chat h ```json { "name": "share", - "description": "Download and share this session" + "description": "Export the current chat session to markdown", + "params": { "ouputDir": "Directory in which to export this session" } } ``` diff --git a/docs/docs/walkthroughs/config-file-migration.md b/docs/docs/walkthroughs/config-file-migration.md index 1a253e18e..47c2efdc0 100644 --- a/docs/docs/walkthroughs/config-file-migration.md +++ b/docs/docs/walkthroughs/config-file-migration.md @@ -130,7 +130,8 @@ After the "Full example" these examples will only show the relevant portion of t }, { "name": "share", - "description": "Download and share this session", + "description": "Export the current chat session to markdown", + "params": { "ouputDir": "Directory in which to save this session" }, "step": "ShareSessionStep" }, { diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/ServerConstants.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/ServerConstants.kt index f27514340..8bea73fc7 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/ServerConstants.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/ServerConstants.kt @@ -41,7 +41,7 @@ const val DEFAULT_CONFIG = """ }, { "name": "share", - "description": "Download and share this session", + "description": "Export the current chat session to markdown", "step": "ShareSessionStep" }, { diff --git a/gui/src/redux/slices/stateSlice.ts b/gui/src/redux/slices/stateSlice.ts index 99d52ae72..87ea78705 100644 --- a/gui/src/redux/slices/stateSlice.ts +++ b/gui/src/redux/slices/stateSlice.ts @@ -108,7 +108,8 @@ const initialState: State = { }, { name: "share", - description: "Download and share this session", + description: "Export the current chat session to markdown", + params: { ouputDir: "Directory in which to save this session" }, }, { name: "cmd",