Skip to content

Commit

Permalink
feat: has_economy config
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Mar 17, 2023
1 parent cbf0dc2 commit b92222f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## 1.3.2 (23/03/17)

1. fix: depends on mirai-economy-core
2. fix: MiraiOpenAiTokens register
3. feat: has_economy config

## 1.3.1 (23/03/16)

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ OpenAI 目前对注册有一定要求,请先阅读 [注册](#注册), 然后
* `has_permission` 权限检查, 为 `true` 时开启
* `at_once` 立刻开始聊天/问答(即不会发送 `聊天/问答将开始`, 而是直接接着指令开始聊天) 默认 `false`
* `keep_prefix_check` 保持前缀检查(即一定要附带前缀/`@`才会触发对话),默认 `false`
* `has_economy` 经济系统, 为 `true` 时开启 @see <https://github.com/cssxsh/mirai-economy-core>

`completion.yml` 自定义模型详细配置

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,8 @@ internal object MiraiOpenAiConfig : ReadOnlyPluginConfig("openai"), OpenAiClient
@ValueName("has_permission")
@ValueDescription("权限检查")
val permission: Boolean by value(false)

@ValueName("has_economy")
@ValueDescription("接入经济系统")
val economy: Boolean by value(true)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package xyz.cssxsh.mirai.openai.data
import net.mamoe.mirai.contact.*
import xyz.cssxsh.mirai.economy.*
import xyz.cssxsh.mirai.openai.*
import xyz.cssxsh.mirai.openai.config.*

public object MiraiOpenAiTokensData {

@PublishedApi
internal val economy: Boolean by lazy {
try {
MiraiOpenAiConfig.economy && try {
EconomyService.register(MiraiOpenAiTokens)
true
} catch (_: Throwable) {
Expand Down

0 comments on commit b92222f

Please sign in to comment.