Skip to content

Commit

Permalink
🐛 Fix(ignore): private posts disable upLoadWeb always
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Dec 19, 2024
1 parent e2eeaf9 commit 68b028e
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions layouts/partials/plugin/post-chat-ai.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@
TODO dark/light mode switch
TODO chat API development
*/ -}}
{{- $params := partial "function/params.html" -}}
{{- $chatConfig := .Site.Params.postChat -}}
{{- $summaryConfig := .Site.Params.postSummary -}}
{{- with .Params.postChat -}}
{{- $chatConfig = . | merge .Site.Params.postChat -}}
{{- end -}}
{{- with .Params.postSummary -}}
{{- $summaryConfig = . | merge .Site.Params.postSummary -}}
{{- end -}}
{{- $params := .Params | merge .Site.Params -}}
{{- $chatConfig := $params.postChat -}}
{{- $summaryConfig := $params.postSummary -}}
{{- $key := $chatConfig.key | default $summaryConfig.key -}}
{{- $sourcePrefix := "https://ai.tianli0.top/static/public/" -}}
{{- $jsMap := dict
Expand All @@ -22,7 +16,8 @@
"both" "postChatUser_summary.min.js"
-}}
{{- /* PostSummary only for public posts */ -}}
{{- $isPost := (eq .Kind "page") | and (eq .Type "posts") | and (not $params.password) -}}
{{- $password := .Params.password | default .Site.Params.page.password -}}
{{- $isPost := (eq .Kind "page") | and (eq .Type "posts") | and (not $password) -}}
{{- $summaryEnable := cond $isPost $summaryConfig.enable false -}}
{{- $enable := $chatConfig.enable | or $summaryEnable -}}

Expand Down Expand Up @@ -77,6 +72,7 @@
{{- with $chatConfig.blackDom -}}
{{- $blackDom = $blackDom | append . -}}
{{- end -}}
{{- $upLoadWeb := cond (.IsHome | or $password) false $chatConfig.upLoadWeb -}}
{{- $postChatConfig := dict
"userMode" $chatConfig.userMode
"defaultInput" $chatConfig.defaultInput
Expand All @@ -86,7 +82,7 @@
"height" $chatConfig.height
"fill" $chatConfig.fill
"backgroundColor" $chatConfig.backgroundColor
"upLoadWeb" (cond .IsHome false $chatConfig.upLoadWeb)
"upLoadWeb" $upLoadWeb
"showInviteLink" $chatConfig.showInviteLink
"userTitle" $chatConfig.userTitle
"userDesc" $chatConfig.userDesc
Expand Down

0 comments on commit 68b028e

Please sign in to comment.