Skip to content

Commit

Permalink
build: 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Dec 6, 2022
1 parent d6cf499 commit 5b3c282
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
# [Mirai OpenAi Plugin](https://github.com/cssxsh/mirai-openai-plugin)
# [Mirai OpenAI Plugin](https://github.com/cssxsh/mirai-openai-plugin)

> Mirai Console 下的 OpenAi Chat Bot 插件
> Mirai Console 下的 OpenAI Chat Bot 插件
[![maven-central](https://img.shields.io/maven-central/v/xyz.cssxsh.mirai/mirai-openai-plugin)](https://search.maven.org/artifact/xyz.cssxsh.mirai/mirai-openai-plugin)
[![test](https://github.com/cssxsh/mirai-openai-plugin/actions/workflows/test.yml/badge.svg)](https://github.com/cssxsh/mirai-openai-plugin/actions/workflows/test.yml)

Be based on <https://chat.openai.com/>
OpenAi 目前对注册有一定要求,请先阅读 [注册](#注册)
OpenAI 目前对注册有一定要求,请先阅读 [注册](#注册)

## 效果

![screenshot](example/screenshot.jpg)

## 配置

* `completion_prefix` 触发前缀, 默认 `> `
* `token` [OPENAI_TOKEN](https://beta.openai.com/account/api-keys), 插件第一次启动时会要求输入,不用编辑文件,
`openai.yml`

* `completion_prefix` 问答触发前缀, 默认 `> `
* `image_prefix` 图片生成触发前缀, 默认 `? `
* `token` [OPENAI_TOKEN](https://beta.openai.com/account/api-keys), 插件第一次启动时会要求输入,不用编辑文件

`completion.yml`

* `max_tokens` 回答长度

`image.yml`

* `number` 图片张数
* `size` 可选的范围是固定的,请不要更改
* `format` 下载方式,请不要更改

### 注册

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

group = "xyz.cssxsh.mirai"
version = "1.0.0"
version = "1.0.1"

mavenCentralPublish {
useCentralS01()
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/xyz/cssxsh/mirai/openai/MiraiOpenAiPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ public object MiraiOpenAiPlugin : KotlinPlugin(
JvmPluginDescription(
id = "xyz.cssxsh.mirai.plugin.mirai-openai-plugin",
name = "mirai-openai-plugin",
version = "1.0.0",
version = "1.0.1",
) {
author("cssxsh")
}
) {
override fun onEnable() {
MiraiOpenAiConfig.reload()
CompletionConfig.reload()
ImageConfig.reload()

if (MiraiOpenAiConfig.token.isEmpty()) {
val token = runBlocking { ConsoleInput.requestInput(hint = "请输入 OPENAI_TOKEN") }
Expand Down
2 changes: 0 additions & 2 deletions src/main/kotlin/xyz/cssxsh/mirai/openai/config/ImageConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ internal object ImageConfig : ReadOnlyPluginConfig("image") {
val format: ImageResponseFormat by value(ImageResponseFormat.URL)

fun push(builder: ImageRequest.Builder) {
builder.number = number
builder.size = size
builder.number = number
builder.size = size
builder.format = format
Expand Down

0 comments on commit 5b3c282

Please sign in to comment.