update styles

This commit is contained in:
AceDataCloud committed 2023-12-18 02:02:14 +08:00
1 parent f6b119f34f
commit 80abc61b80
17 files changed
+91 -24

No files matched your search

+1
View File
@@ -35,6 +35,7 @@
"element-plus": "^2.2.28", "element-plus": "^2.2.28",
"github-markdown-css": "^5.1.0", "github-markdown-css": "^5.1.0",
"highlight.js": "^11.7.0", "highlight.js": "^11.7.0",
"mac-scrollbar": "^0.13.5",
"markdown-it": "^13.0.1", "markdown-it": "^13.0.1",
"mustache": "^4.2.0", "mustache": "^4.2.0",
"programming-languages-logos": "^0.0.3", "programming-languages-logos": "^0.0.3",
+7 -2
View File
@@ -11,7 +11,7 @@
<chaos-selector v-if="preset.advanced" v-model="preset.chaos" class="mb-4" /> <chaos-selector v-if="preset.advanced" v-model="preset.chaos" class="mb-4" />
<image-weight-selector v-if="preset.advanced" v-model="preset.iw" class="mb-4" /> <image-weight-selector v-if="preset.advanced" v-model="preset.iw" class="mb-4" />
<niji-selector v-if="false" v-model="preset.niji" class="mb-4" /> <niji-selector v-if="false" v-model="preset.niji" class="mb-4" />
<raw-selector v-if="preset.model == 'MJ' && preset.advanced" v-model="preset.raw" class="mb-4" /> <raw-selector v-if="!preset.model && preset.advanced" v-model="preset.raw" class="mb-4" />
</div> </div>
</template> </template>
@@ -64,8 +64,13 @@ export default defineComponent({
preset: { preset: {
handler(val) { handler(val) {
this.$emit('update:modelValue', val); this.$emit('update:modelValue', val);
console.debug('preset changed', val);
this.$store.dispatch('setMidjourney', {
preset: val
});
}, },
deep: true deep: true,
immediate: true
} }
} }
}); });
+1 -1
View File
@@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<h2 class="title">{{ $t('midjourney.name.prompt') }}</h2> <h2 class="title">{{ $t('midjourney.name.prompt') }}</h2>
<el-input v-model="value" :rows="5" type="textarea" :placeholder="$t('midjourney.placeholder.prompt')" /> <el-input v-model="value" :rows="3" type="textarea" :placeholder="$t('midjourney.placeholder.prompt')" />
</div> </div>
</template> </template>
+5 -1
View File
@@ -12,7 +12,7 @@
:on-error="onError" :on-error="onError"
:headers="headers" :headers="headers"
> >
<el-button type="primary"> <el-button type="primary" class="btn btn-upload">
<font-awesome-icon icon="fa-solid fa-upload" class="icon mr-2" /> <font-awesome-icon icon="fa-solid fa-upload" class="icon mr-2" />
{{ $t('midjourney.button.uploadReferences') }} {{ $t('midjourney.button.uploadReferences') }}
</el-button> </el-button>
@@ -87,4 +87,8 @@ export default defineComponent({
font-size: 16px; font-size: 16px;
flex: 1; flex: 1;
} }
.btn.btn-upload {
border-radius: 20px;
}
</style> </style>
@@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<h2 class="title">模型</h2> <h2 class="title">{{ $t('midjourney.name.model') }}</h2>
<div class="items"> <div class="items">
<div <div
v-for="(option, optionKey) in options" v-for="(option, optionKey) in options"
@@ -41,12 +41,12 @@ export default defineComponent({
active: 0, active: 0,
options: [ options: [
{ {
value: 'MJ', value: '',
label: '通用', label: '通用',
image: 'https://cdn.zhishuyun.com/2023-10-06-174633.png' image: 'https://cdn.zhishuyun.com/2023-10-06-174633.png'
}, },
{ {
value: 'NIJI', value: 'niji',
label: '动漫', label: '动漫',
image: 'https://cdn.zhishuyun.com/2023-10-06-174008.png' image: 'https://cdn.zhishuyun.com/2023-10-06-174008.png'
} }
@@ -1,6 +1,6 @@
<template> <template>
<div class="field"> <div class="field">
<h2 class="title">画质</h2> <h2 class="title">{{ $t('midjourney.name.quality') }}</h2>
<el-radio-group v-model="value"> <el-radio-group v-model="value">
<el-radio-button v-for="item in options" :key="item.value" :label="item.value"> <el-radio-button v-for="item in options" :key="item.value" :label="item.value">
{{ item.label }} {{ item.label }}
@@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<h2 class="title">图片比例</h2> <h2 class="title">{{ $t('midjourney.name.ratio') }}</h2>
<div class="items"> <div class="items">
<div <div
v-for="(option, optionKey) in options" v-for="(option, optionKey) in options"
@@ -39,7 +39,6 @@ export default defineComponent({
data() { data() {
return { return {
value: this.modelValue, value: this.modelValue,
active: 0,
options: [ options: [
{ {
value: '1:1', value: '1:1',
@@ -74,6 +73,11 @@ export default defineComponent({
] ]
}; };
}, },
computed: {
active() {
return this.options.findIndex((option) => option.value === this.value);
}
},
watch: { watch: {
modelValue(val) { modelValue(val) {
if (val !== this.value) { if (val !== this.value) {
@@ -85,8 +89,10 @@ export default defineComponent({
} }
}, },
mounted() { mounted() {
if (!this.value) { if (!this.modelValue) {
this.value = DEFAULT_RATIO; this.value = DEFAULT_RATIO;
} else {
this.value = this.modelValue;
} }
this.$emit('update:modelValue', this.value); this.$emit('update:modelValue', this.value);
} }
@@ -1,6 +1,6 @@
<template> <template>
<div class="field"> <div class="field">
<h2 class="title">版本</h2> <h2 class="title">{{ $t('midjourney.name.version') }}</h2>
<el-select v-model="value" class="value" placeholder="Select"> <el-select v-model="value" class="value" placeholder="Select">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select> </el-select>
@@ -16,7 +16,7 @@
</div> </div>
<el-row> <el-row>
<el-col :span="10" :offset="14"> <el-col :span="10" :offset="14">
<div class="pagination m-v-lg"> <div class="pagination">
<pagination :current-page="page" :page-size="limit" :total="total" @change="onPageChange" /> <pagination :current-page="page" :page-size="limit" :total="total" @change="onPageChange" />
</div> </div>
</el-col> </el-col>
@@ -177,5 +177,6 @@ export default defineComponent({
.pagination { .pagination {
height: 60px; height: 60px;
padding-top: 10px;
} }
</style> </style>
@@ -66,7 +66,7 @@
</el-button> </el-button>
</el-tooltip> </el-tooltip>
</div> </div>
<div v-else-if="!modelValue?.response" :class="{ operations: true, full }"> <div v-else-if="!modelValue?.response" v-show="full" :class="{ operations: true, full }">
<el-skeleton :rows="1" /> <el-skeleton :rows="1" />
</div> </div>
<div v-else v-show="full" :class="{ operations: true, full }"> <div v-else v-show="full" :class="{ operations: true, full }">
+3
View File
@@ -1,7 +1,10 @@
export default { export default {
model: '模型',
aspect: '分辨率', aspect: '分辨率',
ratio: '宽高比',
chaos: '混乱度', chaos: '混乱度',
fast: '快速模式', fast: '快速模式',
version: '版本',
imageWeight: '图像权重', imageWeight: '图像权重',
no: '否定提示', no: '否定提示',
quality: '渲染质量', quality: '渲染质量',
+1
View File
@@ -5,6 +5,7 @@ import store from './store/index';
import i18n from './i18n/index'; import i18n from './i18n/index';
import './assets/scss/style.scss'; import './assets/scss/style.scss';
import './assets/css/tailwind.css'; import './assets/css/tailwind.css';
import 'mac-scrollbar/dist/mac-scrollbar.css';
import dayjs from './plugins/dayjs'; import dayjs from './plugins/dayjs';
import './plugins/font-awesome'; import './plugins/font-awesome';
import { vLoading } from 'element-plus'; import { vLoading } from 'element-plus';
+10 -5
View File
@@ -8,6 +8,7 @@
<api-status :application="application" class="mb-4" /> <api-status :application="application" class="mb-4" />
<task-full-list :applications="applications" @custom="onCustom" /> <task-full-list :applications="applications" @custom="onCustom" />
<el-button type="primary" class="btn btn-generate" @click="onGenerateNew"> <el-button type="primary" class="btn btn-generate" @click="onGenerateNew">
<font-awesome-icon icon="fa-solid fa-chevron-left" class="icon icon-rotate mr-1" />
{{ $t('midjourney.button.generateNew') }} {{ $t('midjourney.button.generateNew') }}
</el-button> </el-button>
</div> </div>
@@ -35,6 +36,7 @@ import {
} from '@/operators'; } from '@/operators';
import TaskFullList from '@/components/midjourney/tasks/TaskFullList.vue'; import TaskFullList from '@/components/midjourney/tasks/TaskFullList.vue';
import { ROUTE_MIDJOURNEY_INDEX } from '@/router'; import { ROUTE_MIDJOURNEY_INDEX } from '@/router';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
interface IData { interface IData {
channel: IMidjourneyChannel; channel: IMidjourneyChannel;
@@ -57,13 +59,15 @@ export default defineComponent({
PresetPanel, PresetPanel,
TaskFullList, TaskFullList,
ChannelSelector, ChannelSelector,
ApiStatus ApiStatus,
ElButton,
FontAwesomeIcon
}, },
data(): IData { data(): IData {
return { return {
applications: [], applications: [],
channel: MIDJOURNEY_CHANNEL_FAST, channel: MIDJOURNEY_CHANNEL_FAST,
preset: {}, preset: this.$store.getters.midjourney.preset,
prompt: '', prompt: '',
elements: [], elements: [],
ignore: '', ignore: '',
@@ -144,7 +148,7 @@ export default defineComponent({
.presets { .presets {
width: 260px; width: 260px;
height: 100%; height: 100%;
// background-color: var(--el-bg-color-page); overflow-y: scroll;
} }
.main { .main {
flex: 1; flex: 1;
@@ -161,8 +165,9 @@ export default defineComponent({
.btn.btn-generate { .btn.btn-generate {
position: absolute; position: absolute;
left: 0; left: 30px;
right: 0; top: 30px;
border-radius: 20px;
} }
} }
} }
+13 -5
View File
@@ -12,7 +12,7 @@
<elements-selector v-model="elements" :advanced="preset.advanced" class="mb-4" /> <elements-selector v-model="elements" :advanced="preset.advanced" class="mb-4" />
<ignore-selector v-if="preset.advanced" v-model="ignore" class="mb-4" /> <ignore-selector v-if="preset.advanced" v-model="ignore" class="mb-4" />
<final-prompt v-if="finalPrompt" :model-value="finalPrompt" /> <final-prompt v-if="finalPrompt" :model-value="finalPrompt" />
<el-button type="primary" :disabled="!finalPrompt" @click="onGenerate"> <el-button type="primary" class="btn btn-generate" :disabled="!finalPrompt" @click="onGenerate">
{{ $t('midjourney.button.generate') }} {{ $t('midjourney.button.generate') }}
</el-button> </el-button>
</div> </div>
@@ -84,7 +84,7 @@ export default defineComponent({
return { return {
applications: [], applications: [],
channel: MIDJOURNEY_CHANNEL_FAST, channel: MIDJOURNEY_CHANNEL_FAST,
preset: {}, preset: this.$store.getters.midjourney.preset,
prompt: '', prompt: '',
elements: [], elements: [],
ignore: '', ignore: '',
@@ -112,6 +112,9 @@ export default defineComponent({
if (this.elements.length > 0) { if (this.elements.length > 0) {
content += ',' + this.elements.join(','); content += ',' + this.elements.join(',');
} }
if (this.preset.model) {
content += ` --${this.preset.model}`;
}
if (this.preset.version) { if (this.preset.version) {
content += ` --version ${this.preset.version}`; content += ` --version ${this.preset.version}`;
} }
@@ -200,7 +203,7 @@ export default defineComponent({
}); });
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
.page { .page {
width: 100%; width: 100%;
height: 100%; height: 100%;
@@ -209,21 +212,26 @@ export default defineComponent({
.presets { .presets {
width: 260px; width: 260px;
height: 100%; height: 100%;
// background-color: var(--el-bg-color-page); overflow-y: scroll;
} }
.main { .main {
flex: 1; flex: 1;
padding: 15px; padding: 15px;
height: 100%;
overflow-x: scroll;
.title { .title {
font-size: 14px; font-size: 14px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.btn.btn-generate {
width: 80px;
border-radius: 20px;
}
} }
.result { .result {
overflow-y: scroll; overflow-y: scroll;
width: 400px; width: 400px;
height: 100%; height: 100%;
// background-color: var(--el-bg-color-page);
} }
} }
</style> </style>
+4
View File
@@ -8,7 +8,9 @@ import {
faClock as faRegularClock faClock as faRegularClock
} from '@fortawesome/free-regular-svg-icons'; } from '@fortawesome/free-regular-svg-icons';
import { import {
faChevronLeft as faSolidChevronLeft,
faMicrophone as faSolidMicrophone, faMicrophone as faSolidMicrophone,
faArrowLeft as faSolidArrowLeft,
faUpload as faSolidUpload, faUpload as faSolidUpload,
faMagic as faSolidMagic, faMagic as faSolidMagic,
faInfo as faSolidInfo, faInfo as faSolidInfo,
@@ -63,3 +65,5 @@ library.add(faSolidWandMagicSparkles);
library.add(faSolidMugSaucer); library.add(faSolidMugSaucer);
library.add(faSolidInfo); library.add(faSolidInfo);
library.add(faSolidMagic); library.add(faSolidMagic);
library.add(faSolidArrowLeft);
library.add(faSolidChevronLeft);
+24
View File
@@ -45,6 +45,18 @@ const store = createStore({
}, },
setApplications(state: IState, payload: IApplication[]): void { setApplications(state: IState, payload: IApplication[]): void {
state.applications = payload; state.applications = payload;
},
setMidjourney(state: IState, payload: any): void {
state.apps.midjourney = {
...state.apps.midjourney,
...payload
};
},
setChat(state: IState, payload: any): void {
state.apps.chat = {
...state.apps.chat,
...payload
};
} }
}, },
actions: { actions: {
@@ -63,6 +75,12 @@ const store = createStore({
}, },
setApplications({ commit }: ActionContext<IState, IState>, payload: IApplication[]) { setApplications({ commit }: ActionContext<IState, IState>, payload: IApplication[]) {
commit('setApplications', payload); commit('setApplications', payload);
},
setMidjourney({ commit }: ActionContext<IState, IState>, payload: any) {
commit('setMidjourney', payload);
},
setChat({ commit }: ActionContext<IState, IState>, payload: any) {
commit('setChat', payload);
} }
}, },
getters: { getters: {
@@ -80,6 +98,12 @@ const store = createStore({
}, },
applications(state): IApplication[] | undefined { applications(state): IApplication[] | undefined {
return state.applications; return state.applications;
},
midjourney(state): any {
return state.apps.midjourney;
},
chat(state): any {
return state.apps.chat;
} }
}, },
plugins: [createPersistedState()] plugins: [createPersistedState()]
+5
View File
@@ -2502,6 +2502,11 @@ lru-cache@^6.0.0:
dependencies: dependencies:
yallist "^4.0.0" yallist "^4.0.0"
mac-scrollbar@^0.13.5:
version "0.13.5"
resolved "https://registry.yarnpkg.com/mac-scrollbar/-/mac-scrollbar-0.13.5.tgz#3ce705a39864e30088a51a5aa631e83625c79a72"
integrity sha512-UeCVmDseY0wM67sncAowqHodgrJ3bgPI6nkBeG1eQWNZ3AunXK0zLjBslx2rHZqlVNq2TlNjaV1cIK0yYTrktQ==
magic-string@^0.25.7: magic-string@^0.25.7:
version "0.25.7" version "0.25.7"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051"