why there is a clean conversation buttons and there is nothing like save or download wich will be superhelpful ?
3 Likes
I saved this bit of code as a chrome bookmark(let) which downloads my chats when I push the button
javascript:(function() { try { const a = document.createElement('a'); const dom = document.querySelector('main > .flex-1 > .h-full .flex'); const template = document.createElement('template'); const title = document.title; template.innerHTML = dom.innerHTML; ['button'].forEach(selector => { template.content.querySelectorAll(selector).forEach(node => { node.remove(); }); }); a.href = URL.createObjectURL(new Blob([`<!DOCTYPE html> <html> <head> <title>Chat GPT: ${title}</title> <meta name="generator" content="chatGPT Saving Bookmark"/> <style> body { background-color: rgb(32,33,35); color: rgb(236,236,241); font-size: 16px; font-family: sans-serif; line-height: 28px; margin: -10px; } body > .w-full { padding: 30px; } /* prompt */ body > .w-full:nth-child(2n+1) { background: rgb(52,53,65); } /* response */ body > .w-full:nth-child(2n+2) { background: rgb(68,70,84); } a, a:visited { color: #7792cd; } pre { margin: 0 0 1em 0; display: inline-block; width: 100%; } pre code.hljs { margin-bottom: 1em; border-radius: 5px; } .whitespace-pre-wrap { white-space: pre-wrap; } .flex-col { max-width: 850px; margin: 0px auto; } </style> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.7.0/build/styles/default.min.css"/> </head> <body>${template.innerHTML}</body></html>%60], {type: 'text/html'})); const non_letters_re = /[^\p{L}\p{N}]+/gu; const trailing_dash_re = /(^-)|(-$)/g; a.download = title.toLowerCase() .replace(non_letters_re, "-") .replace(trailing_dash_re, '') + '.html'; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(a.href); } catch(e) { alert(e.message); } })();
2 Likes
sbennettkorea:
javascript:(function() { try { const a = document.createElement('a'); const dom = document.querySelector('main > .flex-1 > .h-full .flex'); const template = document.createElement('template'); const title = document.title; template.innerHTML = dom.innerHTML; ['button'].forEach(selector => { template.content.querySelectorAll(selector).forEach(node => { node.remove(); }); }); a.href = URL.createObjectURL(new Blob([
Chat GPT: {title}</title> <meta name="generator" content="chatGPT Saving Bookmark"/> <style> body { background-color: rgb(32,33,35); color: rgb(236,236,241); font-size: 16px; font-family: sans-serif; line-height: 28px; margin: -10px; } body > .w-full { padding: 30px; } /* prompt */ body > .w-full:nth-child(2n+1) { background: rgb(52,53,65); } /* response */ body > .w-full:nth-child(2n+2) { background: rgb(68,70,84); } a, a:visited { color: #7792cd; } pre { margin: 0 0 1em 0; display: inline-block; width: 100%; } pre code.hljs { margin-bottom: 1em; border-radius: 5px; } .whitespace-pre-wrap { white-space: pre-wrap; } .flex-col { max-width: 850px; margin: 0px auto; } </style> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.7.0/build/styles/default.min.css"/> </head> <body> {template.innerHTML}%60], {type: ‘text/html’})); const non_letters_re = /[^\p{L}\p{N}]+/gu; const trailing_dash_re = /(^-)|(-$)/g; a.download = title.toLowerCase() .replace(non_letters_re, “-”) .replace(trailing_dash_re, ‘’) + ‘.html’; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(a.href); } catch(e) { alert(e.message); } })();`
I will give this a try as it obviously seems incredibly useful. Do you use this often?
1 Like
I do for sure, especially after I have some good runs with the chat. It also is really helpful in keeping my conversation sidebar clean. Originally I started using it when I through I might have lost the history, but its been a while since I’ve seen that. Now its just another invaluable tool
The only down side is I couldn’t get the css exactly right but pretty close to where I’m happy.
(Oh I should mention, I believe I found the original code from here GitHub - jcubic/chat-gpt: ChatGPT conversation saving bookmark )
1 Like
Screenshot has been helpful since I can’t save chat history.
Create a bookmark and post the above Javascript code in place of the URL. Once you click on the bookmark you just created, you will get a pop-up prompt to save the html file.
It is incredibly useful.
1 Like
anf
March 16, 2023, 7:04am
7
sbennettkorea:
javascript:(function() { try { const a = document.createElement('a'); const dom = document.querySelector('main > .flex-1 > .h-full .flex'); const template = document.createElement('template'); const title = document.title; template.innerHTML = dom.innerHTML; ['button'].forEach(selector => { template.content.querySelectorAll(selector).forEach(node => { node.remove(); }); }); a.href = URL.createObjectURL(new Blob([`<!DOCTYPE html> <html> <head> <title>Chat GPT: ${title}</title> <meta name="generator" content="chatGPT Saving Bookmark"/> <style> body { background-color: rgb(32,33,35); color: rgb(236,236,241); font-size: 16px; font-family: sans-serif; line-height: 28px; margin: -10px; } body > .w-full { padding: 30px; } /* prompt */ body > .w-full:nth-child(2n+1) { background: rgb(52,53,65); } /* response */ body > .w-full:nth-child(2n+2) { background: rgb(68,70,84); } a, a:visited { color: #7792cd; } pre { margin: 0 0 1em 0; display: inline-block; width: 100%; } pre code.hljs { margin-bottom: 1em; border-radius: 5px; } .whitespace-pre-wrap { white-space: pre-wrap; } .flex-col { max-width: 850px; margin: 0px auto; } </style> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.7.0/build/styles/default.min.css"/> </head> <body>${template.innerHTML}</body></html>%60], {type: 'text/html'})); const non_letters_re = /[^\p{L}\p{N}]+/gu; const trailing_dash_re = /(^-)|(-$)/g; a.download = title.toLowerCase() .replace(non_letters_re, "-") .replace(trailing_dash_re, '') + '.html'; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(a.href); } catch(e) { alert(e.message); } })();
This is awesome! Just tested it in Chrome, and it worked. Thank you.
Now if only saving prompts were native to ChatGPT…
1 Like