update multi fetch
This commit is contained in:
1 parent
5d28ab219f
commit
e4bd995e6c
6 files changed
+31
-17
No files matched your search
@@ -26,6 +26,7 @@
|
||||
"@sentry/tracing": "^7.34.0",
|
||||
"@sentry/vue": "^7.34.0",
|
||||
"@types/mustache": "^4.2.2",
|
||||
"@types/qs": "^6.9.9",
|
||||
"@types/uuid": "^8.3.4",
|
||||
"axios": "^0.22.0",
|
||||
"codemirror": "^6.0.1",
|
||||
@@ -38,6 +39,7 @@
|
||||
"mustache": "^4.2.0",
|
||||
"programming-languages-logos": "^0.0.3",
|
||||
"qrcode.vue": "^3.3.3",
|
||||
"qs": "^6.11.2",
|
||||
"query-string": "^8.1.0",
|
||||
"typescript-cookie": "^1.0.3",
|
||||
"url-join": "^5.0.0",
|
||||
|
||||
+3
-11
@@ -48,7 +48,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
application(val) {
|
||||
applications(val) {
|
||||
if (val) {
|
||||
this.getHistoryTasks();
|
||||
}
|
||||
@@ -75,16 +75,8 @@ export default defineComponent({
|
||||
limit: 5,
|
||||
ordering: '-created_at'
|
||||
});
|
||||
const tasks = await Promise.all(
|
||||
apiUsages.map(async (apiUsage) => {
|
||||
const taskId = apiUsage.metadata?.task_id;
|
||||
const { data: task } = await midjourneyOperator.task(taskId);
|
||||
if (task.response?.success === false) {
|
||||
task.state = MidjourneyImagineState.FAILED;
|
||||
}
|
||||
return task;
|
||||
})
|
||||
);
|
||||
const tasks = (await midjourneyOperator.tasks(apiUsages.map((apiUsage) => apiUsage.metadata?.task_id as string)))
|
||||
.data;
|
||||
this.historyTasks = tasks.filter((task) => task && task?.response);
|
||||
}
|
||||
}
|
||||
File renamed without changes.
@@ -1,12 +1,16 @@
|
||||
import router, { ROUTE_AUTH_LOGIN } from '@/router';
|
||||
import store from '@/store';
|
||||
import axios, { AxiosInstance } from 'axios';
|
||||
import qs from 'qs';
|
||||
|
||||
const httpClient: AxiosInstance = axios.create({
|
||||
baseURL: '/api/v1',
|
||||
headers: {
|
||||
'Content-type': 'application/json',
|
||||
Accept: 'application/json'
|
||||
},
|
||||
paramsSerializer: function (params) {
|
||||
return qs.stringify(params, { arrayFormat: 'repeat' });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ import {
|
||||
IMidjourneyImagineRequest
|
||||
} from '@/operators';
|
||||
import ApiStatus from '@/components/common/ApiStatus.vue';
|
||||
import TaskBriefList from '@/components/midjourney/TaskBriefList.vue';
|
||||
import TaskBriefList from '@/components/midjourney/tasks/TaskBriefList.vue';
|
||||
import FinalPrompt from '@/components/midjourney/FinalPrompt.vue';
|
||||
|
||||
interface IData {
|
||||
@@ -53,7 +53,6 @@ interface IData {
|
||||
ignore: string;
|
||||
initializing: boolean;
|
||||
applied: boolean | undefined;
|
||||
application: IApplication | undefined;
|
||||
applications: IApplication[];
|
||||
task: IMidjourneyImagineTask | undefined;
|
||||
}
|
||||
@@ -73,7 +72,6 @@ export default defineComponent({
|
||||
},
|
||||
data(): IData {
|
||||
return {
|
||||
application: undefined,
|
||||
applications: [],
|
||||
channel: MIDJOURNEY_CHANNEL_FAST,
|
||||
preset: {},
|
||||
@@ -86,6 +84,12 @@ export default defineComponent({
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
application() {
|
||||
if (this.applications && this.applications.length > 0) {
|
||||
return this.applications.filter((item) => item.api_id === this.channel.apiId)[0];
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
finalPrompt(): string {
|
||||
let content = '';
|
||||
if (this.prompt) {
|
||||
@@ -125,13 +129,13 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.onFetchApplication();
|
||||
this.onFetchApplications();
|
||||
},
|
||||
methods: {
|
||||
async onSelectChannel() {
|
||||
await this.onFetchApplication();
|
||||
await this.onFetchApplications();
|
||||
},
|
||||
async onFetchApplication() {
|
||||
async onFetchApplications() {
|
||||
this.initializing = true;
|
||||
const { data: applications } = await applicationOperator.getAll({
|
||||
user_id: this.$store.state.user.id,
|
||||
|
||||
@@ -575,6 +575,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
|
||||
integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==
|
||||
|
||||
"@types/qs@^6.9.9":
|
||||
version "6.9.9"
|
||||
resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.9.tgz#66f7b26288f6799d279edf13da7ccd40d2fa9197"
|
||||
integrity sha512-wYLxw35euwqGvTDx6zfY1vokBFnsK0HNrzc6xNHchxfO2hpuRg74GbkEW7e3sSmPvj0TjCDT1VCa6OtHXnubsg==
|
||||
|
||||
"@types/uuid@^8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.4.tgz#bd86a43617df0594787d38b735f55c805becf1bc"
|
||||
@@ -2883,6 +2888,13 @@ qrcode.vue@^3.3.3:
|
||||
resolved "https://registry.yarnpkg.com/qrcode.vue/-/qrcode.vue-3.3.3.tgz#00262244311a0ee1956fb7a0e238197ff7e14cfa"
|
||||
integrity sha512-OsD4tQjIbxg/K6D5ZkWjBdYI9eg9K2i8qeYILdEAX5mdAydSAxV7xKmmZSP/hA12olLqEMZ9ryqDQrwa9jEMgw==
|
||||
|
||||
qs@^6.11.2:
|
||||
version "6.11.2"
|
||||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.2.tgz#64bea51f12c1f5da1bc01496f48ffcff7c69d7d9"
|
||||
integrity sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==
|
||||
dependencies:
|
||||
side-channel "^1.0.4"
|
||||
|
||||
query-string@^8.1.0:
|
||||
version "8.1.0"
|
||||
resolved "https://registry.yarnpkg.com/query-string/-/query-string-8.1.0.tgz#e7f95367737219544cd360a11a4f4ca03836e115"
|
||||
|
||||
Reference in new issue
Block a user