From 7bfb646db1bc026799590ceead6c8e24dbe37d6c Mon Sep 17 00:00:00 2001 From: Germey Date: Sat, 30 Dec 2023 18:34:33 +0800 Subject: [PATCH] finish refactor of mj --- src/components/midjourney/PresetPanel.vue | 13 +-- .../midjourney/tasks/TaskBriefList.vue | 75 +++++---------- .../midjourney/tasks/TaskFullList.vue | 92 +++++++------------ src/layouts/Chat.vue | 12 ++- src/operators/instance.ts | 1 - src/pages/chat/Conversation.vue | 3 +- src/pages/midjourney/History.vue | 52 ++++------- src/pages/midjourney/Index.vue | 45 ++++----- src/store/index.ts | 13 ++- src/store/midjourney/actions.ts | 72 ++++++++++++++- src/store/midjourney/index.ts | 8 +- src/store/midjourney/models.ts | 7 +- src/store/midjourney/mutations.ts | 23 ++++- src/store/midjourney/state.ts | 12 +++ 14 files changed, 232 insertions(+), 196 deletions(-) create mode 100644 src/store/midjourney/state.ts diff --git a/src/components/midjourney/PresetPanel.vue b/src/components/midjourney/PresetPanel.vue index abaae5d..622b68f 100644 --- a/src/components/midjourney/PresetPanel.vue +++ b/src/components/midjourney/PresetPanel.vue @@ -45,25 +45,14 @@ export default defineComponent({ TranslationSelector, NijiSelector }, - props: { - modelValue: { - type: Object, - default: () => ({}) - } - }, - emits: ['update:modelValue'], data() { return { - preset: this.modelValue + preset: this.$store.state.midjourney.preset }; }, watch: { - modelValue(val) { - this.preset = val; - }, preset: { handler(val) { - this.$emit('update:modelValue', val); this.$store.dispatch('midjourney/setPreset', { ...val }); diff --git a/src/components/midjourney/tasks/TaskBriefList.vue b/src/components/midjourney/tasks/TaskBriefList.vue index 22c8a46..eb819a6 100644 --- a/src/components/midjourney/tasks/TaskBriefList.vue +++ b/src/components/midjourney/tasks/TaskBriefList.vue @@ -23,15 +23,9 @@ diff --git a/src/operators/instance.ts b/src/operators/instance.ts index 1d23a5c..1f7f591 100644 --- a/src/operators/instance.ts +++ b/src/operators/instance.ts @@ -15,7 +15,6 @@ const httpClient: AxiosInstance = axios.create({ }); httpClient.interceptors.request.use((config) => { - console.log('store', store.state); const accessToken = store.state.token?.access; if (!config.headers) { config.headers = {}; diff --git a/src/pages/chat/Conversation.vue b/src/pages/chat/Conversation.vue index 342cb0c..c2396df 100644 --- a/src/pages/chat/Conversation.vue +++ b/src/pages/chat/Conversation.vue @@ -38,14 +38,13 @@ import InputBox from '@/components/chat/InputBox.vue'; import ModelSelector from '@/components/chat/ModelSelector.vue'; import { ERROR_CODE_CANCELED, ERROR_CODE_UNKNOWN } from '@/constants/errorCode'; import ApiStatus from '@/components/common/ApiStatus.vue'; -import { ROUTE_CHAT_CONVERSATION, ROUTE_CHAT_CONVERSATION_NEW } from '@/router'; +import { ROUTE_CHAT_CONVERSATION } from '@/router'; import { Status } from '@/store/common/models'; import { v4 as uuid } from 'uuid'; export interface IData { model: IChatModel; question: ''; - // messages: IChatMessage[]; } export default defineComponent({ diff --git a/src/pages/midjourney/History.vue b/src/pages/midjourney/History.vue index 54a245b..3ca34dc 100644 --- a/src/pages/midjourney/History.vue +++ b/src/pages/midjourney/History.vue @@ -1,7 +1,7 @@