Add price for model (#249)
This commit is contained in:
1 parent
a6b4cecb5d
commit
f8ca20981c
15 files changed
+231
-227
No files matched your search
@@ -52,10 +52,7 @@ jobs:
|
||||
|
||||
- name: Get Build Number
|
||||
run: |
|
||||
BUILD_NUMBER=$(echo $BUILD_NUMBER)
|
||||
BUILD_DATE=$(date +'%Y%m%d')
|
||||
BUILD_TAG="${BUILD_DATE}.${BUILD_NUMBER}"
|
||||
echo "BUILD_NUMBER=${BUILD_TAG}" >> $GITHUB_ENV
|
||||
echo $BUILD_NUMBER
|
||||
|
||||
- name: Build Docker images
|
||||
run: docker-compose build
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"type": "minor",
|
||||
"comment": "add price support",
|
||||
"packageName": "@acedatacloud/nexior",
|
||||
"email": "cqc@cuiqingcai.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
||||
@@ -53,6 +53,7 @@
|
||||
"file-saver": "^2.0.5",
|
||||
"github-markdown-css": "^5.8.1",
|
||||
"highlight.js": "^11.7.0",
|
||||
"json-logic-js": "^2.0.5",
|
||||
"katex": "^0.16.22",
|
||||
"mac-scrollbar": "^0.13.5",
|
||||
"markdown-it": "^14.1.0",
|
||||
@@ -78,6 +79,7 @@
|
||||
"@rollup/plugin-replace": "^3.0.0",
|
||||
"@transmart/cli": "^0.5.2",
|
||||
"@types/file-saver": "^2.0.7",
|
||||
"@types/json-logic-js": "^2.0.8",
|
||||
"@types/markdown-it": "^14.1.0",
|
||||
"@types/node": "^16.7.4",
|
||||
"@types/psl": "^1.1.3",
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<div v-if="value !== null && value !== undefined" class="text-center text-[var(--el-text-color-secondary)] mb-1">
|
||||
<font-awesome-icon icon="fa-solid fa-coins" class="text-xs mr-1" />
|
||||
<span class="text-xs">
|
||||
{{ value }}
|
||||
{{ $t(`service.unit.${service?.unit || 'credits'}`) }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import { IService } from '@/models';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'Consumption',
|
||||
components: {
|
||||
FontAwesomeIcon
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: null
|
||||
},
|
||||
service: {
|
||||
type: Object as () => IService | undefined,
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -1,15 +1,16 @@
|
||||
<template>
|
||||
<div class="panel">
|
||||
<div class="config">
|
||||
<div class="flex flex-col h-full">
|
||||
<div class="flex-1 overflow-y-auto p-[15px]">
|
||||
<prompt-input class="mb-4" />
|
||||
<model-selector class="mb-4" />
|
||||
<count-selector class="mb-4" />
|
||||
<div class="actions">
|
||||
<el-button type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('flux.button.generate') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col items-center justify-center px-[15px] pb-[15px]">
|
||||
<consumption :value="consumption" :service="service" />
|
||||
<el-button type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('flux.button.generate') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -21,6 +22,8 @@ import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import ModelSelector from './config/ModelSelector.vue';
|
||||
import CountSelector from './config/CountSelector.vue';
|
||||
import PromptInput from './config/PromptInput.vue';
|
||||
import Consumption from '../common/Consumption.vue';
|
||||
import { getConsumption } from '@/utils';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'PresetPanel',
|
||||
@@ -29,12 +32,19 @@ export default defineComponent({
|
||||
FontAwesomeIcon,
|
||||
PromptInput,
|
||||
ModelSelector,
|
||||
CountSelector
|
||||
CountSelector,
|
||||
Consumption
|
||||
},
|
||||
emits: ['generate'],
|
||||
computed: {
|
||||
config() {
|
||||
return this.$store.state.flux?.config;
|
||||
},
|
||||
consumption() {
|
||||
return getConsumption(this.config, this.service?.metadata?.price);
|
||||
},
|
||||
service() {
|
||||
return this.$store.state.flux?.service;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -44,27 +54,3 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.panel {
|
||||
padding: 15px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
height: calc(100% - 40px);
|
||||
.config {
|
||||
width: 100%;
|
||||
height: calc(100% - 50px);
|
||||
flex: 1;
|
||||
}
|
||||
.actions {
|
||||
height: 50px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.btn {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,25 +1,26 @@
|
||||
<template>
|
||||
<div class="panel">
|
||||
<div class="config">
|
||||
<div class="flex flex-col h-full">
|
||||
<div class="flex-1 overflow-y-auto p-[15px]">
|
||||
<prompt-input class="mb-4" />
|
||||
<model-selector class="mb-4" />
|
||||
<start-image-url-input v-if="config?.model === 'minimax-i2v'" class="mb-2" />
|
||||
<div class="actions">
|
||||
<el-button
|
||||
v-if="config?.video_url !== undefined || config?.custom"
|
||||
type="primary"
|
||||
class="btn w-full"
|
||||
round
|
||||
@click="onGenerate"
|
||||
>
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('hailuo.button.extend') }}
|
||||
</el-button>
|
||||
<el-button v-else type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('hailuo.button.generate') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col items-center justify-center px-[15px] pb-[15px]">
|
||||
<consumption :value="consumption" :service="service" />
|
||||
<el-button
|
||||
v-if="config?.video_url !== undefined || config?.custom"
|
||||
type="primary"
|
||||
class="btn w-full"
|
||||
round
|
||||
@click="onGenerate"
|
||||
>
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('hailuo.button.extend') }}
|
||||
</el-button>
|
||||
<el-button v-else type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('hailuo.button.generate') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -31,6 +32,9 @@ import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import ModelSelector from './config/ModelSelector.vue';
|
||||
import StartImageUrlInput from './config/StartImageUrlInput.vue';
|
||||
import PromptInput from './config/PromptInput.vue';
|
||||
import Consumption from '../common/Consumption.vue';
|
||||
import { getConsumption } from '@/utils';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'PresetPanel',
|
||||
components: {
|
||||
@@ -38,12 +42,19 @@ export default defineComponent({
|
||||
FontAwesomeIcon,
|
||||
PromptInput,
|
||||
StartImageUrlInput,
|
||||
ModelSelector
|
||||
ModelSelector,
|
||||
Consumption
|
||||
},
|
||||
emits: ['generate'],
|
||||
computed: {
|
||||
config() {
|
||||
return this.$store.state.hailuo?.config;
|
||||
},
|
||||
consumption() {
|
||||
return getConsumption(this.config, this.service?.metadata?.price);
|
||||
},
|
||||
service() {
|
||||
return this.$store.state.hailuo?.service;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -53,28 +64,3 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.panel {
|
||||
height: 100%;
|
||||
padding: 15px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
height: calc(100% - 40px);
|
||||
.config {
|
||||
width: 100%;
|
||||
height: calc(100% - 50px);
|
||||
flex: 1;
|
||||
}
|
||||
.actions {
|
||||
height: 50px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.btn {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="panel">
|
||||
<div class="config">
|
||||
<div class="flex flex-col h-full">
|
||||
<div class="flex-1 overflow-y-auto p-[15px]">
|
||||
<prompt-input class="mb-4" />
|
||||
<model-selector class="mb-4" />
|
||||
<ratio-selector class="mb-4" />
|
||||
@@ -10,22 +10,23 @@
|
||||
<mode-selector class="mb-4" />
|
||||
<cfg-scale-selector class="mb-4" />
|
||||
<negative-prompt-input class="mb-4" />
|
||||
<div class="actions">
|
||||
<el-button
|
||||
v-if="config?.video_url !== undefined || config?.custom"
|
||||
type="primary"
|
||||
class="btn w-full"
|
||||
round
|
||||
@click="onGenerate"
|
||||
>
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('kling.button.extend') }}
|
||||
</el-button>
|
||||
<el-button v-else type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('kling.button.generate') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col items-center justify-center px-[15px] pb-[15px]">
|
||||
<consumption :value="consumption" :service="service" />
|
||||
<el-button
|
||||
v-if="config?.video_url !== undefined || config?.custom"
|
||||
type="primary"
|
||||
class="btn w-full"
|
||||
round
|
||||
@click="onGenerate"
|
||||
>
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('kling.button.extend') }}
|
||||
</el-button>
|
||||
<el-button v-else type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('kling.button.generate') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -40,14 +41,17 @@ import DurationSelector from './config/DurationSelector.vue';
|
||||
import RatioSelector from './config/RatioSelector.vue';
|
||||
import StartImage from './config/StartImage.vue';
|
||||
import EndImage from './config/EndImage.vue';
|
||||
import Consumption from '../common/Consumption.vue';
|
||||
import CfgScaleSelector from './config/CfgScaleSelector.vue';
|
||||
import PromptInput from './config/PromptInput.vue';
|
||||
import NegativePromptInput from './config/NegativePromptInput.vue';
|
||||
import { getConsumption } from '@/utils';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ConfigPanel',
|
||||
components: {
|
||||
ElButton,
|
||||
Consumption,
|
||||
FontAwesomeIcon,
|
||||
PromptInput,
|
||||
NegativePromptInput,
|
||||
@@ -63,6 +67,12 @@ export default defineComponent({
|
||||
computed: {
|
||||
config() {
|
||||
return this.$store.state.kling?.config;
|
||||
},
|
||||
consumption() {
|
||||
return getConsumption(this.config, this.service?.metadata?.price);
|
||||
},
|
||||
service() {
|
||||
return this.$store.state.kling?.service;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -72,28 +82,3 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.panel {
|
||||
height: 100%;
|
||||
padding: 15px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
height: calc(100% - 40px);
|
||||
.config {
|
||||
width: 100%;
|
||||
height: calc(100% - 50px);
|
||||
flex: 1;
|
||||
}
|
||||
.actions {
|
||||
height: 50px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.btn {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -89,7 +89,7 @@ export default defineComponent({
|
||||
width: 30%;
|
||||
}
|
||||
.value {
|
||||
width: 80px;
|
||||
width: 120px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="panel">
|
||||
<div class="config">
|
||||
<div class="flex flex-col h-full">
|
||||
<div class="flex-1 overflow-y-auto p-[15px]">
|
||||
<extend-from-input v-if="config?.video_id || config?.video_url" class="mb-4" />
|
||||
<prompt-input class="mb-4" />
|
||||
<custom-selector v-if="!config?.video_id" class="mb-4" />
|
||||
@@ -9,22 +9,23 @@
|
||||
<end-image-input class="mb-4" />
|
||||
<enhancement-selector class="mb-4" />
|
||||
<loop-selector class="mb-4" />
|
||||
<div class="actions">
|
||||
<el-button
|
||||
v-if="config?.video_url !== undefined || config?.custom"
|
||||
type="primary"
|
||||
class="btn w-full"
|
||||
round
|
||||
@click="onGenerate"
|
||||
>
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('luma.button.extend') }}
|
||||
</el-button>
|
||||
<el-button v-else type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('luma.button.generate') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col items-center justify-center px-[15px] pb-[15px]">
|
||||
<consumption :value="consumption" :service="service" />
|
||||
<el-button
|
||||
v-if="config?.video_url !== undefined || config?.custom"
|
||||
type="primary"
|
||||
class="btn w-full"
|
||||
round
|
||||
@click="onGenerate"
|
||||
>
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('luma.button.extend') }}
|
||||
</el-button>
|
||||
<el-button v-else type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('luma.button.generate') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -42,6 +43,8 @@ import StartImageInput from './config/StartImageInput.vue';
|
||||
import UploadVideo from './config/UploadVideo.vue';
|
||||
import PromptInput from './config/PromptInput.vue';
|
||||
import ExtendFromInput from './config/ExtendFromInput.vue';
|
||||
import Consumption from '../common/Consumption.vue';
|
||||
import { getConsumption } from '@/utils';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ConfigPanel',
|
||||
@@ -55,12 +58,19 @@ export default defineComponent({
|
||||
PromptInput,
|
||||
ExtendFromInput,
|
||||
CustomSelector,
|
||||
UploadVideo
|
||||
UploadVideo,
|
||||
Consumption
|
||||
},
|
||||
emits: ['generate'],
|
||||
computed: {
|
||||
config() {
|
||||
return this.$store.state.luma?.config;
|
||||
},
|
||||
consumption() {
|
||||
return getConsumption(this.config, this.service?.metadata?.price);
|
||||
},
|
||||
service() {
|
||||
return this.$store.state.luma?.service;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -70,28 +80,3 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.panel {
|
||||
height: 100%;
|
||||
padding: 15px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
height: calc(100% - 40px);
|
||||
.config {
|
||||
width: 100%;
|
||||
height: calc(100% - 50px);
|
||||
flex: 1;
|
||||
}
|
||||
.actions {
|
||||
height: 50px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.btn {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="panel flex flex-col">
|
||||
<div class="flex-1 overflow-y-scroll p-4">
|
||||
<div class="flex flex-col h-full">
|
||||
<div class="flex-1 overflow-y-auto p-[15px]">
|
||||
<is-videos-selector class="mb-2" />
|
||||
<model-selector v-if="!config.is_videos" class="mb-2" />
|
||||
<prompt-input class="mb-2" />
|
||||
@@ -17,7 +17,8 @@
|
||||
<image-weight-selector v-show="config.advanced" class="mb-2" />
|
||||
<style-selector v-show="config.advanced" class="mb-2" />
|
||||
</div>
|
||||
<div class="h-12 px-4">
|
||||
<div class="flex flex-col px-[15px] pb-[15px]">
|
||||
<consumption :value="consumption" :service="service" />
|
||||
<div class="flex gap-1">
|
||||
<mode-selector />
|
||||
<el-button v-if="config.action === 'extend'" type="primary" class="btn w-full" round @click="$emit('generate')">
|
||||
@@ -50,6 +51,8 @@ import ModeSelector from './config/ModeSelector2.vue';
|
||||
import PromptInput from './config/PromptInput.vue';
|
||||
import ReferenceImage from './config/ReferenceImage.vue';
|
||||
import { ElButton } from 'element-plus';
|
||||
import Consumption from '../common/Consumption.vue';
|
||||
import { getConsumption } from '@/utils';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ConfigPanel',
|
||||
@@ -70,20 +73,20 @@ export default defineComponent({
|
||||
ImageWeightSelector,
|
||||
ReferenceImage,
|
||||
IsVideosSelector,
|
||||
ImageUrlInput
|
||||
ImageUrlInput,
|
||||
Consumption
|
||||
},
|
||||
emits: ['generate'],
|
||||
computed: {
|
||||
config() {
|
||||
return this.$store.state.midjourney.config;
|
||||
},
|
||||
consumption() {
|
||||
return getConsumption(this.config, this.service?.metadata?.price);
|
||||
},
|
||||
service() {
|
||||
return this.$store.state.midjourney?.service;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.panel {
|
||||
flex: 1;
|
||||
height: calc(100% - 40px);
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="panel">
|
||||
<div class="config">
|
||||
<div class="flex flex-col h-full">
|
||||
<div class="flex-1 overflow-y-auto p-[15px]">
|
||||
<prompt-input class="mb-4" />
|
||||
<model-selector class="mb-4" />
|
||||
<style-selector class="mb-4" />
|
||||
@@ -10,12 +10,13 @@
|
||||
<start-image class="mb-2" />
|
||||
<seed-selector class="mb-4" />
|
||||
<duration-selector class="mb-4" />
|
||||
<div class="actions">
|
||||
<el-button type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('pixverse.button.generate') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col items-center justify-center px-[15px] pb-[15px]">
|
||||
<consumption :value="consumption" :service="service" />
|
||||
<el-button type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('pixverse.button.generate') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -33,6 +34,8 @@ import DurationSelector from './config/DurationSelector.vue';
|
||||
import RatioSelector from './config/RatioSelector.vue';
|
||||
import StartImage from './config/StartImage.vue';
|
||||
import PromptInput from './config/PromptInput.vue';
|
||||
import Consumption from '../common/Consumption.vue';
|
||||
import { getConsumption } from '@/utils';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ConfigPanel',
|
||||
@@ -47,12 +50,19 @@ export default defineComponent({
|
||||
DurationSelector,
|
||||
StartImage,
|
||||
SeedSelector,
|
||||
RatioSelector
|
||||
RatioSelector,
|
||||
Consumption
|
||||
},
|
||||
emits: ['generate'],
|
||||
computed: {
|
||||
config() {
|
||||
return this.$store.state.pixverse?.config;
|
||||
},
|
||||
consumption() {
|
||||
return getConsumption(this.config, this.service?.metadata?.price);
|
||||
},
|
||||
service() {
|
||||
return this.$store.state.pixverse?.service;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -62,28 +72,3 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.panel {
|
||||
height: 100%;
|
||||
padding: 15px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
height: calc(100% - 40px);
|
||||
.config {
|
||||
width: 100%;
|
||||
height: calc(100% - 50px);
|
||||
flex: 1;
|
||||
}
|
||||
.actions {
|
||||
height: 50px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.btn {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="panel">
|
||||
<div class="config">
|
||||
<div class="flex flex-col h-full">
|
||||
<div class="flex-1 overflow-y-auto p-[15px]">
|
||||
<type-selector class="mb-4" />
|
||||
<upload-audio class="mb-4" />
|
||||
<prompt-input v-if="!config?.custom" class="mb-4" />
|
||||
@@ -9,16 +9,17 @@
|
||||
<title-input v-if="config?.custom" class="mb-4" />
|
||||
<extend-from-input v-if="config?.action === 'extend'" class="mb-4" />
|
||||
<cover-from-input v-if="config?.action === 'cover'" class="mb-4" />
|
||||
<div class="actions">
|
||||
<el-button v-if="config?.action !== 'extend'" type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('suno.button.generate') }}
|
||||
</el-button>
|
||||
<el-button v-else type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('suno.button.extend') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col items-center justify-center px-[15px] pb-[15px]">
|
||||
<consumption :value="consumption" :service="service" />
|
||||
<el-button v-if="config?.action !== 'extend'" type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('suno.button.generate') }}
|
||||
</el-button>
|
||||
<el-button v-else type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('suno.button.extend') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -35,6 +36,8 @@ import TitleInput from './config/TitleInput.vue';
|
||||
import ExtendFromInput from './config/ExtendFromInput.vue';
|
||||
import CoverFromInput from './config/CoverFromInput.vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import Consumption from '../common/Consumption.vue';
|
||||
import { getConsumption } from '@/utils';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'PresetPanel',
|
||||
@@ -48,12 +51,19 @@ export default defineComponent({
|
||||
CoverFromInput,
|
||||
UploadAudio,
|
||||
FontAwesomeIcon,
|
||||
ElButton
|
||||
ElButton,
|
||||
Consumption
|
||||
},
|
||||
emits: ['generate'],
|
||||
computed: {
|
||||
config() {
|
||||
return this.$store.state.suno?.config;
|
||||
},
|
||||
consumption() {
|
||||
return getConsumption(this.config, this.service?.metadata?.price);
|
||||
},
|
||||
service() {
|
||||
return this.$store.state.suno?.service;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -10,6 +10,7 @@ export interface IService {
|
||||
applied_count?: number;
|
||||
applied?: boolean;
|
||||
tags?: string[];
|
||||
metadata?: any;
|
||||
thumbnail?: string;
|
||||
introduction?: string;
|
||||
apis?: IApi[];
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { CURRENCY_LABEL_MAPPING } from '@/constants/mapping';
|
||||
import store from '@/store';
|
||||
import jsonLogic from 'json-logic-js';
|
||||
|
||||
/**
|
||||
* Input a value and target currency (e.g. cny), return the price which the current locale
|
||||
@@ -45,3 +46,16 @@ export const getPriceString = (payload: {
|
||||
});
|
||||
return `${price.label}${price.value?.toFixed(fractionDigits)}`;
|
||||
};
|
||||
|
||||
export const getConsumption = (payload: any, rules: any): number | undefined => {
|
||||
if (!rules || !Array.isArray(rules)) {
|
||||
return undefined;
|
||||
}
|
||||
for (const rule of rules) {
|
||||
const conditions = rule.conditions;
|
||||
if (jsonLogic.apply(conditions, payload)) {
|
||||
return jsonLogic.apply(rule.consumption) as number;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
@@ -1122,6 +1122,11 @@
|
||||
"@types/minimatch" "^5.1.2"
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/json-logic-js@^2.0.8":
|
||||
version "2.0.8"
|
||||
resolved "https://registry.yarnpkg.com/@types/json-logic-js/-/json-logic-js-2.0.8.tgz#a1108452069a498981813e32dd081754ae6b3395"
|
||||
integrity sha512-WgNsDPuTPKYXl0Jh0IfoCoJoAGGYZt5qzpmjuLSEg7r0cKp/kWtWp0HAsVepyPSPyXiHo6uXp/B/kW/2J1fa2Q==
|
||||
|
||||
"@types/json-schema@^7.0.9":
|
||||
version "7.0.15"
|
||||
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
|
||||
@@ -3677,6 +3682,11 @@ json-buffer@3.0.1:
|
||||
resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13"
|
||||
integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==
|
||||
|
||||
json-logic-js@^2.0.5:
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/json-logic-js/-/json-logic-js-2.0.5.tgz#55f0c687dd6f56b02ccdcfdd64171ed998ab5499"
|
||||
integrity sha512-rTT2+lqcuUmj4DgWfmzupZqQDA64AdmYqizzMPWj3DxGdfFNsxPpcNVSaTj4l8W2tG/+hg7/mQhxjU3aPacO6g==
|
||||
|
||||
json-parse-even-better-errors@^2.3.0:
|
||||
version "2.3.1"
|
||||
resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d"
|
||||
|
||||
Reference in new issue
Block a user