Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialog export function #21

Open
chenkelmann opened this issue May 6, 2024 · 2 comments
Open

Dialog export function #21

chenkelmann opened this issue May 6, 2024 · 2 comments

Comments

@chenkelmann
Copy link

chenkelmann commented May 6, 2024

It would be useful if there where an option to export a dialog as it is currently shown (i.e. the currently selected alternatives etc.) as plain text or markdown.
We often use LLMs to brainstorm ideas and the actual brainstorming is sometimes useful as additional information for tickets etc.

This would be a leightweight version of the requested sharing (#8) - a simple local download into a file or to the clipboard would be enough.

@treo
Copy link
Contributor

treo commented May 6, 2024

This is likely a pretty easy to do, if you want to give it a try here are a few pointers:

async function downloadDatabase() {
downloadEnabled = false;
const data = JSON.stringify(await dumpDatabase(), null, 2);
const blob = new Blob([data], {type: 'application/octet-stream'});
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'technologic.json';
a.click();
window.URL.revokeObjectURL(url);
downloadEnabled = true;
}

This shows how we currently do the full db dump, you can use it as an example for how to do the file download. It boils down to creating a blob with the requested data and giving it a file name before triggering the download.

The actual message thread that is currently shown is available here:

$: currentMessageThread = currentConversation.messageThread;

And this shows how to use it to get access to the individual messages of that thread:

{#each $currentMessageThread.messages as msgAlt}
{@const msg = $currentConversation?.messages[msgAlt.self]}

All that's you'd really need to do is to add a new function in that file that puts the message content into a string.

If you'd rather have me do it, I can spend the additional 5 minutes that are necessary to get that done.

@chenkelmann
Copy link
Author

Added this ticket as a reminder for "when I have the time" (tm) - thanks for the pointers, will try it myself hopefully soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants