Skip to content

Commit

Permalink
fix: use title from API in markdown and html export
Browse files Browse the repository at this point in the history
  • Loading branch information
pionxzh committed Mar 9, 2023
1 parent 0c801cb commit 1f6f4d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/userscript/src/exporter/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export async function exportToHtml(fileNameFormat: string) {
.replaceAll('{{avatar}}', userAvatar)
.replaceAll('{{content}}', conversationHtml)

const fileName = getFileNameWithFormat(fileNameFormat, 'html')
const fileName = getFileNameWithFormat(fileNameFormat, 'html', { title })
downloadFile(fileName, 'text/html', standardizeLineBreaks(html))

return true
Expand Down
4 changes: 2 additions & 2 deletions packages/userscript/src/exporter/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export async function exportToMarkdown(fileNameFormat: string) {
}

// const { id, title, createTime, conversations } = await getConversations()
const { conversations } = await getConversations()
const { title, conversations } = await getConversations()

// const date = dateStr()
// const source = `${baseUrl}/chat/${id}`
Expand All @@ -38,7 +38,7 @@ export async function exportToMarkdown(fileNameFormat: string) {
// const markdown = `${frontMatter}\n\n${content}`
const markdown = content

const fileName = getFileNameWithFormat(fileNameFormat, 'md')
const fileName = getFileNameWithFormat(fileNameFormat, 'md', { title })
downloadFile(fileName, 'text/markdown', standardizeLineBreaks(markdown))

return true
Expand Down

0 comments on commit 1f6f4d7

Please sign in to comment.