Fit mj videos (#264)
This commit is contained in:
1 parent
041e28b09b
commit
df5e811d00
43 files changed
+4029
-3250
No files matched your search
@@ -25,6 +25,9 @@
|
||||
<div class="pt-2">
|
||||
<video-from-input v-show="config?.action === 'extend'" class="mb-4" />
|
||||
<image-url-input class="mb-2" />
|
||||
<end-image-url-input class="mb-2" />
|
||||
<loop-selector class="mb-2" />
|
||||
<resolution-selector class="mb-4" />
|
||||
<prompt-input class="mb-4" />
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
@@ -54,13 +57,16 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import RatioSelector from './config/RatioSelector.vue';
|
||||
import AdvancedSelector from './config/AdvancedSelector.vue';
|
||||
import LoopSelector from './config/LoopSelector.vue';
|
||||
import VersionSelector from './config/VersionSelector.vue';
|
||||
import ImageUrlInput from './config/ImageUrlInput.vue';
|
||||
import EndImageUrlInput from './config/EndImageUrlInput.vue';
|
||||
import ImageUrlInput2 from './config/ImageUrlInput2.vue';
|
||||
import StylizeSelector from './config/StylizeSelector.vue';
|
||||
import ChaosSelector from './config/ChaosSelector.vue';
|
||||
import ModelSelector from './config/ModelSelector.vue';
|
||||
import QualitySelector from './config/QualitySelector.vue';
|
||||
import ResolutionSelector from './config/ResolutionSelector.vue';
|
||||
import ImageWeightSelector from './config/ImageWeightSelector.vue';
|
||||
import WeirdSelector from './config/WeirdSelector.vue';
|
||||
import VideoFromInput from './config/VideoFromInput.vue';
|
||||
@@ -93,6 +99,9 @@ export default defineComponent({
|
||||
ImageWeightSelector,
|
||||
ReferenceImage,
|
||||
ImageUrlInput,
|
||||
EndImageUrlInput,
|
||||
LoopSelector,
|
||||
ResolutionSelector,
|
||||
ImageUrlInput2,
|
||||
Consumption,
|
||||
VideoFromInput,
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<div class="relative">
|
||||
<div class="flex justify-between">
|
||||
<div class="flex justify-start items-center">
|
||||
<span class="text-sm font-bold">{{ $t('midjourney.name.endImageUrl') }}</span>
|
||||
<info-icon :content="$t('midjourney.description.endImageUrl')" />
|
||||
</div>
|
||||
</div>
|
||||
<el-upload
|
||||
v-model:file-list="fileList"
|
||||
name="file"
|
||||
:limit="5"
|
||||
class="upload-wrapper"
|
||||
accept=".png,.jpg,.jpeg,.gif,.bmp,.webp"
|
||||
:multiple="true"
|
||||
list-type="picture"
|
||||
:action="uploadUrl"
|
||||
:on-exceed="onExceed"
|
||||
:on-error="onError"
|
||||
:headers="headers"
|
||||
>
|
||||
<template #file="{ file }">
|
||||
<image-preview
|
||||
:url="file.url || (file.response as any)?.file_url"
|
||||
:name="file.name"
|
||||
:percentage="file.percentage"
|
||||
@remove="fileList.splice(fileList.indexOf(file), 1)"
|
||||
/>
|
||||
</template>
|
||||
<el-button round type="primary" size="small" class="btn btn-upload">
|
||||
<font-awesome-icon icon="fa-solid fa-upload" class="icon mr-1" />
|
||||
{{ $t('midjourney.button.uploadImageUrl') }}
|
||||
</el-button>
|
||||
</el-upload>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElUpload, ElButton, UploadFiles, UploadFile, ElMessage } from 'element-plus';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import { getBaseUrlPlatform } from '@/utils';
|
||||
import InfoIcon from '@/components/common/InfoIcon.vue';
|
||||
import ImagePreview from '@/components/common/ImagePreview.vue';
|
||||
|
||||
interface IData {
|
||||
fileList: UploadFiles;
|
||||
uploadUrl: string;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: 'EndImageUrlInput',
|
||||
components: {
|
||||
ElUpload,
|
||||
ElButton,
|
||||
InfoIcon,
|
||||
FontAwesomeIcon,
|
||||
ImagePreview
|
||||
},
|
||||
emits: ['change'],
|
||||
data(): IData {
|
||||
return {
|
||||
fileList: [],
|
||||
uploadUrl: getBaseUrlPlatform() + '/api/v1/files/'
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
headers() {
|
||||
return {
|
||||
Authorization: `Bearer ${this.$store.state.token.access}`
|
||||
};
|
||||
},
|
||||
urls() {
|
||||
// @ts-ignore
|
||||
return this.fileList.map((file: UploadFile) => file?.response?.file_url);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
urls: {
|
||||
handler(val) {
|
||||
console.debug('URLs changed:', val);
|
||||
this.$store.commit('midjourney/setConfig', {
|
||||
...this.$store.state.midjourney.config,
|
||||
end_image_url: val[0]
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onExceed() {
|
||||
ElMessage.warning(this.$t('midjourney.message.uploadStartImageExceed'));
|
||||
},
|
||||
onError() {
|
||||
ElMessage.error(this.$t('midjourney.message.uploadEndImageError'));
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin-bottom: 0;
|
||||
width: 30%;
|
||||
}
|
||||
.btn.btn-upload {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.upload-wrapper {
|
||||
height: auto;
|
||||
display: flex;
|
||||
.el-upload-list {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<div class="relative">
|
||||
<div class="flex justify-between">
|
||||
<div class="flex justify-start items-center">
|
||||
<span class="text-sm font-bold">{{ $t('midjourney.name.loop') }}</span>
|
||||
<info-icon :content="$t('midjourney.description.loop')" />
|
||||
</div>
|
||||
<div class="flex justify-end items-center">
|
||||
<el-switch v-model="value" class="value" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElSwitch } from 'element-plus';
|
||||
import { MIDJOURNEY_DEFAULT_LOOP } from '@/constants';
|
||||
import InfoIcon from '@/components/common/InfoIcon.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'LoopSelector',
|
||||
components: {
|
||||
ElSwitch,
|
||||
InfoIcon
|
||||
},
|
||||
computed: {
|
||||
value: {
|
||||
get() {
|
||||
return this.$store.state.midjourney?.config?.loop;
|
||||
},
|
||||
set(val: boolean) {
|
||||
console.debug('set loop', val);
|
||||
this.$store.commit('midjourney/setConfig', {
|
||||
...this.$store.state.midjourney?.config,
|
||||
loop: val
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.value === undefined) {
|
||||
this.value = MIDJOURNEY_DEFAULT_LOOP;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<h2 class="title font-bold">{{ $t('midjourney.name.resolution') }}</h2>
|
||||
<el-select v-model="value" class="value" :placeholder="$t('midjourney.placeholder.select')">
|
||||
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElSelect, ElOption } from 'element-plus';
|
||||
import { MIDJOURNEY_DEFAULT_RESOLUTION } from '@/constants';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ResolutionSelector',
|
||||
components: {
|
||||
ElSelect,
|
||||
ElOption
|
||||
},
|
||||
props: {
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: undefined
|
||||
}
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
data() {
|
||||
return {
|
||||
options: [
|
||||
{
|
||||
value: '480p',
|
||||
label: '480p'
|
||||
},
|
||||
{
|
||||
value: '720p',
|
||||
label: '720p'
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
value: {
|
||||
get() {
|
||||
return this.$store.state.midjourney?.config?.resolution;
|
||||
},
|
||||
set(val: string) {
|
||||
this.$store.commit('midjourney/setConfig', {
|
||||
...this.$store.state.midjourney.config,
|
||||
resolution: val
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.value) {
|
||||
this.value = MIDJOURNEY_DEFAULT_RESOLUTION;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
width: 30%;
|
||||
}
|
||||
.value {
|
||||
width: 80px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user