Skip to content

Commit

Permalink
feat: config show_exception
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Apr 16, 2023
1 parent e3f7c43 commit f90f2c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ internal object MiraiOpenAiListener : SimpleListenerHost() {
event.subject.sendMessage(event.message.quote() + "OpenAI API 生成图片过大, 请重试")
}
is OpenAiException -> {
event.subject.sendMessage(event.message.quote() + "OpenAI API 异常, ${cause.message}")
if (MiraiOpenAiConfig.exception) {
event.subject.sendMessage(event.message.quote() + "OpenAI API 异常, ${cause.message}")
}
}
is IllegalStateException -> {
val info = cause.message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,8 @@ internal object MiraiOpenAiConfig : ReadOnlyPluginConfig("openai"), OpenAiClient
@ValueName("has_economy")
@ValueDescription("接入经济系统")
val economy: Boolean by value(true)

@ValueName("show_exception")
@ValueDescription("出现API异常时回复异常信息")
val exception: Boolean by value(true)
}

0 comments on commit f90f2c5

Please sign in to comment.