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: Compatible with nai-diffusion-3 #213

Merged
merged 8 commits into from
Nov 25, 2023
Merged

feat: Compatible with nai-diffusion-3 #213

merged 8 commits into from
Nov 25, 2023

Conversation

initialencounter
Copy link
Contributor

No description provided.

src/config.ts Outdated
Comment on lines 410 to 413
// emmmmm doesn't know why substituting curly brackets makes the picture ugly, so it's temporarily commented
// input = input
// .split('\\(').map(s => s.replace(/\(/g, '{')).join('\\(')
// .split('\\)').map(s => s.replace(/\)/g, '}')).join('\\)')
Copy link
Member

Choose a reason for hiding this comment

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

What is going on with these lines, could you show me why isn't it working?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For example:

commented:

ac7f4927d4146f9d816f2181f9af1359
315d7ecc66e2258410c6381e4cec1a3e
5b6e089d3b94b9883fd52104895d7d47
4fd993bde4d150c7107f874c8ae17b1d
ba74e1f51d0cf0a0bb09ba414831896a

uncommented

image
image
image
image
image

Color performance is not as good in uncommented cases,probably my supervisor's feelings

Copy link
Member

Choose a reason for hiding this comment

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

I think that is because NovelAI doesn't support vector multiplier, but using the {keyword} and [keyword] to strengthen or weaken the vectors.
So what you're writing is {solo:1.2} rather than {{{{solo}}}}, will it causing NovelAI failed to parse your prompt? Can you try these prompt on their website with the same parameters see whether you'd get the same result?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see, it's working!

with correct vectors:

image
image

with wrong vector:

image
image

src/index.ts Outdated
@@ -379,6 +390,8 @@ export function apply(ctx: Context, config: Config) {
const res = await ctx.http.axios(trimSlash(config.endpoint) + path, {
method: 'POST',
timeout: config.requestTimeout,
// Since novelai's latest interface returns an application/x-zip-compressed, a responseType must be passed in
responseType: getResponseType(),
Copy link
Member

Choose a reason for hiding this comment

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

Since there is only one exception here, you could just use the conditional expression here:


```suggestion
            responseType: ['login', 'token'].include(config.type) ? 'arraybuffer' : 'json',

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a neat and elegant suggestion, but I think writing a method will be more maintainable in the future.

Copy link
Member

Choose a reason for hiding this comment

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

True, but in my thought this part would never goes complicated since there are only json or arrabuffer that we could handle here.

src/index.ts Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/config.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
@MaikoTan
Copy link
Member

Also should we release a new version after merging this.

@shigma shigma merged commit 97a98eb into koishijs:main Nov 25, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants