From 4195a103a6a986595c2959916cda237294bb801c Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Tue, 9 May 2023 13:09:05 +0800 Subject: [PATCH] [opt] TianliGpt --- _config.yml | 13 +++++++------ layout/_partial/main/article/ai_abstract.ejs | 4 ++-- layout/post.ejs | 2 +- layout/wiki.ejs | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/_config.yml b/_config.yml index 36b6a3b..a1457c7 100755 --- a/_config.yml +++ b/_config.yml @@ -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 diff --git a/layout/_partial/main/article/ai_abstract.ejs b/layout/_partial/main/article/ai_abstract.ejs index 0433787..19db126 100644 --- a/layout/_partial/main/article/ai_abstract.ejs +++ b/layout/_partial/main/article/ai_abstract.ejs @@ -1,7 +1,7 @@ <% if (page.layout === 'post' || (page.layout === 'wiki' && page.wiki && page.wiki.length > 0)) { %> - + <% } %> diff --git a/layout/post.ejs b/layout/post.ejs index e1cfeab..8fdf749 100755 --- a/layout/post.ejs +++ b/layout/post.ejs @@ -29,7 +29,7 @@ if (theme.plugins.heti && theme.plugins.heti.enable) {
<%- 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') %> diff --git a/layout/wiki.ejs b/layout/wiki.ejs index f3a9f5a..f610f63 100755 --- a/layout/wiki.ejs +++ b/layout/wiki.ejs @@ -33,7 +33,7 @@ function layoutTitle() {
<%- 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') %>