chore: image custom params

This commit is contained in:
jialin
2024-11-27 17:07:22 +08:00
parent ba76498acc
commit 230120fff5
19 changed files with 473 additions and 206 deletions
+4 -3
View File
@@ -107,16 +107,17 @@ export const generateMessages = (messageList: Omit<MessageItem, 'uid'>[]) => {
export const OpenAIViewCode = {
chat: {
api: 'chat/completions',
clientType: 'chat.completions',
clientType: 'chat.completions.create',
logcommand: 'choices[0].message.content'
},
embeddings: {
api: 'embeddings',
clientType: 'embeddings',
clientType: 'embedding.create',
logcommand: 'data[0].embedding'
},
images: {
api: 'images/generations',
clientType: 'images.generate'
clientType: 'images.generate',
logcommand: 'data[0].b64_json'
}
};
@@ -183,3 +183,136 @@ export const ImageParamsConfig: ParamsSchema[] = [
// ]
// }
];
export const ImageconstExtraConfig: ParamsSchema[] = [
{
type: 'Select',
name: 'quality',
options: [
{ label: 'playground.params.standard', value: 'standard', locale: true },
{ label: 'playground.params.hd', value: 'hd', locale: true }
],
label: {
text: 'playground.params.quality',
isLocalized: true
},
rules: [
{
required: false
}
]
},
{
type: 'Select',
name: 'style',
options: [
{ label: 'playground.params.style.vivid', value: 'vivid', locale: true },
{
label: 'playground.params.style.natural',
value: 'natural',
locale: true
}
],
attrs: {
allowClear: true
},
label: {
text: 'playground.params.style',
isLocalized: true
},
rules: [
{
required: false
}
]
}
];
export const ImageAdvancedParamsConfig: ParamsSchema[] = [
{
type: 'Select',
name: 'sampler',
options: [
{ label: 'euler_a', value: 'euler_a' },
{ label: 'euler', value: 'euler' },
{ label: 'heun', value: 'heun' },
{ label: 'dpm2', value: 'dpm2' },
{ label: 'dpm++2s_a', value: 'dpm++2s_a' },
{ label: 'dpm++2m', value: 'dpm++2m' },
{ label: 'dpm++2mv2', value: 'dpm++2mv2' },
{ label: 'ipndm', value: 'ipndm' },
{ label: 'pndm_v', value: 'pndm_v' },
{ label: 'lcm', value: 'lcm' }
],
label: {
text: 'playground.image.params.sampler',
isLocalized: true
},
rules: [
{
required: false
}
]
},
{
type: 'InputNumber',
name: 'sample_steps',
label: {
text: 'playground.image.params.samplerSteps',
isLocalized: true
},
attrs: {
min: 1,
max: 100
},
rules: [
{
required: false
}
]
},
{
type: 'InputNumber',
name: 'cfg_scale',
label: {
text: 'playground.image.params.cfgScale',
isLocalized: true
},
attrs: {
min: 1.0,
max: 10,
step: 0.1
},
rules: [
{
required: false
}
]
},
{
type: 'Input',
name: 'negative_prompt',
label: {
text: 'playground.image.params.negativePrompt',
isLocalized: true
},
rules: [
{
required: false
}
]
},
{
type: 'InputNumber',
name: 'seed',
label: {
text: 'playground.image.params.seed',
isLocalized: true
},
rules: [
{
required: false
}
]
}
];
+3 -1
View File
@@ -21,7 +21,8 @@ type SchemaType =
| 'Select'
| 'Slider'
| 'TextArea'
| 'Checkbox';
| 'Checkbox'
| 'Textarea';
export interface ParamsSchema {
type: SchemaType;
@@ -30,6 +31,7 @@ export interface ParamsSchema {
text: string;
isLocalized?: boolean;
};
style?: React.CSSProperties;
options?: Global.BaseOption<string | number>[];
value?: string | number | boolean | string[];
min?: number;