Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: list ckpt, lora, lyco, embedding, hypernetwork and inspect model details #206

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

Ninzore
Copy link
Collaborator

@Ninzore Ninzore commented Jul 26, 2023

Add a new command lsmd
Solve #165

Add a new option `-d` for adding default prompt to the user prompt.

Allow user to generate images without input (in such case they must toggle the `default` option)

Add a new short cut `default` for quick accessing default prompt without any user input.
Use respond prompt to replace the original prompt as feedback, because the prompt may be affected by some plugins (e.g. dynamic-prompts)
Copy link
Member

@MaikoTan MaikoTan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 2 Unneccesary changes are marked at the below, you should apply format changes in a separated PR.
  • Should use i18n API to construct the message rather than manually concatenate strings.
  • getLycoList is defined but not got used, you missed it?

Comment on lines +8 to +9
import { } from '@koishijs/translator'
import { } from '@koishijs/plugin-help'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an unneccessary change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used eslint config from @koishijs/eslint-config

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but do it in the new PR, generally we should do one thing in a single PR.

Comment on lines +120 to +122
} else if (
!config.defaultPromptSw
&& session.user.authority < session.resolve(config.authLv)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneccessary change.

src/utils.ts Outdated
}
return {
img: fs.readFileSync(img),
mime: path.extname(img) === '.jpg' ? 'image/jpg' : 'image/png',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JPEG's extname can also be .jpeg, besides, it should be image/jpeg rather than image/jpg.
So it would be better to do `path.extname(img) === '.png' ? 'image/png' : 'image/jpeg'.

Ref: https://www.rfc-editor.org/rfc/rfc3745


export async function readModelInfo(modelName: string, modelPath: string): Promise<StableDiffusionWebUI.CivitaiModelInfo> {
const dirname = path.dirname(modelPath)
const modelInfoFile = path.join(dirname, `${modelName}.civitai.info`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{name}.civitai.info is the info file from an extension of SD-WebUI right? Should it be mentioned in the document either?

@Ninzore
Copy link
Collaborator Author

Ninzore commented Jul 28, 2023

2 Unneccesary changes are marked at the below, you should apply format changes in a separated PR.

I applied eslint config from @koishijs/eslint-config

Should use i18n API to construct the message rather than manually concatenate strings.

Fixed

getLycoList is defined but not got used, you missed it?

In the testing, I found the lora endpoint already return lora and lyco, so I don't need to use getLycoList function anymore, I leave it there just in case

@@ -485,6 +487,142 @@ export function apply(ctx: Context, config: Config) {
}
})

const cmdLsEx = ctx.command('lsmd <modelName:text>')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command should be novelai.listmodel at first, and then add lsmd as an alias.

.shortcut('lsckpt', { i18n: true, fuzzy: true, options: { ckpt: true } })
.shortcut('lslora', { i18n: true, fuzzy: true, options: { lora: true } })
.shortcut('lsemb', { i18n: true, fuzzy: true, options: { embedding: true } })
.shortcut('lshn', { i18n: true, fuzzy: true, options: { hypernetwork: true } })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally the short of hypernetwork should be hyp, although it is not widely used.

Comment on lines +70 to +96

lsmd:
description: List all loaded models.
usage: |-
List all ckpt, lora, lyco,embedding, hypernetwork models when use without options.
Use option to list specific type of models.
Use option with model name or model index to get model description.

options:
ckpt: List ckpt models
lora: List lora, lyco models
embedding: List embedding models
hypernetwork: list hypernetwork models

shortcuts:
lsckpt: lsckpt
lslora: lslora
lsemb: lsemb
lshn: lshn

messages:
model: model
model-name: model name
trigger-word: trigger word
description: description
civitai-addr: CivitAI address
filename: filename
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not add translation in an PR, it should be add from crowdin.

@@ -83,3 +83,30 @@ commands:
expect-image: 请输入图片。
download-error: 图片解析失败。
unknown-error: 发生未知错误。

lsmd:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be novelai.listmodel as model.

@MaikoTan
Copy link
Member

MaikoTan commented Oct 9, 2023

Can you address these suggestions?

@MaikoTan MaikoTan added the stablediffusion related to Stable Diffusion backend label Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stablediffusion related to Stable Diffusion backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants