Add application selection (#186)
Co-authored-by: AceDataCloud <office@acedata.cloud>
This commit is contained in:
1 parent
7af0e714cd
commit
d357d1c857
24 files changed
+266
-48
No files matched your search
@@ -29,6 +29,13 @@ export const setModelGroup = async ({ commit }: any, payload: IChatModelGroup):
|
||||
export const setApplication = async ({ commit }: any, payload: IApplication): Promise<void> => {
|
||||
console.debug('set application', payload);
|
||||
commit('setApplication', payload);
|
||||
const credential = payload?.credentials?.find((credential) => credential?.host === window.location.origin);
|
||||
commit('setCredential', credential);
|
||||
};
|
||||
|
||||
export const setApplications = async ({ commit }: any, payload: IApplication[]): Promise<void> => {
|
||||
console.debug('set applications', payload);
|
||||
commit('setApplications', payload);
|
||||
};
|
||||
|
||||
export const setService = async ({ commit }: any, payload: IService): Promise<void> => {
|
||||
@@ -93,6 +100,7 @@ export const getApplications = async ({
|
||||
.then((response) => {
|
||||
console.debug('get applications success', response?.data);
|
||||
state.status.getApplications = Status.Success;
|
||||
commit('setApplications', response.data.items);
|
||||
// check if there is any application with 'Period' type
|
||||
const application = response.data.items?.find((application) => application?.type === IApplicationType.PERIOD);
|
||||
const application2 = response.data.items?.find((application) => application?.type === IApplicationType.USAGE);
|
||||
@@ -171,6 +179,7 @@ export default {
|
||||
setService,
|
||||
setCredential,
|
||||
setApplication,
|
||||
setApplications,
|
||||
getApplications,
|
||||
setConversation,
|
||||
setConversations,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export default [
|
||||
'chat.application',
|
||||
'chat.applications',
|
||||
'chat.service',
|
||||
'chat.credential',
|
||||
'chat.conversations',
|
||||
|
||||
@@ -25,8 +25,14 @@ export const setService = async ({ commit }: any, payload: IService): Promise<vo
|
||||
commit('setService', payload);
|
||||
};
|
||||
|
||||
export const setApplication = ({ commit }: any, payload: IApplication[]) => {
|
||||
export const setApplication = ({ commit }: any, payload: IApplication) => {
|
||||
commit('setApplication', payload);
|
||||
const credential = payload?.credentials?.find((credential) => credential?.host === window.location.origin);
|
||||
commit('setCredential', credential);
|
||||
};
|
||||
|
||||
export const setApplications = ({ commit }: any, payload: IApplication[]) => {
|
||||
commit('setApplications', payload);
|
||||
};
|
||||
|
||||
export const getApplications = async ({
|
||||
@@ -45,6 +51,7 @@ export const getApplications = async ({
|
||||
.then((response) => {
|
||||
console.debug('get applications success', response?.data);
|
||||
state.status.getApplications = Status.Success;
|
||||
commit('setApplications', response.data.items);
|
||||
// check if there is any application with 'Period' type
|
||||
const application = response.data.items?.find((application) => application?.type === IApplicationType.PERIOD);
|
||||
const application2 = response.data.items?.find((application) => application?.type === IApplicationType.USAGE);
|
||||
@@ -165,6 +172,7 @@ export default {
|
||||
resetAll,
|
||||
setCredential,
|
||||
setConfig,
|
||||
setApplications,
|
||||
setApplication,
|
||||
getApplications,
|
||||
setTasks,
|
||||
|
||||
@@ -25,8 +25,14 @@ export const setService = async ({ commit }: any, payload: IService): Promise<vo
|
||||
commit('setService', payload);
|
||||
};
|
||||
|
||||
export const setApplication = ({ commit }: any, payload: IApplication[]) => {
|
||||
export const setApplication = ({ commit }: any, payload: IApplication) => {
|
||||
commit('setApplication', payload);
|
||||
const credential = payload?.credentials?.find((credential) => credential?.host === window.location.origin);
|
||||
commit('setCredential', credential);
|
||||
};
|
||||
|
||||
export const setApplications = ({ commit }: any, payload: IApplication[]) => {
|
||||
commit('setApplications', payload);
|
||||
};
|
||||
|
||||
export const getApplications = async ({
|
||||
@@ -45,6 +51,7 @@ export const getApplications = async ({
|
||||
.then((response) => {
|
||||
console.debug('get applications success', response?.data);
|
||||
state.status.getApplications = Status.Success;
|
||||
commit('setApplications', response.data.items);
|
||||
// check if there is any application with 'Period' type
|
||||
const application = response.data.items?.find((application) => application?.type === IApplicationType.PERIOD);
|
||||
const application2 = response.data.items?.find((application) => application?.type === IApplicationType.USAGE);
|
||||
@@ -166,6 +173,7 @@ export default {
|
||||
setCredential,
|
||||
setConfig,
|
||||
setApplication,
|
||||
setApplications,
|
||||
getApplications,
|
||||
setTasks,
|
||||
setTasksItems,
|
||||
|
||||
@@ -25,8 +25,14 @@ export const setService = async ({ commit }: any, payload: IService): Promise<vo
|
||||
commit('setService', payload);
|
||||
};
|
||||
|
||||
export const setApplication = ({ commit }: any, payload: IApplication[]) => {
|
||||
export const setApplication = ({ commit }: any, payload: IApplication) => {
|
||||
commit('setApplication', payload);
|
||||
const credential = payload?.credentials?.find((credential) => credential?.host === window.location.origin);
|
||||
commit('setCredential', credential);
|
||||
};
|
||||
|
||||
export const setApplications = ({ commit }: any, payload: IApplication[]) => {
|
||||
commit('setApplications', payload);
|
||||
};
|
||||
|
||||
export const getApplications = async ({
|
||||
@@ -45,6 +51,7 @@ export const getApplications = async ({
|
||||
.then((response) => {
|
||||
console.debug('get applications success', response?.data);
|
||||
state.status.getApplications = Status.Success;
|
||||
commit('setApplications', response.data.items);
|
||||
// check if there is any application with 'Period' type
|
||||
const application = response.data.items?.find((application) => application?.type === IApplicationType.PERIOD);
|
||||
const application2 = response.data.items?.find((application) => application?.type === IApplicationType.USAGE);
|
||||
@@ -165,6 +172,7 @@ export default {
|
||||
setCredential,
|
||||
setConfig,
|
||||
setApplication,
|
||||
setApplications,
|
||||
getApplications,
|
||||
setTasks,
|
||||
setTasksItems,
|
||||
|
||||
@@ -24,8 +24,14 @@ export const setService = async ({ commit }: any, payload: IService): Promise<vo
|
||||
commit('setService', payload);
|
||||
};
|
||||
|
||||
export const setApplication = ({ commit }: any, payload: IApplication[]) => {
|
||||
export const setApplication = ({ commit }: any, payload: IApplication) => {
|
||||
commit('setApplication', payload);
|
||||
const credential = payload?.credentials?.find((credential) => credential?.host === window.location.origin);
|
||||
commit('setCredential', credential);
|
||||
};
|
||||
|
||||
export const setApplications = ({ commit }: any, payload: IApplication[]) => {
|
||||
commit('setApplications', payload);
|
||||
};
|
||||
|
||||
export const getApplications = async ({
|
||||
@@ -44,6 +50,7 @@ export const getApplications = async ({
|
||||
.then((response) => {
|
||||
console.debug('get applications success', response?.data);
|
||||
state.status.getApplications = Status.Success;
|
||||
commit('setApplications', response.data.items);
|
||||
// check if there is any application with 'Period' type
|
||||
const application = response.data.items?.find((application) => application?.type === IApplicationType.PERIOD);
|
||||
const application2 = response.data.items?.find((application) => application?.type === IApplicationType.USAGE);
|
||||
@@ -150,6 +157,7 @@ export default {
|
||||
setCredential,
|
||||
setConfig,
|
||||
setApplication,
|
||||
setApplications,
|
||||
getApplications,
|
||||
setTasks,
|
||||
setTasksItems,
|
||||
|
||||
@@ -2,15 +2,7 @@ import { applicationOperator, midjourneyOperator, serviceOperator } from '@/oper
|
||||
import { IMidjourneyState } from './models';
|
||||
import { ActionContext } from 'vuex';
|
||||
import { IRootState } from '../common/models';
|
||||
import {
|
||||
IApplication,
|
||||
IApplicationType,
|
||||
ICredential,
|
||||
IMidjourneyConfig,
|
||||
IMidjourneyTask,
|
||||
IMidjourneyTasksResponse,
|
||||
IService
|
||||
} from '@/models';
|
||||
import { IApplication, IApplicationType, ICredential, IMidjourneyConfig, IMidjourneyTask, IService } from '@/models';
|
||||
import { Status } from '@/models/common';
|
||||
import { MIDJOURNEY_SERVICE_ID } from '@/constants';
|
||||
import { mergeAndSortLists } from '@/utils/merge';
|
||||
@@ -45,8 +37,14 @@ export const setService = async ({ commit }: any, payload: IService): Promise<vo
|
||||
commit('setService', payload);
|
||||
};
|
||||
|
||||
export const setApplication = ({ commit }: any, payload: IApplication[]) => {
|
||||
export const setApplication = ({ commit }: any, payload: IApplication) => {
|
||||
commit('setApplication', payload);
|
||||
const credential = payload?.credentials?.find((credential) => credential?.host === window.location.origin);
|
||||
commit('setCredential', credential);
|
||||
};
|
||||
|
||||
export const setApplications = ({ commit }: any, payload: IApplication[]) => {
|
||||
commit('setApplications', payload);
|
||||
};
|
||||
|
||||
export const getApplications = async ({
|
||||
@@ -65,6 +63,7 @@ export const getApplications = async ({
|
||||
.then((response) => {
|
||||
console.debug('get applications success', response?.data);
|
||||
state.status.getApplications = Status.Success;
|
||||
commit('setApplications', response.data.items);
|
||||
// check if there is any application with 'Period' type
|
||||
const application = response.data.items?.find((application) => application?.type === IApplicationType.PERIOD);
|
||||
const application2 = response.data.items?.find((application) => application?.type === IApplicationType.USAGE);
|
||||
@@ -175,6 +174,7 @@ export default {
|
||||
setConfig,
|
||||
setMode,
|
||||
setApplication,
|
||||
setApplications,
|
||||
getApplications,
|
||||
setTasks,
|
||||
getTasks
|
||||
|
||||
@@ -25,8 +25,14 @@ export const setService = async ({ commit }: any, payload: IService): Promise<vo
|
||||
commit('setService', payload);
|
||||
};
|
||||
|
||||
export const setApplication = ({ commit }: any, payload: IApplication[]) => {
|
||||
export const setApplication = ({ commit }: any, payload: IApplication) => {
|
||||
commit('setApplication', payload);
|
||||
const credential = payload?.credentials?.find((credential) => credential?.host === window.location.origin);
|
||||
commit('setCredential', credential);
|
||||
};
|
||||
|
||||
export const setApplications = ({ commit }: any, payload: IApplication[]) => {
|
||||
commit('setApplications', payload);
|
||||
};
|
||||
|
||||
export const getApplications = async ({
|
||||
@@ -45,6 +51,7 @@ export const getApplications = async ({
|
||||
.then((response) => {
|
||||
console.debug('get applications success', response?.data);
|
||||
state.status.getApplications = Status.Success;
|
||||
commit('setApplications', response.data.items);
|
||||
// check if there is any application with 'Period' type
|
||||
const application = response.data.items?.find((application) => application?.type === IApplicationType.PERIOD);
|
||||
const application2 = response.data.items?.find((application) => application?.type === IApplicationType.USAGE);
|
||||
@@ -166,6 +173,7 @@ export default {
|
||||
setCredential,
|
||||
setConfig,
|
||||
setApplication,
|
||||
setApplications,
|
||||
getApplications,
|
||||
setTasks,
|
||||
setTasksItems,
|
||||
|
||||
@@ -25,8 +25,14 @@ export const setService = async ({ commit }: any, payload: IService): Promise<vo
|
||||
commit('setService', payload);
|
||||
};
|
||||
|
||||
export const setApplication = ({ commit }: any, payload: IApplication[]) => {
|
||||
export const setApplication = ({ commit }: any, payload: IApplication) => {
|
||||
commit('setApplication', payload);
|
||||
const credential = payload?.credentials?.find((credential) => credential?.host === window.location.origin);
|
||||
commit('setCredential', credential);
|
||||
};
|
||||
|
||||
export const setApplications = ({ commit }: any, payload: IApplication[]) => {
|
||||
commit('setApplications', payload);
|
||||
};
|
||||
|
||||
export const getApplications = async ({
|
||||
@@ -45,6 +51,7 @@ export const getApplications = async ({
|
||||
.then((response) => {
|
||||
console.debug('get applications success', response?.data);
|
||||
state.status.getApplications = Status.Success;
|
||||
commit('setApplications', response.data.items);
|
||||
// check if there is any application with 'Period' type
|
||||
const application = response.data.items?.find((application) => application?.type === IApplicationType.PERIOD);
|
||||
const application2 = response.data.items?.find((application) => application?.type === IApplicationType.USAGE);
|
||||
@@ -165,6 +172,7 @@ export default {
|
||||
setCredential,
|
||||
setConfig,
|
||||
setApplication,
|
||||
setApplications,
|
||||
getApplications,
|
||||
setTasks,
|
||||
setTasksItems,
|
||||
|
||||
@@ -25,8 +25,14 @@ export const setService = async ({ commit }: any, payload: IService): Promise<vo
|
||||
commit('setService', payload);
|
||||
};
|
||||
|
||||
export const setApplication = ({ commit }: any, payload: IApplication[]) => {
|
||||
export const setApplication = ({ commit }: any, payload: IApplication) => {
|
||||
commit('setApplication', payload);
|
||||
const credential = payload?.credentials?.find((credential) => credential?.host === window.location.origin);
|
||||
commit('setCredential', credential);
|
||||
};
|
||||
|
||||
export const setApplications = ({ commit }: any, payload: IApplication[]) => {
|
||||
commit('setApplications', payload);
|
||||
};
|
||||
|
||||
export const getApplications = async ({
|
||||
@@ -45,6 +51,7 @@ export const getApplications = async ({
|
||||
.then((response) => {
|
||||
console.debug('get applications success', response?.data);
|
||||
state.status.getApplications = Status.Success;
|
||||
commit('setApplications', response.data.items);
|
||||
// check if there is any application with 'Period' type
|
||||
const application = response.data.items?.find((application) => application?.type === IApplicationType.PERIOD);
|
||||
const application2 = response.data.items?.find((application) => application?.type === IApplicationType.USAGE);
|
||||
@@ -170,6 +177,7 @@ export default {
|
||||
setCredential,
|
||||
setConfig,
|
||||
setApplication,
|
||||
setApplications,
|
||||
getApplications,
|
||||
setTasks,
|
||||
setTasksItems,
|
||||
|
||||
Reference in new issue
Block a user