HEIGE-PCloud / DoIt

A clean, elegant and advanced blog theme for Hugo.
https://hugodoit.pages.dev
MIT License
791 stars 195 forks source link

[FEATURE] Add OpenAI assisted retrieval support. #1208

Closed 0x5c0f closed 7 months ago

0x5c0f commented 7 months ago

Describe the feature you want 描述你的功能需求

我希望搜索功能可以支持Chatgpt辅助检索,或者在页面添加新的标签,用Chatgpt归纳总结当前页面的内容。

I hope the search function can support ChatGPT-assisted retrieval, or add new tags to the page to summarize the content using ChatGPT.

Useful reference 有价值的参考

https://fastgpt.in
https://platform.openai.com/docs/guides/embeddings https://github.com/zhheo/Post-Abstract-AI

Sped0n commented 7 months ago

Wouldn't recommend doing this unless you have a backend to support it, or you might compromise your api key due to the nature of static site.

HEIGE-PCloud commented 7 months ago

Interesting idea, not sure how useful it will be but you can probably implement content summarization by calling the LLM API endpoint during build time using https://gohugo.io/functions/resources/getremote/#remote-data

Assisted search will be more tricky, you probably have to deploy some other services for that.

eallion commented 7 months ago

Based on my personal experience, I do not recommend doing it this way. It is useless, difficult to maintain, and will increase costs.

From July 2023, a similar feature was added to my Blog^1, and the method adopted later was to pre-summarize with ChatGPT and place it in the front-matter of the post.

If there is no cache for summarize, it will consume a lot of tokens. If there is a cache, backend services are needed to handle the caching.

HEIGE-PCloud commented 7 months ago

It’s possible to control the cache using a hash of the article content https://gohugo.io/functions/resources/getremote/#caching but one does need to be very careful if one wants to build and publish using CI/CD pipelines. It’s also impossible to control or alter the the generated summary. I agree using external tools to summarize and then place the result into the front matter is a better approach.

Closing this for now.