Add Resolution for nano (#287)
This commit is contained in:
1 parent
fd28a14409
commit
513b8ba347
28 files changed
+530
-24
No files matched your search
@@ -2,9 +2,10 @@
|
||||
<div class="flex flex-col h-full">
|
||||
<div class="flex-1 overflow-y-auto p-[15px]">
|
||||
<model-selector class="mb-4" />
|
||||
<resolution-selector class="mb-4" />
|
||||
<action-selector class="mb-4" />
|
||||
<prompt-input class="mb-4" />
|
||||
<aspect-ratio-selector v-if="config?.action === 'generate'" class="mb-4" />
|
||||
<aspect-ratio-selector class="mb-4" />
|
||||
<image-urls-input v-if="config?.action === 'edit'" class="mb-4" />
|
||||
</div>
|
||||
<div class="flex flex-col items-center justify-center px-[15px] pb-[15px]">
|
||||
@@ -28,6 +29,7 @@ import AspectRatioSelector from './config/AspectRatioSelector.vue';
|
||||
import Consumption from '../common/Consumption.vue';
|
||||
import { getConsumption } from '@/utils';
|
||||
import ModelSelector from './config/ModelSelector.vue';
|
||||
import ResolutionSelector from './config/ResolutionSelector.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ConfigPanel',
|
||||
@@ -39,7 +41,8 @@ export default defineComponent({
|
||||
ActionSelector,
|
||||
ImageUrlsInput,
|
||||
AspectRatioSelector,
|
||||
ModelSelector
|
||||
ModelSelector,
|
||||
ResolutionSelector
|
||||
},
|
||||
emits: ['generate'],
|
||||
computed: {
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<h2 class="title font-bold">{{ $t('nanobanana.name.task') }}</h2>
|
||||
<div class="label">
|
||||
<div class="box">
|
||||
<h2 class="title font-bold">{{ $t('nanobanana.name.task') }}</h2>
|
||||
<info-icon :content="actionDescription" class="info" />
|
||||
</div>
|
||||
</div>
|
||||
<el-select v-model="value" class="value" :placeholder="$t('nanobanana.placeholder.select')">
|
||||
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
@@ -11,12 +16,14 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElSelect, ElOption } from 'element-plus';
|
||||
import { NANOBANANA_DEFAULT_ACTION } from '@/constants';
|
||||
import InfoIcon from '@/components/common/InfoIcon.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ActionSelector',
|
||||
components: {
|
||||
ElSelect,
|
||||
ElOption
|
||||
ElOption,
|
||||
InfoIcon
|
||||
},
|
||||
props: {
|
||||
modelValue: {
|
||||
@@ -50,6 +57,13 @@ export default defineComponent({
|
||||
action: val
|
||||
});
|
||||
}
|
||||
},
|
||||
actionDescription(): string {
|
||||
const fallback =
|
||||
'The action to generate the images. If generate, images are generated from the prompt; if edit, they are edited based on the prompt and uploaded images.';
|
||||
return (this as any).$te('nanobanana.description.action')
|
||||
? (this.$t('nanobanana.description.action') as string)
|
||||
: fallback;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -67,10 +81,25 @@ export default defineComponent({
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
.label {
|
||||
width: 30%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.info {
|
||||
margin-left: 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.value {
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<h2 class="title font-bold">{{ $t('nanobanana.name.model') }}</h2>
|
||||
<div class="label">
|
||||
<div class="box">
|
||||
<h2 class="title font-bold">{{ $t('nanobanana.name.model') }}</h2>
|
||||
<info-icon :content="modelDescription" class="info" />
|
||||
</div>
|
||||
</div>
|
||||
<el-select v-model="value" class="value" :placeholder="$t('nanobanana.placeholder.select')">
|
||||
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
@@ -11,12 +16,14 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElSelect, ElOption } from 'element-plus';
|
||||
import { NANOBANANA_DEFAULT_MODEL, NANOBANANA_MODEL_NANO_BANANA, NANOBANANA_MODEL_NANO_BANANA_PRO } from '@/constants';
|
||||
import InfoIcon from '@/components/common/InfoIcon.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'NanobananaModelSelector',
|
||||
components: {
|
||||
ElSelect,
|
||||
ElOption
|
||||
ElOption,
|
||||
InfoIcon
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -43,6 +50,9 @@ export default defineComponent({
|
||||
model: val
|
||||
});
|
||||
}
|
||||
},
|
||||
modelDescription(): string {
|
||||
return this.$t('nanobanana.description.model');
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -60,10 +70,25 @@ export default defineComponent({
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
.label {
|
||||
width: 30%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.info {
|
||||
margin-left: 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.value {
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<div class="label">
|
||||
<div class="box">
|
||||
<h2 class="title font-bold">{{ $t('nanobanana.name.resolution') }}</h2>
|
||||
<info-icon :content="$t('nanobanana.description.resolutionProOnly')" class="info" />
|
||||
</div>
|
||||
</div>
|
||||
<el-select v-model="value" class="value" :placeholder="$t('nanobanana.placeholder.select')" :disabled="!isProModel">
|
||||
<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 InfoIcon from '@/components/common/InfoIcon.vue';
|
||||
import {
|
||||
NANOBANANA_DEFAULT_RESOLUTION,
|
||||
NANOBANANA_MODEL_NANO_BANANA_PRO,
|
||||
NANOBANANA_RESOLUTION_1K,
|
||||
NANOBANANA_RESOLUTION_2K,
|
||||
NANOBANANA_RESOLUTION_4K
|
||||
} from '@/constants';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'NanobananaResolutionSelector',
|
||||
components: {
|
||||
ElSelect,
|
||||
ElOption,
|
||||
InfoIcon
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
cachedResolution: NANOBANANA_DEFAULT_RESOLUTION,
|
||||
options: [
|
||||
{
|
||||
value: NANOBANANA_RESOLUTION_1K,
|
||||
label: NANOBANANA_RESOLUTION_1K
|
||||
},
|
||||
{
|
||||
value: NANOBANANA_RESOLUTION_2K,
|
||||
label: NANOBANANA_RESOLUTION_2K
|
||||
},
|
||||
{
|
||||
value: NANOBANANA_RESOLUTION_4K,
|
||||
label: NANOBANANA_RESOLUTION_4K
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
value: {
|
||||
get() {
|
||||
return this.$store.state.nanobanana?.config?.resolution;
|
||||
},
|
||||
set(val: string) {
|
||||
this.$store.commit('nanobanana/setConfig', {
|
||||
...this.$store.state.nanobanana?.config,
|
||||
resolution: val
|
||||
});
|
||||
}
|
||||
},
|
||||
isProModel(): boolean {
|
||||
return this.$store.state.nanobanana?.config?.model === NANOBANANA_MODEL_NANO_BANANA_PRO;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value(newVal: string) {
|
||||
if (this.isProModel && newVal) {
|
||||
this.cachedResolution = newVal;
|
||||
}
|
||||
},
|
||||
isProModel(newVal: boolean) {
|
||||
if (newVal) {
|
||||
if (!this.value) {
|
||||
this.value = this.cachedResolution || NANOBANANA_DEFAULT_RESOLUTION;
|
||||
}
|
||||
} else {
|
||||
if (this.value) {
|
||||
this.cachedResolution = this.value;
|
||||
}
|
||||
this.$store.commit('nanobanana/setConfig', {
|
||||
...this.$store.state.nanobanana?.config,
|
||||
resolution: undefined
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.isProModel && !this.value) {
|
||||
this.value = NANOBANANA_DEFAULT_RESOLUTION;
|
||||
}
|
||||
if (!this.isProModel && this.value) {
|
||||
this.cachedResolution = this.value;
|
||||
this.$store.commit('nanobanana/setConfig', {
|
||||
...this.$store.state.nanobanana?.config,
|
||||
resolution: undefined
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.label {
|
||||
width: 30%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.info {
|
||||
margin-left: 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.value {
|
||||
width: 160px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -45,12 +45,35 @@
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<el-alert :closable="false" class="mt-2 success">
|
||||
<p class="text-[var(--el-text-color-regular)] text-xs mb-0">
|
||||
<p v-if="modelValue?.request?.model" class="text-[var(--el-text-color-regular)] text-xs mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-cube" class="mr-1" />
|
||||
{{ $t('nanobanana.name.model') }}:
|
||||
{{ modelValue?.request?.model }}
|
||||
</p>
|
||||
<p v-if="modelValue?.request?.resolution" class="text-[var(--el-text-color-regular)] text-xs mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-image" class="mr-1" />
|
||||
{{ $t('nanobanana.name.resolution') }}:
|
||||
{{ modelValue?.request?.resolution }}
|
||||
</p>
|
||||
<p v-if="modelValue?.request?.action" class="text-[var(--el-text-color-regular)] text-xs mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-bolt" class="mr-1" />
|
||||
{{ $t('nanobanana.name.task') }}:
|
||||
{{
|
||||
modelValue?.request?.action === 'generate' ? $t('nanobanana.name.generate') : $t('nanobanana.name.edits')
|
||||
}}
|
||||
</p>
|
||||
<p class="text-[var(--el-text-color-regular)] text-xs mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('nanobanana.name.taskId') }}:
|
||||
{{ modelValue?.id }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" class="btn-copy inline-block" />
|
||||
</p>
|
||||
<p v-if="modelValue?.response?.trace_id" class="text-[var(--el-text-color-regular)] text-xs mb-0">
|
||||
<font-awesome-icon icon="fa-solid fa-hashtag" class="mr-1" />
|
||||
{{ $t('nanobanana.name.traceId') }}:
|
||||
{{ modelValue?.response?.trace_id }}
|
||||
<copy-to-clipboard :content="modelValue?.response?.trace_id" class="btn-copy inline-block" />
|
||||
</p>
|
||||
</el-alert>
|
||||
</div>
|
||||
<div v-if="modelValue?.response?.success === false" :class="{ content: true }">
|
||||
@@ -59,6 +82,23 @@
|
||||
<font-awesome-icon icon="fa-solid fa-exclamation-triangle" class="mr-1" />
|
||||
{{ $t('nanobanana.name.failure') }}
|
||||
</template>
|
||||
<p v-if="modelValue?.request?.model" class="text-[var(--el-text-color-regular)] text-xs mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-cube" class="mr-1" />
|
||||
{{ $t('nanobanana.name.model') }}:
|
||||
{{ modelValue?.request?.model }}
|
||||
</p>
|
||||
<p v-if="modelValue?.request?.resolution" class="text-[var(--el-text-color-regular)] text-xs mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-image" class="mr-1" />
|
||||
{{ $t('nanobanana.name.resolution') }}:
|
||||
{{ modelValue?.request?.resolution }}
|
||||
</p>
|
||||
<p v-if="modelValue?.request?.action" class="text-[var(--el-text-color-regular)] text-xs mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-bolt" class="mr-1" />
|
||||
{{ $t('nanobanana.name.task') }}:
|
||||
{{
|
||||
modelValue?.request?.action === 'generate' ? $t('nanobanana.name.generate') : $t('nanobanana.name.edits')
|
||||
}}
|
||||
</p>
|
||||
<p class="text-[var(--el-text-color-regular)] text-xs mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('nanobanana.name.taskId') }}:
|
||||
@@ -85,7 +125,24 @@
|
||||
<font-awesome-icon icon="fa-solid fa-exclamation-triangle" class="mr-1" />
|
||||
{{ $t('nanobanana.name.failure') }}
|
||||
</template>
|
||||
<p class="text-[var(--el-text-color-regular)] text-xs mb-0">
|
||||
<p v-if="modelValue?.request?.model" class="text-[var(--el-text-color-regular)] text-xs mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-cube" class="mr-1" />
|
||||
{{ $t('nanobanana.name.model') }}:
|
||||
{{ modelValue?.request?.model }}
|
||||
</p>
|
||||
<p v-if="modelValue?.request?.resolution" class="text-[var(--el-text-color-regular)] text-xs mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-image" class="mr-1" />
|
||||
{{ $t('nanobanana.name.resolution') }}:
|
||||
{{ modelValue?.request?.resolution }}
|
||||
</p>
|
||||
<p v-if="modelValue?.request?.action" class="text-[var(--el-text-color-regular)] text-xs mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-bolt" class="mr-1" />
|
||||
{{ $t('nanobanana.name.task') }}:
|
||||
{{
|
||||
modelValue?.request?.action === 'generate' ? $t('nanobanana.name.generate') : $t('nanobanana.name.edits')
|
||||
}}
|
||||
</p>
|
||||
<p class="text-[var(--el-text-color-regular)] text-xs mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('nanobanana.name.taskId') }}:
|
||||
{{ modelValue?.id }}
|
||||
|
||||
Reference in new issue
Block a user