Skip to content

Commit

Permalink
fix: prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Jul 14, 2023
1 parent eb8149c commit 45a81b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -503,12 +503,12 @@ internal object MiraiOpenAiListener : SimpleListenerHost() {
val content = message.contentToString()
if (content.startsWith(MiraiOpenAiConfig.prompts).not()) return
val index = """\d+""".toRegex().find(content)?.value?.toInt() ?: 1
val page = MiraiOpenAiPrompts.keys().chunked(MiraiOpenAiConfig.page)
.getOrNull(index - 1).orEmpty()
val files = MiraiOpenAiPrompts.files()
val page = files.chunked(MiraiOpenAiConfig.page).getOrNull(index - 1).orEmpty()

launch {
subject.sendMessage(buildMessageChain {
appendLine("$page")
appendLine("${files.size} 个, $index")
appendLine()
page.forEach { name ->
appendLine(name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public object MiraiOpenAiPrompts : AutoSavePluginData("prompts") {
return bind.remove(id)
}

public fun keys(): List<String> {
public fun files(): List<String> {
return folder.list { _, name -> name.endsWith(".txt") }
?.asList().orEmpty()
}
Expand Down

0 comments on commit 45a81b4

Please sign in to comment.