Giter VIP home page Giter VIP logo

sena-nana / nonebot-plugin-novelai Goto Github PK

View Code? Open in Web Editor NEW
221.0 221.0 27.0 35.85 MB

Generate images by Stable-Diffusion-webui Based on Python | 使用Python的基于 SD-webui 的画图机器人(支持中文、Novelai和Naifu)

Home Page: https://nb.novelai.dev

License: MIT License

Python 100.00%
ai bot chatbot image koishi koishijs naifu nonebot nonebot-plugin nonebot2 novelai plugins python qq-bot qqbot stable-diffusion stable-diffusion-webui

nonebot-plugin-novelai's Introduction

晚上好~ 这里是星奈Sena⭐目前作为不活动系VUP996中~

こんばんは~せなです⭐いまわ活躍していないなVTBとして社畜中~

Ciallo~I'm Sena⭐Currently active as an inactive VTB~


  • 技能点分配/スギル/Skills

github profile trophy


友链(Bilibili)

灯火橘

$$\ce{$\unicode[goombafont; color:red; pointer-events: none; z-index: 100; position: fixed; top: 0; left: 0; height: 100vh; width: 130vw; opacity: 0.4; background-position: center; background-size: cover; background-image: url('https://raw.githubusercontent.com/sena-nana/sena-nana/master/bg.jpg');]{x0000}$}$$

nonebot-plugin-novelai's People

Contributors

lgc2333 avatar noahzark avatar sena-nana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nonebot-plugin-novelai's Issues

[Bug]: 再使用novelai开始绘图的时候报错

报告清单

  • 我已仔细阅读并了解上述注意事项
  • 我已使用最新版本测试过,确认问题依旧存在
  • 我确定在 GitHub Issues 中没有相同或相似的问题

发生错误的版本号

0.5.9

问题描述

依照手册上进行了设定并配置了novelai的api等之后

在群内输入.AIDRAW' 或者是召唤的指令 无任何反应

进后台看了一下显示报错

如何复现

  1. 我的运行环境是……windows 10 IOT
  2. 我对BOT使用的指令 .aidraw or 召唤等指令
  3. Python版本: 3.9.9
    5 Nonebot2版本: 2.0.0rc4
  4. 依照开始绘图指令操作了 .AIDRAW' qq群并没有反应 回到主控台有报错

预期行为

No response

日志信息

05-31 21:27:02 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_novelai.aidraw) failed.
Traceback (most recent call last):
File "C:\littlepaimon\bot.py", line 37, in
nonebot.run(app="mp_main:app", access_log=False)
File "C:\LittlePaimon.venv\lib\site-packages\nonebot_init_.py", line 309, in run
get_driver().run(*args, **kwargs)
File "C:\LittlePaimon.venv\lib\site-packages\nonebot\drivers\fastapi.py", line 198, in run
uvicorn.run(
File "C:\LittlePaimon.venv\lib\site-packages\uvicorn\main.py", line 568, in run
server.run()
File "C:\LittlePaimon.venv\lib\site-packages\uvicorn\server.py", line 59, in run
return asyncio.run(self.serve(sockets=sockets))
File "C:\Program Files\Python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 629, in run_until_complete
self.run_forever()
File "C:\Program Files\Python39\lib\asyncio\windows_events.py", line 316, in run_forever
super().run_forever()
File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 596, in run_forever
self._run_once()
File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 1890, in _run_once
handle._run()
File "C:\Program Files\Python39\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "C:\LittlePaimon.venv\lib\site-packages\nonebot\message.py", line 141, in _check_matcher
await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)

