Skip to content

Commit

Permalink
Feat: 增加 AI 摘要等功能
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Dec 19, 2024
1 parent bc287f1 commit 019d9da
Show file tree
Hide file tree
Showing 7 changed files with 221 additions and 7 deletions.
17 changes: 17 additions & 0 deletions config/_default/params.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
46 changes: 46 additions & 0 deletions config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
17 changes: 17 additions & 0 deletions config/_default/params.zh-cn.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 主题"
Expand Down
71 changes: 69 additions & 2 deletions content/en/documentation/getting-started/configuration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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 >}}
Expand Down Expand Up @@ -1852,6 +1918,7 @@ They're easily created via <https://realfavicongenerator.net/>.
[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
Expand Down
71 changes: 69 additions & 2 deletions content/zh-cn/documentation/getting-started/configuration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ enable
: `bool` 是否启用搜索。

type
: `string` 搜索引擎的类型,可选值:`algolia``fuse``cse`,默认:`fuse`
: `string` 搜索引擎的类型,可选值:`algolia``fuse``cse``post-chat`,默认:`fuse`

contentLength
: `int` 文章内容最长索引长度。
Expand Down Expand Up @@ -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` 字段中。

Expand Down Expand Up @@ -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 >}}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
Expand Down

0 comments on commit 019d9da

Please sign in to comment.