koishi-plugin-hhs-huatu 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,188 @@
1
+ import { Computed, Dict, Schema, Session } from 'koishi';
2
+ import { Size } from './utils';
3
+ export declare const modelMap: {
4
+ readonly safe: "safe-diffusion";
5
+ readonly nai: "nai-diffusion";
6
+ readonly furry: "nai-diffusion-furry-3";
7
+ readonly 'nai-v3': "nai-diffusion-3";
8
+ readonly 'nai-v4-curated-preview': "nai-diffusion-4-curated-preview";
9
+ };
10
+ export declare const orientMap: {
11
+ readonly landscape: {
12
+ readonly height: 832;
13
+ readonly width: 1216;
14
+ };
15
+ readonly portrait: {
16
+ readonly height: 1216;
17
+ readonly width: 832;
18
+ };
19
+ readonly square: {
20
+ readonly height: 1024;
21
+ readonly width: 1024;
22
+ };
23
+ };
24
+ export declare const hordeModels: string[];
25
+ type Model = keyof typeof modelMap;
26
+ type Orient = keyof typeof orientMap;
27
+ export declare const models: Model[];
28
+ export declare const orients: Orient[];
29
+ export declare namespace scheduler {
30
+ const nai: readonly ["native", "karras", "exponential", "polyexponential"];
31
+ const nai4: readonly ["karras", "exponential", "polyexponential"];
32
+ const sd: readonly ["Automatic", "Uniform", "Karras", "Exponential", "Polyexponential", "SGM Uniform"];
33
+ const horde: readonly ["karras"];
34
+ const comfyUI: readonly ["normal", "karras", "exponential", "sgm_uniform", "simple", "ddim_uniform"];
35
+ }
36
+ export declare namespace sampler {
37
+ const nai: {
38
+ k_euler_a: string;
39
+ k_euler: string;
40
+ k_lms: string;
41
+ ddim: string;
42
+ plms: string;
43
+ };
44
+ const nai3: {
45
+ k_euler: string;
46
+ k_euler_a: string;
47
+ k_dpmpp_2s_ancestral: string;
48
+ k_dpmpp_2m: string;
49
+ k_dpmpp_sde: string;
50
+ ddim_v3: string;
51
+ };
52
+ const nai4: {
53
+ k_euler: string;
54
+ k_euler_a: string;
55
+ k_dpmpp_2s_ancestral: string;
56
+ k_dpmpp_2m_sde: string;
57
+ k_dpmpp_2m: string;
58
+ k_dpmpp_sde: string;
59
+ };
60
+ const sd: Dict<string>;
61
+ const horde: {
62
+ k_lms: string;
63
+ k_heun: string;
64
+ k_euler: string;
65
+ k_euler_a: string;
66
+ k_dpm_2: string;
67
+ k_dpm_2_a: string;
68
+ k_dpm_fast: string;
69
+ k_dpm_adaptive: string;
70
+ k_dpmpp_2m: string;
71
+ k_dpmpp_2s_a: string;
72
+ k_dpmpp_sde: string;
73
+ dpmsolver: string;
74
+ lcm: string;
75
+ DDIM: string;
76
+ };
77
+ const comfyui: {
78
+ euler: string;
79
+ euler_ancestral: string;
80
+ heun: string;
81
+ heunpp2: string;
82
+ dpm_2: string;
83
+ dpm_2_ancestral: string;
84
+ lms: string;
85
+ dpm_fast: string;
86
+ dpm_adaptive: string;
87
+ dpmpp_2s_ancestral: string;
88
+ dpmpp_sde: string;
89
+ dpmpp_sde_gpu: string;
90
+ dpmpp_2m: string;
91
+ dpmpp_2m_sde: string;
92
+ dpmpp_2m_sde_gpu: string;
93
+ dpmpp_3m_sde: string;
94
+ dpmpp_3m_sde_gpu: string;
95
+ ddpm: string;
96
+ lcm: string;
97
+ ddim: string;
98
+ uni_pc: string;
99
+ uni_pc_bh2: string;
100
+ };
101
+ function createSchema(map: Dict<string>): Schema<string, string>;
102
+ function sd2nai(sampler: string, model: string): string;
103
+ }
104
+ export declare const upscalers: readonly ["None", "Lanczos", "Nearest", "LDSR", "ESRGAN_4x", "R-ESRGAN General 4xV3", "R-ESRGAN General WDN 4xV3", "R-ESRGAN AnimeVideo", "R-ESRGAN 4x+", "R-ESRGAN 4x+ Anime6B", "R-ESRGAN 2x+", "ScuNET GAN", "ScuNET PSNR", "SwinIR 4x"];
105
+ export declare const latentUpscalers: string[];
106
+ export interface Options {
107
+ enhance: boolean;
108
+ model: string;
109
+ resolution: Size;
110
+ sampler: string;
111
+ seed: string;
112
+ steps: number;
113
+ scale: number;
114
+ noise: number;
115
+ strength: number;
116
+ }
117
+ export interface PromptConfig {
118
+ basePrompt?: Computed<string>;
119
+ negativePrompt?: Computed<string>;
120
+ forbidden?: Computed<string>;
121
+ defaultPromptSw?: boolean;
122
+ defaultPrompt?: Computed<string>;
123
+ placement?: Computed<'before' | 'after'>;
124
+ latinOnly?: Computed<boolean>;
125
+ translator?: boolean;
126
+ lowerCase?: boolean;
127
+ maxWords?: Computed<number>;
128
+ }
129
+ export declare const PromptConfig: Schema<PromptConfig>;
130
+ interface FeatureConfig {
131
+ anlas?: Computed<boolean>;
132
+ text?: Computed<boolean>;
133
+ image?: Computed<boolean>;
134
+ upscale?: Computed<boolean>;
135
+ }
136
+ interface ParamConfig {
137
+ model?: Model;
138
+ sampler?: string;
139
+ smea?: boolean;
140
+ smeaDyn?: boolean;
141
+ scheduler?: string;
142
+ decrisper?: boolean;
143
+ upscaler?: string;
144
+ restoreFaces?: boolean;
145
+ hiresFix?: boolean;
146
+ hiresFixUpscaler: string;
147
+ scale?: Computed<number>;
148
+ textSteps?: Computed<number>;
149
+ imageSteps?: Computed<number>;
150
+ maxSteps?: Computed<number>;
151
+ strength?: Computed<number>;
152
+ resolution?: Computed<Orient | Size>;
153
+ maxResolution?: Computed<number>;
154
+ }
155
+ export interface Config extends PromptConfig, ParamConfig {
156
+ type: 'token' | 'login' | 'naifu' | 'sd-webui' | 'stable-horde' | 'comfyui';
157
+ token?: string;
158
+ email?: string;
159
+ password?: string;
160
+ authLv?: Computed<number>;
161
+ authLvDefault?: Computed<number>;
162
+ output?: Computed<'minimal' | 'default' | 'verbose'>;
163
+ features?: FeatureConfig;
164
+ apiEndpoint?: string;
165
+ endpoint?: string;
166
+ headers?: Dict<string>;
167
+ nsfw?: Computed<'disallow' | 'censor' | 'allow'>;
168
+ maxIterations?: number;
169
+ maxRetryCount?: number;
170
+ requestTimeout?: number;
171
+ recallTimeout?: number;
172
+ maxConcurrency?: number;
173
+ pollInterval?: number;
174
+ trustedWorkers?: boolean;
175
+ workflowText2Image?: string;
176
+ workflowImage2Image?: string;
177
+ maxQueueSize?: number;
178
+ maxUserQueueSize?: number;
179
+ penaltyCooldown?: number;
180
+ }
181
+ export declare const Config: Schema<Config>;
182
+ interface Forbidden {
183
+ pattern: string;
184
+ strict: boolean;
185
+ }
186
+ export declare function parseForbidden(input: string): Forbidden[];
187
+ export declare function parseInput(session: Session, input: string, config: Config, override: boolean): string[];
188
+ export {};
package/lib/index.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { Context } from 'koishi';
2
+ import { Config } from './config';
3
+ export * from './config';
4
+ export declare const reactive = true;
5
+ export declare const name = "hhs-huatu";
6
+ export declare const inject: {
7
+ required: string[];
8
+ optional: string[];
9
+ };
10
+ export declare function apply(ctx: Context, config: Config): void;
File without changes
package/lib/types.d.ts ADDED
@@ -0,0 +1,127 @@
1
+ export interface Perks {
2
+ maxPriorityActions: number;
3
+ startPriority: number;
4
+ contextTokens: number;
5
+ moduleTrainingSteps: number;
6
+ unlimitedMaxPriority: boolean;
7
+ voiceGeneration: boolean;
8
+ imageGeneration: boolean;
9
+ unlimitedImageGeneration: boolean;
10
+ unlimitedImageGenerationLimits: {
11
+ resolution: number;
12
+ maxPrompts: number;
13
+ }[];
14
+ }
15
+ export interface PaymentProcessorData {
16
+ c: string;
17
+ n: number;
18
+ o: string;
19
+ p: number;
20
+ r: string;
21
+ s: string;
22
+ t: number;
23
+ u: string;
24
+ }
25
+ export interface TrainingStepsLeft {
26
+ fixedTrainingStepsLeft: number;
27
+ purchasedTrainingSteps: number;
28
+ }
29
+ export interface Subscription {
30
+ tier: number;
31
+ active: boolean;
32
+ expiresAt: number;
33
+ perks: Perks;
34
+ paymentProcessorData: PaymentProcessorData;
35
+ trainingStepsLeft: TrainingStepsLeft;
36
+ }
37
+ export interface ImageData {
38
+ buffer: ArrayBuffer;
39
+ base64: string;
40
+ dataUrl: string;
41
+ }
42
+ export declare namespace NovelAI {
43
+ /** 0.5, 0.5 means make ai choose */
44
+ interface V4CharacterPromptCenter {
45
+ x: number;
46
+ y: number;
47
+ }
48
+ interface V4CharacterPrompt {
49
+ prompt: string;
50
+ uc: string;
51
+ center: V4CharacterPromptCenter;
52
+ }
53
+ interface V4CharCaption {
54
+ char_caption: string;
55
+ centers: V4CharacterPromptCenter[];
56
+ }
57
+ interface V4PromptCaption {
58
+ base_caption: string;
59
+ char_captions: V4CharCaption[];
60
+ }
61
+ interface V4Prompt {
62
+ caption: V4PromptCaption;
63
+ }
64
+ interface V4PromptPositive extends V4Prompt {
65
+ use_coords: boolean;
66
+ use_order: boolean;
67
+ }
68
+ }
69
+ export declare namespace StableDiffusionWebUI {
70
+ interface Request {
71
+ prompt: string;
72
+ negative_prompt?: string;
73
+ enable_hr?: boolean;
74
+ denoising_strength?: number;
75
+ firstphase_width?: number;
76
+ firstphase_height?: number;
77
+ styles?: string[];
78
+ seed?: number;
79
+ subseed?: number;
80
+ subseed_strength?: number;
81
+ seed_resize_from_h?: number;
82
+ seed_resize_from_w?: number;
83
+ batch_size?: number;
84
+ n_iter?: number;
85
+ steps?: number;
86
+ cfg_scale?: number;
87
+ width?: number;
88
+ height?: number;
89
+ restore_faces?: boolean;
90
+ tiling?: boolean;
91
+ eta?: number;
92
+ s_churn?: number;
93
+ s_tmax?: number;
94
+ s_tmin?: number;
95
+ s_noise?: number;
96
+ sampler_index?: string;
97
+ }
98
+ interface Response {
99
+ /** Image list in base64 format */
100
+ images: string[];
101
+ parameters: any;
102
+ info: any;
103
+ }
104
+ /**
105
+ * @see https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/828438b4a190759807f9054932cae3a8b880ddf1/modules/api/models.py#L122
106
+ */
107
+ interface ExtraSingleImageRequest {
108
+ image: string;
109
+ /** Sets the resize mode: 0 to upscale by upscaling_resize amount, 1 to upscale up to upscaling_resize_h x upscaling_resize_w. */
110
+ resize_mode?: 0 | 1;
111
+ show_extras_results?: boolean;
112
+ gfpgan_visibility?: number;
113
+ codeformer_visibility?: number;
114
+ codeformer_weight?: number;
115
+ upscaling_resize?: number;
116
+ upscaling_resize_w?: number;
117
+ upscaling_resize_h?: number;
118
+ upscaling_crop?: boolean;
119
+ upscaler_1?: string;
120
+ upscaler_2?: string;
121
+ extras_upscaler_2_visibility?: number;
122
+ upscale_first?: boolean;
123
+ }
124
+ interface ExtraSingleImageResponse {
125
+ image: string;
126
+ }
127
+ }
package/lib/utils.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ import { Context, Dict } from 'koishi';
2
+ import { ImageData } from './types';
3
+ export declare function project(object: {}, mapping: {}): {};
4
+ export interface Size {
5
+ width: number;
6
+ height: number;
7
+ }
8
+ export declare function getImageSize(buffer: ArrayBuffer): Size;
9
+ export declare function download(ctx: Context, url: string, headers?: {}): Promise<ImageData>;
10
+ export declare function calcAccessKey(email: string, password: string): Promise<string>;
11
+ export declare function calcEncryptionKey(email: string, password: string): Promise<string>;
12
+ export declare class NetworkError extends Error {
13
+ params: {};
14
+ constructor(message: string, params?: {});
15
+ static catch: (mapping: Dict<string>) => (e: any) => never;
16
+ }
17
+ export declare function login(ctx: Context): Promise<string>;
18
+ export declare function closestMultiple(num: number, mult?: number): number;
19
+ export interface Size {
20
+ width: number;
21
+ height: number;
22
+ /** Indicate whether this resolution is pre-defined or customized */
23
+ custom?: boolean;
24
+ }
25
+ export declare function resizeInput(size: Size): Size;
26
+ export declare function forceDataPrefix(url: string, mime?: string): string;
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "koishi-plugin-hhs-huatu",
3
+ "description": "novelai更新了模型尝试一下",
4
+ "version": "0.0.1",
5
+ "main": "lib/index.js",
6
+ "typings": "lib/index.d.ts",
7
+ "files": [
8
+ "lib",
9
+ "dist"
10
+ ],
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "chatbot",
14
+ "koishi",
15
+ "plugin"
16
+ ],
17
+ "peerDependencies": {
18
+ "koishi": "^4.18.3"
19
+ }
20
+ }
package/readme.md ADDED
@@ -0,0 +1,5 @@
1
+ # koishi-plugin-hhs-huatu
2
+
3
+ [![npm](https://img.shields.io/npm/v/koishi-plugin-hhs-huatu?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-hhs-huatu)
4
+
5
+ 对novelaibot简单修改,修复使用novelai时1,不能更换-furry模型。2新增排队逻辑。增加单个用户多个排队处罚cd机制。其他的没什么改变。