diff --git a/src/components/common/Pagination.vue b/src/components/common/Pagination.vue new file mode 100644 index 00000000..23f8e120 --- /dev/null +++ b/src/components/common/Pagination.vue @@ -0,0 +1,78 @@ + + + + + diff --git a/src/components/midjourney/ChannelSelector.vue b/src/components/midjourney/ChannelSelector.vue index dd22ed95..74651c72 100644 --- a/src/components/midjourney/ChannelSelector.vue +++ b/src/components/midjourney/ChannelSelector.vue @@ -71,7 +71,7 @@ export default defineComponent({ padding: 7px 6px; border-radius: 15px; margin-bottom: 5px; - width: 372px; + width: fit-content; margin-left: auto; margin-right: auto; .button { diff --git a/src/components/midjourney/ElementsSelector.vue b/src/components/midjourney/ElementsSelector.vue index 717ea56e..6690c89a 100644 --- a/src/components/midjourney/ElementsSelector.vue +++ b/src/components/midjourney/ElementsSelector.vue @@ -1,7 +1,7 @@ diff --git a/src/components/midjourney/tasks/TaskBriefList.vue b/src/components/midjourney/tasks/TaskBriefList.vue index f2e2eda3..bf0703ac 100644 --- a/src/components/midjourney/tasks/TaskBriefList.vue +++ b/src/components/midjourney/tasks/TaskBriefList.vue @@ -1,71 +1,78 @@ + + diff --git a/src/components/midjourney/tasks/TaskPreview.vue b/src/components/midjourney/tasks/TaskPreview.vue index ecec64d2..9373ebe1 100644 --- a/src/components/midjourney/tasks/TaskPreview.vue +++ b/src/components/midjourney/tasks/TaskPreview.vue @@ -2,19 +2,38 @@
- 成功 - 失败 + + {{ $t('midjourney.button.success') }} + + + {{ $t('midjourney.button.failed') }} + + + {{ $t('midjourney.button.generating') }} + +
+
+ + + {{ channel?.displayName }} +
-
-
+
+

+ + {{ modelValue?.request?.prompt }} +

+
+

{{ $t('midjourney.field.taskId') }}: {{ modelValue?.id }}

+
-
+
+ + diff --git a/src/pages/midjourney/Index.vue b/src/pages/midjourney/Index.vue index c4d3be23..6645714d 100644 --- a/src/pages/midjourney/Index.vue +++ b/src/pages/midjourney/Index.vue @@ -15,8 +15,8 @@ 生成
-
- +
+
@@ -62,6 +62,8 @@ interface IData { task: IMidjourneyImagineTask | undefined; } +const CALLBACK_URL = 'https://webhook.zhishuyun.com/midjourney'; + export default defineComponent({ name: 'MidjourneyIndex', components: { @@ -162,44 +164,24 @@ export default defineComponent({ console.error('no token or endpoint or question'); return; } - this.task = { - ...this.task, - request, - state: MidjourneyImagineState.PENDING - }; - ElMessage.info(this.$t('midjourney.message.startTaskSuccess')); midjourneyOperator .imagine(request, { token, endpoint, - path, - stream: (response: IMidjourneyImagineResponse) => { - console.log(response); - this.task = { - ...this.task, - state: MidjourneyImagineState.GENERATING, - response - }; - } + path }) .then(() => { - this.task = { - ...this.task, - state: MidjourneyImagineState.FINISHED - }; + ElMessage.info(this.$t('midjourney.message.startTaskSuccess')); }) - .catch((error) => { - this.task = { - ...this.task, - state: MidjourneyImagineState.FAILED, - response: error?.response as IMidjourneyImagineResponse - }; + .catch(() => { + ElMessage.info(this.$t('midjourney.message.startTaskFailed')); }); }, async onCustom(payload: { image_id: string; action: MidjourneyImagineAction }) { const request = { image_id: payload.image_id, - action: payload.action + action: payload.action, + callback_url: CALLBACK_URL }; this.onStartTask(request); }, @@ -207,7 +189,8 @@ export default defineComponent({ const request = { prompt: this.finalPrompt, action: MidjourneyImagineAction.GENERATE, - translation: this.preset?.translation + translation: this.preset?.translation, + callback_url: CALLBACK_URL }; this.onStartTask(request); } @@ -234,7 +217,8 @@ export default defineComponent({ margin-bottom: 10px; } } - .tasks { + .result { + overflow-y: scroll; width: 400px; height: 100%; // background-color: var(--el-bg-color-page); diff --git a/src/plugins/font-awesome.ts b/src/plugins/font-awesome.ts index 07f4cbf0..0d5fe7de 100644 --- a/src/plugins/font-awesome.ts +++ b/src/plugins/font-awesome.ts @@ -4,11 +4,13 @@ import { faUser as faRegularUser, faPaperPlane as faRegularPaperPlane, faComment as faRegularComment, - faSun as faRegularSun + faSun as faRegularSun, + faClock as faRegularClock } from '@fortawesome/free-regular-svg-icons'; import { faMicrophone as faSolidMicrophone, faUpload as faSolidUpload, + faMagic as faSolidMagic, faInfo as faSolidInfo, faStop as faSolidStop, faWandMagicSparkles as faSolidWandMagicSparkles, @@ -48,6 +50,7 @@ library.add(faSolidQuestion); library.add(faSolidStop); library.add(faSolidTriangleExclamation); library.add(faSolidUpRightFromSquare); +library.add(faRegularClock); library.add(faSolidArrowsRotate); library.add(faRegularPaperPlane); library.add(faSolidWind); @@ -59,3 +62,4 @@ library.add(faSolidPalette); library.add(faSolidWandMagicSparkles); library.add(faSolidMugSaucer); library.add(faSolidInfo); +library.add(faSolidMagic); diff --git a/src/router/constants.ts b/src/router/constants.ts index 62942602..a4ae48c7 100644 --- a/src/router/constants.ts +++ b/src/router/constants.ts @@ -8,7 +8,7 @@ export const ROUTE_CHAT_CONVERSATION = 'chat-conversation'; export const ROUTE_CHAT_CONVERSATION_NEW = 'chat-conversation-new'; export const ROUTE_MIDJOURNEY_INDEX = 'midjourney-index'; -// export const ROUTE_MIDJOURNEY_HISTORY = 'paint-history'; +export const ROUTE_MIDJOURNEY_HISTORY = 'midjourney-history'; export const ROUTE_CONVERSATION_NEW = 'conversation-new'; export const ROUTE_CONVERSATION_DETAIL = 'conversation-detail'; diff --git a/src/router/midjourney.ts b/src/router/midjourney.ts index 19804cda..c25dd2a8 100644 --- a/src/router/midjourney.ts +++ b/src/router/midjourney.ts @@ -1,4 +1,4 @@ -import { ROUTE_MIDJOURNEY_INDEX } from './constants'; +import { ROUTE_MIDJOURNEY_HISTORY, ROUTE_MIDJOURNEY_INDEX } from './constants'; export default { path: '/midjourney', @@ -8,6 +8,11 @@ export default { path: '', name: ROUTE_MIDJOURNEY_INDEX, component: () => import('@/pages/midjourney/Index.vue') + }, + { + path: 'history', + name: ROUTE_MIDJOURNEY_HISTORY, + component: () => import('@/pages/midjourney/History.vue') } ] }; diff --git a/src/store/index.ts b/src/store/index.ts index 4de96d0c..789d9669 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -17,7 +17,11 @@ const store = createStore({ endpoint: ENDPOINT, stream: false }, - applications: [] + applications: [], + apps: { + chat: {}, + midjourney: {} + } }; }, mutations: { diff --git a/src/store/models.ts b/src/store/models.ts index e5eab9f3..233e42d7 100644 --- a/src/store/models.ts +++ b/src/store/models.ts @@ -15,4 +15,8 @@ export interface IState { user: IUser; setting: ISetting; applications: IApplication[]; + apps: { + chat: {}; + midjourney: {}; + }; }