mirror of
https://github.com/koishijs/novelai-bot
synced 2025-01-08 11:17:32 +08:00
feat: support config.endpoint
This commit is contained in:
parent
c0fd65abab
commit
0ddb423f39
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "koishi-plugin-novelai",
|
||||
"description": "Generate images by NovelAI",
|
||||
"version": "1.3.0",
|
||||
"version": "1.3.1",
|
||||
"main": "lib/index.js",
|
||||
"typings": "lib/index.d.ts",
|
||||
"files": [
|
||||
|
@ -121,6 +121,13 @@ console.log(JSON.parse(localStorage.session).auth_token)
|
||||
|
||||
违禁词列表。含有违禁词的请求将被拒绝。
|
||||
|
||||
### endpoint
|
||||
|
||||
- 类型:`string`
|
||||
- 默认值:`'https://api.novelai.cn'`
|
||||
|
||||
API 服务器地址。如果你通过泄露的模型搭建了私服,可以将此项设置为你的服务器地址。
|
||||
|
||||
### requestTimeout
|
||||
|
||||
- 类型:`number`
|
||||
|
@ -35,6 +35,7 @@ export interface Config {
|
||||
sampler?: Sampler
|
||||
anatomy?: boolean
|
||||
forbidden?: string
|
||||
endpoint?: string
|
||||
requestTimeout?: number
|
||||
recallTimeout?: number
|
||||
maxConcurrency?: number
|
||||
@ -46,6 +47,7 @@ export const Config: Schema<Config> = Schema.object({
|
||||
orient: Schema.union(orients).description('默认的图片方向。').default('portrait'),
|
||||
sampler: Schema.union(samplers).description('默认的采样器。').default('k_euler_ancestral'),
|
||||
anatomy: Schema.boolean().default(true).description('是否过滤不合理构图。'),
|
||||
endpoint: Schema.string().description('API 服务器地址。').default('https://api.novelai.net'),
|
||||
forbidden: Schema.string().role('textarea').description('违禁词列表。含有违禁词的请求将被拒绝。').default(''),
|
||||
requestTimeout: Schema.number().role('time').description('当请求超过这个时间时会中止并提示超时。').default(Time.minute * 0.5),
|
||||
recallTimeout: Schema.number().role('time').description('图片发送后自动撤回的时间 (设置为 0 以禁用此功能)。').default(0),
|
||||
@ -112,7 +114,7 @@ export function apply(ctx: Context, config: Config) {
|
||||
session.send(session.text('.waiting'))
|
||||
|
||||
try {
|
||||
const art = await ctx.http.axios('https://api.novelai.net/ai/generate-image', {
|
||||
const art = await ctx.http.axios(config.endpoint + '/ai/generate-image', {
|
||||
method: 'POST',
|
||||
timeout: config.requestTimeout,
|
||||
headers: {
|
||||
|
@ -3,7 +3,8 @@ commands:
|
||||
description: AI 画图
|
||||
usage: |-
|
||||
输入用逗号隔开的英文标签,例如 Mr.Quin, dark sword, red eyes。
|
||||
查找标签可以使用 Danbooru。
|
||||
查找标签可以使用 https://danbooru.donmai.us/
|
||||
快来给仓库点个 star 吧:https://github.com/koishijs/koishi-plugin-novelai
|
||||
|
||||
options:
|
||||
model: 设定生成模型 (safe, nai, furry)
|
||||
|
Loading…
Reference in New Issue
Block a user