cherry-studio icon indicating copy to clipboard operation
cherry-studio copied to clipboard

refactor: enhance export functions

Open GeorgeDong32 opened this issue 11 months ago • 4 comments

What this PR does

  • [x] 为Obsidian、Joplin添加思维链导出支持
  • [x] 修复Obsidian导出弹窗与应用风格、主题不一致的问题
  • [ ] 为Notion、语雀添加思维链导出支持(咕了,暂时没想好怎么做)
  • [x] 支持导出时包含模型名称
  • [ ] 修复Notion导出时超过API Limit的导致导出失败的问题(弃用简单分页)(咕了,下个pr再做)

    NotionAPI_Limits

相关issue

  • #5817
  • #5757

Why we need it and why it was done in this way

  • 所有本质为Markdown的导出选项全部经统一的接口处理,提高复用性和可维护性

Breaking changes

None

Special notes for your reviewer

Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR. Approvers are expected to review this list.

Release note


Summary by Sourcery

Introduce a configurable setting to display the model name in exported markdown messages, updating export utilities and settings interface accordingly.

New Features:

  • Add option to include model name in exported markdown messages.

Enhancements:

  • Update export functions and settings UI to support toggling model name display in markdown exports.

GeorgeDong32 avatar May 10 '25 16:05 GeorgeDong32

Reviewer's Guide

This PR refactors and enhances the export functions by adding an option to include the model name in exported markdown, updating the settings UI and store to support this feature, and adjusting the markdown export logic accordingly.

File-Level Changes

Change Details Files
Added support for including model name in exported markdown messages.
  • Extended export functions to optionally append model name to assistant messages if enabled in settings.
  • Updated messageToMarkdown and messageToMarkdownWithReasoning to use new setting.
src/renderer/src/utils/export.ts
Introduced a new setting to control model name display in markdown exports.
  • Added showModelNameInMarkdown to settings state and initial state.
  • Created setShowModelNameInMarkdown action and reducer in settings slice.
src/renderer/src/store/settings.ts
Updated settings UI to allow toggling model name display in markdown exports.
  • Added switch and help text for showModelNameInMarkdown in MarkdownExportSettings UI.
  • Connected UI to new setting and dispatch action on toggle.
src/renderer/src/pages/settings/DataSettings/MarkdownExportSettings.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it. You can also reply to a review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment @sourcery-ai summary on the pull request to (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar May 10 '25 16:05 sourcery-ai[bot]

@sourcery-ai review

GeorgeDong32 avatar May 20 '25 14:05 GeorgeDong32

这个pr有计划什么时候合入吗?

tenfyzhong avatar May 22 '25 05:05 tenfyzhong

这个pr有计划什么时候合入吗?

应该还要过两天,刚发现有点bug之前没测出来

GeorgeDong32 avatar May 24 '25 15:05 GeorgeDong32

#5757 好像没有实现 在 🤖 Assistant 旁附带一下就可以

Pleasurecruise avatar Jun 05 '25 05:06 Pleasurecruise

#5757 好像没有实现 在 🤖 Assistant 旁附带一下就可以

markdown设置里要开显示模型名称,没有的话可能开关逻辑有问题,我稍后看一下

GeorgeDong32 avatar Jun 05 '25 06:06 GeorgeDong32

哦哦 不好意思没看见 好像没问题了 先合并了

Pleasurecruise avatar Jun 05 '25 06:06 Pleasurecruise