【AI】网站文章添加智能摘要

前两天我在一个网站上看到一个很棒的智能摘要功能,研究后发现它是通过调用付费API实现的。奈何囊中羞涩,于是我把这个功能改造了一下,对接了百度千帆的免费API接口,既保留了原有功能的完整性,又实现了零成本部署。

1、下载文件

本文以子比主题演示,下载本文中的代码文件上传到主题的js和css目录中。

2、修改主题的func.php或者functions.php文件

最下面添加

图片[1]-【AI】网站文章添加智能摘要-优创百科

3、后台设置

记得去申请APIKey,这里就不演示怎么申请了

图片[2]-【AI】网站文章添加智能摘要-优创百科

4、效果

效果可以看一下本文开头

5、结束语

大家有米的话还是推荐支持一下大佬,和作者一样的就凑合用一下这个吧。

如果需要对接DeepSeek的可以参考本文文末下面的代码文件,DeepSeek我只是测试了一下,可以正常使用,但是没有切换主题的选项,动手能力强的博主可以自己修改一下

理论上,支持大部分主题,其他主题需要修改php代码中的,可以参考一下大佬的postSelector

'postSelector' => '.single-post .wp-posts-content',

这里列出一些常见博客主题的选择器值(部分未经过测试,如果有问题欢迎反馈):

主题名称tianliGPT_postSelectortianliGPT_postURL备注
hexo-theme-butterfly#post #article-container无需添加
hexo-theme-fluid#board .post-content无需添加
hexo-theme-next#posts .post-body无需添加
hexo-theme-stellar.md-text.content.post无需添加
hexo-theme-volantis#post #post-body无需添加
hugo-theme-DoIt.page.single:not(.special) .content无需添加
halo-theme-xue#container .article-content #lightGallery无需添加
wordpress: argon#post_content无需添加
wordpress: 7B2#primary-home .entry-content修改里面的域名:b2.7b2.com/*.html
wordpress:pix.single-contenthttps://*/*.html
wordpress: Sakurairo.post .entry-content无需添加
wordpress: 子比主题.single-post .wp-posts-content无需添加
wordpress: CorePress.post-content-content无需添加
wordpress: OneNav.post-template-default .panel-body无需添加
valaxy-theme-yun.content .markdown-body*/posts/*
typecho-bearsimple#post-content #bearsimple-images无需添加
typecho-bearhoney.post-content-block .content无需添加
typecho-handsome#postpage #md_handsome_origin无需添加
typecho-joe.joe_post .joe_detail__article无需添加
typecho-void.articleBody无需添加
© 版权声明
THE END
喜欢就支持一下吧
点赞5 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片快捷回复

    请登录后查看评论内容