Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #6 from Stardust-minus/master
Browse files Browse the repository at this point in the history
修复README lua部分的问题
  • Loading branch information
HsiangNianian committed Dec 13, 2022
2 parents aaea7e9 + 7b4a9b3 commit ec2e197
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 3 deletions.
53 changes: 53 additions & 0 deletions aimage-v103.lua
@@ -0,0 +1,53 @@
-- 一个AI画画的请求lua,可以自由替换后端(NAIFU),本后端模型为Anything V3.0
-- 本脚本后端推理服务器由国家超级计算广州中心提供,特此致谢。
-- 感谢@简律纯协助编写
msg_order = {}

function getImage(msg)
local api = "http://261090.proxy.nscc-gz.cn:8888/"
-- local tags = raw:match("[,%sA-Za-z0-9%{%}%(%)%[%]]+[^;]?") or "Baka"
-- local kv = raw:match(";(.*)") or "Default Config"
local json = require("json")

local seed = ranint(0, 1919810)
local raw = msg.fromMsg:sub(#".naifu:" + 1)
local prompt = "masterpiece, best quality, " .. raw -- tags

local tab = {}
tab["prompt"] = prompt
tab["width"] = 512
tab["height"] = 768
tab["cfg_scale"] = 12
tab["n_iter"] = 1
tab["steps"] = 20
tab["seed"] = seed
tab["batch_size"] = 1
tab["sampler_index"] = "Euler"
tab["negative_prompt"] =
"nsfw, lowres, text, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry,sex"

local data = json.encode(tab)

WhlstfromGroup = {971050440, 10086} -- 白名单群 等咱睡醒继续改) by 简律纯 08点46分
WhlstfromQQ = {2753364619, 1712724531} -- 白名单用户

for k = 1, #WhlstfromGroup do
if msg.gid == WhlstfromGroup[k] then
sendMsg("绘图ing...", msg.fromGroup, msg.fromQQ)
status, receive = http.post(api, data)
image = "[CQ:image,file=" .. receive .. "]"
return image
end
end

for k = 1, #WhlstfromQQ do
if msg.uid == WhlstfromQQ[k] then
sendMsg("绘图ing...", msg.fromGroup, msg.fromQQ)
status, receive = http.post(api, data)
image = "[CQ:image,file=" .. receive .. "]"
return image
end
end
return "你没有权限哦~"
end
msg_order[".naifu:"] = getImage
5 changes: 2 additions & 3 deletions readme.md
Expand Up @@ -2,10 +2,9 @@
> 基于stable-diffusion-webui的AI绘画脚本
### [Lua脚本版本](https://forum.kokona.tech/d/1552-aihua-hua-ji-yu-naifu-apide-aihui-hua-jiao-ben/1)
[upl-file uuid=33036bde-0b19-484c-9eae-eec65054af8b size=2kB]aimage-v103.txt[/upl-file]

1. 下载
2. 修改后缀为 `.lua`并放入 `DiceQQ\plugin\`文件夹下。
1. [下载](https://raw.githubusercontent.com/Stardust-minus/AImage/master/aimage-v103.lua)
2. 放入 `DiceQQ\plugin\`文件夹下。
3. 使用 `.system load`命令重载bot。
4. 发送 `.naifu:1girl`尝尝鲜。

Expand Down

0 comments on commit ec2e197

Please sign in to comment.