File "C:\LittlePaimon.venv\lib\site-packages\nonebot\message.py", line 187, in run_matcher
await matcher.run(bot, event, state, stack, dependency_cache)
File "C:\LittlePaimon.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 753, in run
await self.simple_run(bot, event, state, stack, dependency_cache)
File "C:\LittlePaimon.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 728, in simple_run
await handler(
File "C:\LittlePaimon.venv\lib\site-packages\nonebot\dependencies_init
.py", line 108, in call
return await cast(Callable[..., Awaitable[R]], self.call)(**values)
File "C:\LittlePaimon.venv\lib\site-packages\nonebot_plugin_novelai\aidraw.py", line 115, in aidraw_get
logger.debug(fifo)
File "C:\LittlePaimon.venv\lib\site-packages\nonebot_plugin_novelai\backend\base.py", line 262, in str
return self.repr().replace("\n", ";")
File "C:\LittlePaimon.venv\lib\site-packages\nonebot_plugin_novelai\backend\base.py", line 258, in repr
+ "".join(self.format())
File "C:\LittlePaimon.venv\lib\site-packages\nonebot_plugin_novelai\backend\base.py", line 245, in format
dict_self = dict(self)
File "C:\LittlePaimon.venv\lib\site-packages\nonebot_plugin_novelai\backend\base.py", line 242, in getitem
return getattr(self, item)
AttributeError: 'AIDRAW' object has no attribute 'sampler'

[Feature]: 画图怎么鉴黄呢

报告清单

  • 我已仔细阅读并了解上述注意事项
  • 我已使用最新版本测试过,确认功能尚未实现
  • 我确定在 GitHub Issues 中没有相同或相似的需求

需求原因

画图怎么鉴黄呢

预期行为

画图怎么鉴黄呢

解决方案

画图怎么鉴黄呢

[Bug]: sd生成完成后bot未发送图片

报告清单

  • 我已仔细阅读并了解上述注意事项
  • 我已使用最新版本测试过,确认问题依旧存在
  • 我确定在 GitHub Issues 中没有相同或相似的问题

发生错误的版本号

v0.5.6

问题描述

sd生成完成后bot未发送图片

如何复现

  1. 我在配置文件里设置了……
    HOST=127.0.0.1
    PORT=8080
    LOG_LEVEL=DEBUG
    FASTAPI_RELOAD=FALSE

NOVELAI_TOKEN=""
NOVELAI_TAG=""
NOVELAI_PAID=1
NOVELAI_DAYLIMIT=0
NOVELAI_MODE="sd"
NOVELAI_SITE="192.168.50.3:9000"

  1. 我的运行环境是……
    python 3.10.4

  2. 我对BOT使用的指令是……
    /aidraw 1 boy

  3. 我做的其他操作是……
    无其他操作

  4. 发生了……
    sd生成完成后bot未发送图片

预期行为

No response

日志信息

nb日志
03-16 12:38:37 [SUCCESS] nonebot | ONEBOT V11 21xxxxx61 | [message.group.normal]: Message 457688005 from 25xxxxxx69@[群:83xxxxx43] "/aidraw 1 boy"
03-16 12:38:37 [DEBUG] nonebot | Checking for matchers in priority 1...
03-16 12:38:37 [DEBUG] nonebot | Checking for matchers in priority 4...
03-16 12:38:37 [DEBUG] nonebot | Checking for matchers in priority 5...
03-16 12:38:37 [INFO] nonebot | Event will be handled by <Matcher from nonebot_plugin_novelai.aidraw, type=message, priority=5, temp=False>
03-16 12:38:37 [DEBUG] nonebot | Running matcher <Matcher from nonebot_plugin_novelai.aidraw, type=message, priority=5, temp=False>
03-16 12:38:37 [DEBUG] nonebot | Running handler <Dependent call=<function aidraw_get at 0x000001CAFFE536D0>, params=[ModelField(name='bot', type=Bot, required=True), ModelField(name='event', type=GroupMessageEvent, required=True), ModelField(name='args', type=Namespace, required=True)], parameterless=[]>
03-16 12:38:37 [DEBUG] nonebot_plugin_novelai | time=2023-03-16 12:38:37;user_id=25xxxxxx69;group_id=83xxxxx43;cost=0;batch=1;seed=[63850860];scale=11;strength=0.7;noise=0.2;sampler=k_euler_ancestral;model=;steps=28;width=512;height=768;img2img=False;tags=masterpiece, best quality,,1 boy ,;ntags=lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, pubic hair,long neck,blurry ,
03-16 12:38:37 [DEBUG] nonebot | OneBot V11 | Calling API send_msg
03-16 12:38:38 [INFO] nonebot_plugin_novelai | 队列开始
03-16 12:38:38 [DEBUG] nonebot | OneBot V11 | Calling API get_group_member_info
03-16 12:38:38 [INFO] nonebot_plugin_novelai | 队列剩余1人 | 开始生成:time=2023-03-16 12:38:37;user_id=25xxxxxx69;group_id=83xxxxx43;cost=0;batch=1;seed=[63850860];scale=11;strength=0.7;noise=0.2;sampler=k_euler_ancestral;model=;steps=28;width=512;height=768;img2img=False;tags=masterpiece, best quality,,1 boy ,;ntags=lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, pubic hair,long neck,blurry ,
03-16 12:38:58 [DEBUG] nonebot_plugin_novelai | 获取到返回图片,正在处理
03-16 12:38:58 [INFO] nonebot_plugin_novelai | 队列剩余1人 | 生成完毕:time=2023-03-16 12:38:37;user_id=2510166169;group_id=830019043;cost=0;batch=1;seed=[63850860];scale=11;strength=0.7;noise=0.2;sampler=k_euler_ancestral;model=;steps=28;width=512;height=768;img2img=False;tags=masterpiece, best quality,,1 boy ,;ntags=lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, pubic hair,long neck,blurry ,
03-16 12:38:58 [DEBUG] nonebot | OneBot V11 | Calling API send_group_forward_msg
03-16 12:38:58 [INFO] nonebot_plugin_novelai | 队列结束
03-16 12:38:58 [INFO] nonebot | Matcher <Matcher from nonebot_plugin_novelai.aidraw, type=message, priority=5, temp=False> running complete
03-16 12:38:58 [DEBUG] nonebot | Stop event propagation

群内截图
image

sd截图
image

本地测试使用novelAI配置会有SSL报错,需要手动修改一下请求的参数

本地直接测试的时候会有SSL报错,信息为
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host pypi.org:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')]

需要对这个方法做一下调整
nonebot_plugin_novelai/backend/base.py
修改前
async def post_(self, header: dict, post_api: str, json: dict): # 请求交互 async with aiohttp.ClientSession(headers=header) as session:

修改后

async def post_(self, header: dict, post_api: str, json: dict): # 请求交互 async with aiohttp.ClientSession(headers=header, connector=aiohttp.TCPConnector(ssl=False)) as session:

另外还有一些其他网络请求的方法也会有影响,比如那个version检查的函数
至于这个是不是正常,我不太了解哈,这个ssl问题会在什么情况下可以不用处理么?

[Feature]: 指定Sampler和Clip Skip

报告清单

  • 我已仔细阅读并了解上述注意事项
  • 我已使用最新版本测试过,确认功能尚未实现
  • 我确定在 GitHub Issues 中没有相同或相似的需求

需求原因

当前版本缺少指定sampler和clip skip值的功能

预期行为

指定sampler:可从列表中选一个。
指定clip skip值:整数,>=1

解决方案

未来有空闲时间,本人会考虑自行实现并提交pr。因此特开此issue,请作者评估可行性。

novelai加载后会导致其它插件加载失败

image
image
image
如图,其它插件加载会出现 RuntimeError: There is no current event loop in thread 'MainThread'. 错误。

我尝试将其它插件中的
loop = asyncio.get_event_loop()
改为
loop = asyncio.new_event_loop() asyncio.set_event_loop(loop)
可是问题依旧。 T _ T

没有报错信息,但无法使用

安装插件也没有提示有什么缺失
image

这是sd的,发送指令后没有反应
image

这是bot的发送指令以后,只有这一串信息
image

image

这是.env.dev的端口也没有问题
image

这是sd的启动文件
image

[Feature]: 增添预设配置

报告清单

  • 我已仔细阅读并了解上述注意事项
  • 我已使用最新版本测试过,确认功能尚未实现
  • 我确定在 GitHub Issues 中没有相同或相似的需求

需求原因

我在自己搭建的sd中加入了很多lora模型,这些 lora模型有特定的触发词,比如澄闪是<lora:澄闪7(头巾与耳朵;headband,两套衣服santa coat)(建议):1>而这种打起来非常的不方便,所以希望用中文代替。

预期行为

能够方便地生成预期的图片。

解决方案

添加一个词条替换功能,比如可以自行配置 德狗/德克萨斯可以直接用来替换 lora:Omertosa:1,当然,被替换的可能不只是一个词条,还可能是一组词条,替换词也可能有很多个(很多角色都有外号)。比如上面提到的澄闪lora模型,内置的也有不同服装的触发词,在这种情况下可以用“澄闪皮肤”这一个中文词条来替换”<lora:澄闪7(头巾与耳朵;headband,两套衣服santa coat)(建议):1>,santa coat”这两个词条,触发词也可以替换为"粉毛皮肤"。

aidraw开关状态Bug

image
正则有点问题
/aidraw offical,girl 这类开头含off的命令会导致插件关闭,加个$符好点

png2jpg报错

在novelai.utils中line 44处
image
不生效,无法将RGBA转换成RGB格式
导致后续保存JPEG文件报错
将上述代码合并为
image
即可解决问题

以图生图报错

python3.9,插件版本0.5.5,以SD模式进行以图绘图出现如下报错
另外点数模式的配置是否有问题?config文件里仍写着2为无限制,但文档却写着3才是无限制,sd/naifu模式以图绘图能不能忽略点数模式的设置。
[ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_novelai.aidraw) failed.
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\envs\lesd2\Scripts\nb.exe_main
.py", line 7, in
sys.exit(main())
File "C:\Users\Administrator\AppData\Roaming\Python\Python39\site-packages\click\core.py", line 1130, in call
return self.main(*args, **kwargs)
File "C:\Users\Administrator\AppData\Roaming\Python\Python39\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
File "C:\Users\Administrator\AppData\Roaming\Python\Python39\site-packages\click\core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\Administrator\AppData\Roaming\Python\Python39\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\Administrator\AppData\Roaming\Python\Python39\site-packages\click\core.py", line 760, in invoke
return _callback(*args, **kwargs)
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\site-packages\nb_cli\commands\main.py", line 30, in run
run_bot(file, app)
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\site-packages\nb_cli\handlers\deploy.py", line 25, in run_bot
nonebot.run(app=f"{module_name}:{app}")
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\site-packages\nonebot_init
.py", line 273, in run
get_driver().run(*args, **kwargs)
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\site-packages\nonebot\drivers\fastapi.py", line 172, in run
uvicorn.run(
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\site-packages\uvicorn\main.py", line 463, in run
server.run()
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\site-packages\uvicorn\server.py", line 60, in run
return asyncio.run(self.serve(sockets=sockets))
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\asyncio\base_events.py", line 634, in run_until_complete
self.run_forever()
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\asyncio\windows_events.py", line 321, in run_forever
super().run_forever()
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\asyncio\base_events.py", line 601, in run_forever
self._run_once()
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\asyncio\base_events.py", line 1905, in _run_once
handle._run()
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\site-packages\nonebot\message.py", line 142, in _check_matcher
await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)

File "C:\ProgramData\Anaconda3\envs\lesd2\lib\site-packages\nonebot\message.py", line 186, in run_matcher
await matcher.run(bot, event, state, stack, dependency_cache)
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\site-packages\nonebot\internal\matcher.py", line 716, in run
await self.simple_run(bot, event, state, stack, dependency_cache)
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\site-packages\nonebot\internal\matcher.py", line 688, in simple_run
await handler(
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\site-packages\nonebot\dependencies_init
.py", line 108, in call
return await cast(Callable[..., Awaitable[R]], self.call)(**values)
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\site-packages\nonebot_plugin_novelai\aidraw.py", line 86, in aidraw_get
args.tags = await prepocess_tags(args.tags)
File "C:\ProgramData\Anaconda3\envs\lesd2\lib\site-packages\nonebot_plugin_novelai\utils\prepocess.py", line 6, in prepocess_tags
tags: str = "".join([i+" " for i in tags])
携带tag时报错:TypeError: sequence item 1: expected str instance, Message found
未携带tag报错:TypeError: sequence item 0: expected str instance, Message found

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.