Skip to content

Commit

Permalink
fix tianli_gpt (#392)
Browse files Browse the repository at this point in the history
- 更换前端为 qxchuckle/Post-Summary-AI 项目
  • Loading branch information
weekdaycare authored Feb 17, 2024
1 parent 01e438d commit 88f16fc
Show file tree
Hide file tree
Showing 3 changed files with 237 additions and 163 deletions.
11 changes: 7 additions & 4 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -448,15 +448,18 @@ plugins:
scale: 1 # 0.1~1

# AI 摘要
# https://github.com/zhheo/Post-Abstract-AI
# https://github.com/qxchuckle/Post-Summary-AI
tianli_gpt:
enable: #true
js: https://cdn1.tianli0.top/gh/zhheo/Post-Abstract-AI@0.15.2/tianli_gpt.min.js
js: https://jsd.onmicrosoft.cn/gh/qxchuckle/Post-Summary-AI@6.0/chuckle-post-ai.min.js
field: post # all, post, wiki
api: 5Q5mpqRK5DkwT1X9Gi5e # tianli_gpt key
limit: 1000 # 设置提交的字数限制,默认为1000字,上限为5000,超过5000字符将被截断,不能为空
limit: 1000 # 设置提交的字数限制,默认为1000字,上限为5000,超过5000字符将被截断
typingAnimate: true # 打字机动画

direct: true # 是否直接显示摘要,否则显示 AI 简介
recommend: all # all, web # 文章推荐方式,all:匹配数据库内所有文章进行推荐,web:仅当前站内的文章,默认all
shuttle: true # 是否隐藏矩阵穿梭

# Katex - The fastest math typesetting library for the web
# https://katex.org/docs/autorender.html
# https://github.com/KaTeX/KaTeX
Expand Down
30 changes: 22 additions & 8 deletions layout/_plugins/tianli_gpt.ejs
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
<% if (['all', page.layout].includes(theme.plugins.tianli_gpt.field)) { %>
<script>
let tianliGPT_postSelector = 'article.content';
let tianliGPT_key = `<%= theme.plugins.tianli_gpt?.api %>`;
let tianliGPT_typingAnimate = `<%= theme.plugins.tianli_gpt?.typingAnimate %>`;
let tianliGPT_wordLimit = `<%= theme.plugins.tianli_gpt?.limit %>`;
</script>
<script defer src="<%- theme.plugins.tianli_gpt?.js %>"></script>
<% } %>
<script src="<%- theme.plugins.tianli_gpt?.js %>"></script>
<script data-pjax defer>
new ChucklePostAI({
el: 'article.content',
key: '<%= theme.plugins.tianli_gpt?.api %>',
rec_method: '<%= theme.plugins.tianli_gpt?.recommend || all %>',
summary_directly: `<%= theme.plugins.tianli_gpt?.direct %>`,
typewriter: `<%= theme.plugins.tianli_gpt?.typingAnimate %>`,
css: `/css/_plugins/tianli_gpt`,
summary_toggle: false,
total_length: `<%= theme.plugins.tianli_gpt?.limit %>`,
hide_shuttle: `<%= theme.plugins.tianli_gpt?.shuttle %>`,
interface: {
name: "AI摘要",
introduce: "我是文章辅助AI: QX-AI,点击下方的按钮,让我生成本文简介、推荐相关文章等。", // 自我介绍
version: "TianliGPT",
button: ["介绍自己", "推荐文章", "生成摘要", "矩阵穿梭"],
},
})
</script>
<% } %>

Loading

0 comments on commit 88f16fc

Please sign in to comment.