FastGPT icon indicating copy to clipboard operation
FastGPT copied to clipboard

feat: processing web page content use readability

Open erweixin opened this issue 1 year ago • 6 comments

feat: processing web page content use readability

jsdom 依赖 canvas。需要做些处理。 话说 pnpm-lock.yaml 是怎么带上 mirror 的?

erweixin avatar Jan 07 '24 03:01 erweixin

Apply Sweep Rules to your PR?

  • [ ] Apply: All new business logic should have corresponding unit tests.
  • [ ] Apply: Refactor large functions to be more modular.
  • [ ] Apply: Add docstrings to all functions and file headers.

CLA assistant check
All committers have signed the CLA.

cla-assistant[bot] avatar Jan 07 '24 03:01 cla-assistant[bot]

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

cla-assistant[bot] avatar Jan 07 '24 03:01 cla-assistant[bot]

没有直接使用到jsdom 吧, 用 cherrio自带的了。

c121914yu avatar Jan 10 '24 07:01 c121914yu

没有直接使用到jsdom 吧, 用 cherrio自带的了。

Readability 的参数需要是 Document 对象,使用了 jsdom 将 string 转换成 Document。使用 Readability 可以剔除页面上的冗余信息。你可以评估下这个改动是否有必要。 before: 33d9df1c-b3e9-4e98-9d85-00b7467ecb40 after: YnKabTBuf9

erweixin avatar Jan 10 '24 14:01 erweixin

没有直接使用到jsdom 吧, 用 cherrio自带的了。

Readability 的参数需要是 Document 对象,使用了 jsdom 将 string 转换成 Document。使用 Readability 可以剔除页面上的冗余信息。你可以评估下这个改动是否有必要。 before: 33d9df1c-b3e9-4e98-9d85-00b7467ecb40 after: YnKabTBuf9

刚改完知识库整体交互。这周评估测试下,主要是 jsDOM 性能不太好

c121914yu avatar Jan 17 '24 02:01 c121914yu

jsDOM性能不是很好,对于单个请求是ok的,但是对于站点同步功能(由于商业版的站点同步复用了该代码),在进行多线程操作时,CPU会急剧上升。 Readability 这个库倒是个优化点,后续我再看看有没有合适的方法接入。可能会接入现在的 ,html转md那个流程,避免2次html转dom。

c121914yu avatar Feb 01 '24 14:02 c121914yu