[opt] TianliGpt

This commit is contained in:
xaoxuu 2023-05-09 13:09:05 +08:00
parent 53bbd972a6
commit 4195a103a6
4 changed files with 11 additions and 10 deletions

View File

@ -72,12 +72,6 @@ article:
enable: false
max_count: 5
# AI 摘要
TianliGpt:
post: true
wiki: true
api: 5Q5mpqRK5DkwT1X9Gi5e
search:
service: local_search # local_search, todo...
local_search: # 在 front-matter 中设置 indexing:false 来避免被搜索索引
@ -366,6 +360,13 @@ plugins:
js: /js/plugins/copycode.js
default_text: 'Copy'
success_text: 'Copied'
# AI 摘要
# https://github.com/zhheo/Post-Abstract-AI
tianli_gpt:
enable: false
field: post # all, post, wiki
api: 5Q5mpqRK5DkwT1X9Gi5e
style:
darkmode: auto # auto / always / false

View File

@ -1,7 +1,7 @@
<% if (page.layout === 'post' || (page.layout === 'wiki' && page.wiki && page.wiki.length > 0)) { %>
<script>
let tianliGPT_postSelector = '.md-text.content.<%= page.layout === 'post' ? 'post' : 'wiki' %>';
let tianliGPT_key = '<%= theme.TianliGpt.api %>';
let tianliGPT_key = '<%= theme.plugins.tianli_gpt.api %>';
</script>
<script src="https://cdn1.tianli0.top/gh/zhheo/Post-Abstract-AI@0.9/tianli_gpt.js"></script>
<script defer src="https://cdn1.tianli0.top/gh/zhheo/Post-Abstract-AI@0.9/tianli_gpt.js"></script>
<% } %>

View File

@ -29,7 +29,7 @@ if (theme.plugins.heti && theme.plugins.heti.enable) {
<article class='md-text content<%- heti %> <%- post.layout %><%- post.indent ? ' indent' : '' %><%- scrollreveal() %>'>
<%- layoutTitle() %>
<%- post.content %>
<% if (theme.TianliGpt.post) { %>
<% if (theme.plugins.tianli_gpt.enable && ['all', 'post'].includes(theme.plugins.tianli_gpt.field)) { %>
<%- partial('_partial/main/article/ai_abstract') %>
<% } %>
<%- partial('_partial/main/article/article_footer') %>

View File

@ -33,7 +33,7 @@ function layoutTitle() {
<article class='md-text content <%- page.layout %><%- page.indent ? ' indent' : '' %><%- scrollreveal() %>'>
<%- layoutTitle() %>
<%- page.content %>
<% if (theme.TianliGpt.wiki) { %>
<% if (theme.plugins.tianli_gpt.enable && ['all', 'wiki'].includes(theme.plugins.tianli_gpt.field)) { %>
<%- partial('_partial/main/article/ai_abstract') %>
<% } %>
<%- partial('_partial/main/article/article_footer') %>