From 019d9daa670a015cd125b9b8569cb90f6d9bf8d4 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Thu, 19 Dec 2024 14:44:36 +0800 Subject: [PATCH] =?UTF-8?q?Feat:=20=E5=A2=9E=E5=8A=A0=20AI=20=E6=91=98?= =?UTF-8?q?=E8=A6=81=E7=AD=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/_default/params.en.toml | 17 +++++ config/_default/params.toml | 46 ++++++++++++ config/_default/params.zh-cn.toml | 17 +++++ .../getting-started/configuration/index.md | 71 ++++++++++++++++++- .../getting-started/configuration/index.md | 71 ++++++++++++++++++- go.mod | 2 +- go.sum | 4 +- 7 files changed, 221 insertions(+), 7 deletions(-) diff --git a/config/_default/params.en.toml b/config/_default/params.en.toml index 339467a..95434a7 100644 --- a/config/_default/params.en.toml +++ b/config/_default/params.en.toml @@ -14,6 +14,23 @@ [cse.google] cx = "27010f0a2633d4da4" +[postChat] + userDesc = "If you have any questions about FixIt, you can ask me~" + defaultChatQuestions = [ + "How to install the FixIt theme?", + "What features does the FixIt theme have?", + "FixIt theme ecosystem" + ] + defaultSearchQuestions = [ + "Quick Start", + "Configure FixIt", + "Content Management", + "Advanced Usage" + ] + +[postSummary] + title = "AI Summary" + [header] [header.subtitle] name = "Theme for Hugo" diff --git a/config/_default/params.toml b/config/_default/params.toml index 52366ad..b81f47b 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -731,6 +731,52 @@ disableThemeInject = false # "corner-indicator", "fill-left", "flash", "flat-top", "loading-bar", "mac-osx", "material", "minimal"] theme = "minimal" +# FixIt 0.3.17 | NEW PostChat AI config +# Based on your posts to build a knowledge base, support AI summary, AI search, and AI Chatbot. +# Get PostChat Key from my invitation link, thanks for your support! +# https://ai.tianli0.top/?InviteID=IRE1S88Z +[postChat] + enable = true + key = "ed872bf9336506bea545183089f5034f81fea6af" + # How users initiate chats: ["iframe", "magic"] + userMode = "magic" + addButton = true + defaultInput = false + left = "" + bottom = "" + width = "" + height = "" + fill = "" + backgroundColor = "#FF735A" + upLoadWeb = true + showInviteLink = true + userTitle = "Cell+" + userDesc = "" + # dom container to be blacked out, e.g. [".aplayer"] + blackDom = [] + # Only for iframe mode + frameWidth = "" # e.g. "375px" + frameHeight = "" # e.g. "600px" + # only for magic mode + userIcon = "" + defaultChatQuestions = [] + defaultSearchQuestions = [] + +# FixIt 0.3.17 | NEW Summary AI config +# See https://postchat.zhheo.com/summary.html +[postSummary] + enable = true + # If you set `params.postChat.key`, you don't need to set `params.postSummary.key` + key = "" + title = "" + # themes options: ["", "simple", "yanzhi"] + theme = "" + postURL = "" + blacklist = "" + wordLimit = 1000 + typingAnimate = true + beginningText = "" + # FixIt 0.3.10 | NEW Global Feed config for RSS, Atom and JSON feed. # FixIt 0.3.10 | 新增 全局 Feed 配置用于 RSS, Atom 和 JSON feed。 [feed] diff --git a/config/_default/params.zh-cn.toml b/config/_default/params.zh-cn.toml index e3a1bc6..7a37d1b 100644 --- a/config/_default/params.zh-cn.toml +++ b/config/_default/params.zh-cn.toml @@ -17,6 +17,23 @@ description = "一个简洁、优雅且高效的 Hugo 主题 FixIt" [cse.google] cx = "83ffebf0680ff4971" +[postChat] + userDesc = "如果你对 FixIt 有任何疑问,可以来问我哦~" + defaultChatQuestions = [ + "怎么安装 FixIt 主题?", + "FixIt 主题有哪些功能?", + "FixIt 主题生态系统", + ] + defaultSearchQuestions = [ + "快速上手", + "配置 FixIt", + "内容管理", + "进阶使用" + ] + +[postSummary] + title = "AI 摘要" + [header] [header.subtitle] name = "Hugo 主题" diff --git a/content/en/documentation/getting-started/configuration/index.md b/content/en/documentation/getting-started/configuration/index.md index b37fe23..7faa59c 100644 --- a/content/en/documentation/getting-started/configuration/index.md +++ b/content/en/documentation/getting-started/configuration/index.md @@ -488,7 +488,7 @@ enable : `bool` Whether to enable search. Default is `false`. type -: `string` The type of search engine. The configuration value for `type` can be one of `algolia`, `fuse` or `cse`. Default is `fuse`. +: `string` The type of search engine. The configuration value for `type` can be one of `algolia`, `fuse`, `cse` or `post-chat`. Default is `fuse`. contentLength : `int` The max index length of the chunked content. Default is `4000`. @@ -531,7 +531,7 @@ fuse --- -Based on [algolia][algolia], [Fuse.js][fusejs] or [Custom Search Engine](#cse), searching is supported in **FixIt** theme. +Based on [algolia][algolia], [Fuse.js][fusejs], [Custom Search Engine](#cse) or [PostChat](#postchat), searching is supported in **FixIt** theme. In order to generate `search.json` for searching, add `search` output file type to the `home` of the `outputs` part in your site configuration. @@ -1436,6 +1436,72 @@ color theme : `string` The theme of pace. All available themes: `barber-shop`, `big-counter`, `bounce`, `center-atom`, `center-circle`, `center-radar`, `center-simple`, `corner-indicator`, `fill-left`, `flash`, `flat-top`, `loading-bar`, `mac-osx`, `material`, `minimal`. Default is `minimal`. +### postChat + +{{< version 0.3.17 >}} + +`map` [PostChat][postchat] AI Configuration. + +> [!NOTE] +> The `key` is required for the `postChat` to work. You can get the key from the [PostChat][postchat] website. + +```toml +[params] + # PostChat: https://postchat.zhheo.com/addCode.html + [params.postChat] + enable = true + key = "" + # How users initiate chats: ["iframe", "magic"] + userMode = "magic" + addButton = true + defaultInput = false + left = "" + bottom = "" + width = "" + height = "" + fill = "" + backgroundColor = "#FF735A" + upLoadWeb = true + showInviteLink = true + userTitle = "Cell+" + userDesc = "" + # dom container to be blacked out, e.g. [".aplayer"] + blackDom = [] + # Only for iframe mode + frameWidth = "" # e.g. "375px" + frameHeight = "" # e.g. "600px" + # only for magic mode + userIcon = "" + defaultChatQuestions = [] + defaultSearchQuestions = [] +``` + +### postSummary + +{{< version 0.3.17 >}} + +`map` PostSummary AI Configuration. + +> [!NOTE] +> The `key` is required for the `postSummary` to work. You can get the key from the [PostChat][postchat] website.\ +> _If you set `params.postChat.key`, you don't need to set `params.postSummary.key`._ + +```toml +[params] + # PostSummary: https://postchat.zhheo.com/summary.html + [params.postSummary] + enable = true + key = "" + title = "" + # themes options: ["", "simple", "yanzhi"] + theme = "" + postURL = "" + blacklist = "" + wordLimit = 1000 + typingAnimate = true + beginningText = "" +``` + ### customPartials {{< version 0.3.12 >}} @@ -1852,6 +1918,7 @@ They're easily created via . [vercount]: https://vercount.one/ [busuanzi]: https://busuanzi.ibruce.info/ [pacejs]: https://github.com/CodeByZach/pace +[postchat]: https://ai.tianli0.top/?InviteID=IRE1S88Z [block]: {{< relref path="/references/blocks" >}} [configuration-markup]: https://gohugo.io/getting-started/configuration-markup/ [necessary-configuration-for-theme]: https://github.com/hugo-fixit/FixIt/issues/43 diff --git a/content/zh-cn/documentation/getting-started/configuration/index.md b/content/zh-cn/documentation/getting-started/configuration/index.md index 423d628..a3850d8 100644 --- a/content/zh-cn/documentation/getting-started/configuration/index.md +++ b/content/zh-cn/documentation/getting-started/configuration/index.md @@ -490,7 +490,7 @@ enable : `bool` 是否启用搜索。 type -: `string` 搜索引擎的类型,可选值:`algolia`、`fuse` 或 `cse`,默认:`fuse`。 +: `string` 搜索引擎的类型,可选值:`algolia`、`fuse`、`cse` 或 `post-chat`,默认:`fuse`。 contentLength : `int` 文章内容最长索引长度。 @@ -533,7 +533,7 @@ fuse --- -基于 [algolia][algolia]、[Fuse.js][fusejs] 或者 [自定义搜索引擎](#cse),**FixIt** 主题支持搜索功能。 +基于 [algolia][algolia]、[Fuse.js][fusejs]、[自定义搜索引擎](#cse) 或者 [PostChat](#postchat),**FixIt** 主题支持搜索功能。 为了生成搜索功能所需要的 `search.json`, 请在你的站点配置中添加 `search` 输出文件类型到 `outputs` 部分的 `home` 字段中。 @@ -1435,6 +1435,72 @@ color theme : `string` 进度条主题,可选值:`barber-shop`、`big-counter`、`bounce`、`center-atom`、`center-circle`、`center-radar`、`center-simple`、`corner-indicator`、`fill-left`、`flash`、`flat-top`、`loading-bar`、`mac-osx`、`material`、`minimal`,默认:`minimal`。 +### postChat + +{{< version 0.3.17 >}} + +`map` [PostChat][postchat] AI 配置。 + +> [!NOTE] +> `key` 是 `postChat` 功能所必需的。你可以从 [PostChat][postchat] 网站获取该密钥。 + +```toml +[params] + # PostChat: https://postchat.zhheo.com/addCode.html + [params.postChat] + enable = true + key = "" + # 用户如何发起聊天:["iframe", "magic"] + userMode = "magic" + addButton = true + defaultInput = false + left = "" + bottom = "" + width = "" + height = "" + fill = "" + backgroundColor = "" + upLoadWeb = true + showInviteLink = true + userTitle = "Cell+" + userDesc = "" + # 需要屏蔽掉的 DOM 容器,例如:[".aplayer"] + blackDom = [] + # 仅适用于 iframe 模式 + frameWidth = "" # 例如:"375px" + frameHeight = "" # 例如:"600px" + # 仅适用于 magic 模式 + userIcon = "" + defaultChatQuestions = [] + defaultSearchQuestions = [] +``` + +### postSummary + +{{< version 0.3.17 >}} + +`map` PostSummary AI 配置。 + +> [!NOTE] +> `key` 是 `postSummary` 功能所必需的。你可以从 [PostChat][postchat] 网站获取该密钥。\ +> _如果你设置了 `params.postChat.key`,则无需设置 `params.postSummary.key`。_ + +```toml +[params] + # PostSummary: https://postchat.zhheo.com/summary.html + [params.postSummary] + enable = true + key = "" + title = "" + # 主题选项:["", "simple", "yanzhi"] + theme = "" + postURL = "" + blacklist = "" + wordLimit = 1000 + typingAnimate = true + beginningText = "" +``` + ### customPartials {{< version 0.3.12 >}} @@ -1851,6 +1917,7 @@ c4u [vercount]: https://vercount.one/ [busuanzi]: https://busuanzi.ibruce.info/ [pacejs]: https://github.com/CodeByZach/pace +[postchat]: https://ai.tianli0.top/?InviteID=IRE1S88Z [block]: {{< relref path="/references/blocks" >}} [configuration-markup]: https://gohugo.io/getting-started/configuration-markup/ [necessary-configuration-for-theme]: https://github.com/hugo-fixit/FixIt/issues/43 diff --git a/go.mod b/go.mod index 78dce4e..2986656 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/hugo-fixit/docs go 1.20 require ( - github.com/hugo-fixit/FixIt v0.3.16 // indirect + github.com/hugo-fixit/FixIt v0.3.17-0.20241219062055-036cbb415b1e // indirect github.com/hugo-fixit/cmpt-translate v1.3.0 // indirect github.com/hugo-fixit/component-projects v1.5.0 // indirect github.com/hugo-fixit/shortcode-caniuse v1.2.2 // indirect diff --git a/go.sum b/go.sum index f043ca9..cd0430f 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/hugo-fixit/FixIt v0.3.16 h1:ZffekHaqk/fJyuiagCdj1IjPczh5Dd57nnPZKSFWT6Q= -github.com/hugo-fixit/FixIt v0.3.16/go.mod h1:3XIRedrqakO7/a4ZnhE46haMRF8HgsT0N0B5j5D2iRU= +github.com/hugo-fixit/FixIt v0.3.17-0.20241219062055-036cbb415b1e h1:expoTaO4Ze86BLyyjWJRg901seXrBz5s9yE97V+FzoA= +github.com/hugo-fixit/FixIt v0.3.17-0.20241219062055-036cbb415b1e/go.mod h1:3XIRedrqakO7/a4ZnhE46haMRF8HgsT0N0B5j5D2iRU= github.com/hugo-fixit/cmpt-translate v1.3.0 h1:gvG2BbhWocQzOumyEIWvgJwr39ZrUm0FGh4M7Hk0uD0= github.com/hugo-fixit/cmpt-translate v1.3.0/go.mod h1:JZ0STubquTlRgyyGhGPlt2s0KJ1gCa99+P8ltTwQRM4= github.com/hugo-fixit/component-projects v1.5.0 h1:1FVgdGWm2GeJhJUfY20flelkH2a8+PyRGAFJHD385RU=