Refine kling pix for options (#248)

This commit is contained in:
Germey authored and GitHub committed 2025-08-05 21:39:28 +08:00
1 parent f946022baa
commit 12193c2076
73 files changed
+1664 -1640

No files matched your search

+2 -2
View File
@@ -3,12 +3,12 @@
<div class="config">
<prompt-input class="mb-4" />
<model-selector class="mb-4" />
<mode-selector class="mb-4" />
<ratio-selector class="mb-4" />
<start-image class="mb-2" />
<end-image class="mb-2" />
<cfg-scale-selector class="mb-4" />
<duration-selector class="mb-4" />
<mode-selector class="mb-4" />
<cfg-scale-selector class="mb-4" />
<negative-prompt-input class="mb-4" />
<div class="actions">
<el-button
+3 -3
View File
@@ -1,7 +1,7 @@
<template>
<div class="field">
<h2 class="title font-bold">{{ $t('kling.name.mode') }}</h2>
<el-select v-model="value" class="value" :placeholder="$t('kling.placeholder.select')">
<el-select v-model="value" class="value" :placeholder="$t('kling.placeholder.select')" :clearable="true">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
@@ -30,11 +30,11 @@ export default defineComponent({
options: [
{
value: 'std',
label: '标准'
label: this.$t('kling.name.modeStd')
},
{
value: 'pro',
label: '高速'
label: this.$t('kling.name.modePro')
}
]
};
+15 -3
View File
@@ -30,15 +30,27 @@ export default defineComponent({
options: [
{
value: 'kling-v1',
label: 'V1'
label: 'v1'
},
{
value: 'kling-v1-5',
label: 'V1.5'
label: 'v1.5'
},
{
value: 'kling-v1-6',
label: 'V1.6'
label: 'v1.6'
},
{
value: 'kling-v2-master',
label: 'v2-Master'
},
{
value: 'kling-v2-1',
label: 'v2.1'
},
{
value: 'kling-v2-1-master',
label: 'v2.1-Master'
}
]
};
@@ -9,7 +9,6 @@
<ratio-selector v-if="!config.is_videos" class="mb-4" />
<quality-selector v-if="!config.is_videos" class="mb-4" />
<version-selector v-if="!config.is_videos" class="mb-4" />
<reference-image v-if="!config.is_videos" class="mb-2" />
<elements-selector v-if="!config.is_videos" class="mb-2" />
<advanced-selector v-if="!config.is_videos" class="mb-2" />
<stylize-selector v-show="config.advanced" class="mb-2" />
+4 -1
View File
@@ -4,6 +4,7 @@
<prompt-input class="mb-4" />
<model-selector class="mb-4" />
<style-selector class="mb-4" />
<ratio-selector class="mb-4" />
<motion-selector class="mb-4" />
<quality-selector class="mb-4" />
<start-image class="mb-2" />
@@ -29,6 +30,7 @@ import MotionSelector from './config/MotionSelector.vue';
import StyleSelector from './config/StyleSelector.vue';
import SeedSelector from './config/SeedSelector.vue';
import DurationSelector from './config/DurationSelector.vue';
import RatioSelector from './config/RatioSelector.vue';
import StartImage from './config/StartImage.vue';
import PromptInput from './config/PromptInput.vue';
@@ -44,7 +46,8 @@ export default defineComponent({
StyleSelector,
DurationSelector,
StartImage,
SeedSelector
SeedSelector,
RatioSelector
},
emits: ['generate'],
computed: {
@@ -0,0 +1,142 @@
<template>
<div>
<span class="text-sm font-bold mb-2 block">{{ $t('pixverse.name.aspectRatio') }}</span>
<div class="items">
<div
v-for="(option, optionKey) in options"
:key="optionKey"
:class="{ active: active === optionKey, item: true }"
@click="value = option.value"
>
<div class="preview" :class="option.label">
<div class="rect" :style="{ width: option.width + 'px', height: option.height + 'px' }"></div>
</div>
<p class="name">
{{ option.label }}
</p>
</div>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { PIXVERSE_DEFAULT_ASPECT_RATIO } from '@/constants';
export default defineComponent({
name: 'RatioSelector',
data() {
return {
options: [
{
value: '1:1',
label: '1:1',
width: 20,
height: 20
},
{
value: '4:3',
label: '4:3',
width: 20,
height: 15
},
{
value: '3:4',
label: '3:4',
width: 15,
height: 20
},
{
value: '16:9',
label: '16:9',
width: 25,
height: 13
},
{
value: '9:16',
label: '9:16',
width: 13,
height: 25
}
]
};
},
computed: {
active() {
return this.options.findIndex((option) => option.value === this.value) || 0;
},
value: {
get() {
return this.$store.state.pixverse.config?.aspect_ratio;
},
set(val: string) {
console.debug('set aspect_ratio', val);
this.$store.commit('pixverse/setConfig', {
...this.$store.state.pixverse.config,
aspect_ratio: val
});
}
}
},
mounted() {
if (!this.value) {
this.value = PIXVERSE_DEFAULT_ASPECT_RATIO;
}
}
});
</script>
<style lang="scss" scoped>
.title {
font-size: 14px;
margin-bottom: 10px;
}
.items {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
.item {
width: 48px;
height: 65px;
border: 1px solid var(--el-border-color);
display: flex;
flex-direction: column;
align-items: center;
cursor: pointer;
border-radius: var(--el-border-radius-base);
.preview {
margin-top: 5px;
margin-bottom: 3px;
width: 30px;
height: 30px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
.rect {
border: 1px solid var(--el-border-color);
width: 20px;
height: 20px;
border-radius: 2px;
}
}
.name {
display: block;
font-size: 12px;
color: var(--el-text-color-primary);
}
&.active {
border-color: var(--el-color-primary);
.rect {
border-color: var(--el-color-primary);
}
}
}
}
</style>