fix application bug (#120)

This commit is contained in:
HCode authored and GitHub committed 2024-08-19 16:30:40 +08:00
1 parent d77cd82cbc
commit 0c5ac0b514
17 files changed
+51 -24

No files matched your search

@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix application bug",
"packageName": "@acedatacloud/nexior",
"email": "1348977728@qq.com",
"dependentChangeType": "patch"
}
@@ -28,7 +28,6 @@ export default defineComponent({
...this.$store.state.luma?.config,
custom: val
});
console.log(JSON.stringify(this.$store.state.luma?.config));
}
}
},
+6 -4
View File
@@ -69,8 +69,8 @@ export const getApplications = async ({
state,
rootState
}: ActionContext<IChatState, IRootState>): Promise<IApplication[]> => {
console.debug('start to get applications for chat');
return new Promise((resolve, reject) => {
console.debug('start to get applications for chat');
state.status.getApplications = Status.Request;
applicationOperator
.getAll({
@@ -78,9 +78,8 @@ export const getApplications = async ({
service_id: CHAT_SERVICE_ID
})
.then((response) => {
console.debug('get application success', response?.data);
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);
@@ -100,9 +99,12 @@ export const getApplications = async ({
);
console.debug('set credential with Usage', application);
commit('setCredential', credential);
} else {
console.debug('set application with null', response.data.items?.[0]);
commit('setApplication', response.data.items?.[0]);
}
resolve(response.data.items);
console.debug('save applications success', response.data.items);
console.debug('save application success', response.data.items[0]);
})
.catch((error) => {
state.status.getApplications = Status.Error;
-1
View File
@@ -4,7 +4,6 @@ import { IChatState } from './models';
export const resetAll = (state: IChatState): void => {
state.application = undefined;
state.conversations = undefined;
state.applications = undefined;
state.credential = undefined;
state.service = undefined;
};
+4 -3
View File
@@ -49,7 +49,6 @@ 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);
@@ -69,12 +68,14 @@ export const getApplications = async ({
);
console.debug('set credential with Usage', application);
commit('setCredential', credential);
} else {
console.debug('set application with null', response.data.items?.[0]);
commit('setApplication', response.data.items?.[0]);
}
resolve(response.data.items);
console.debug('save applications success', response.data.items);
console.debug('save application success', response.data.items[0]);
})
.catch((error) => {
console.error('get applications error', error);
state.status.getApplications = Status.Error;
reject(error);
});
+1
View File
@@ -3,6 +3,7 @@ import { IApplication, IChatdocRepository, ICredential, IService, Status } from
export interface IChatdocState {
service: IService | undefined;
application: IApplication | undefined;
applications: IApplication[] | undefined;
repositories: IChatdocRepository[] | undefined;
credential: ICredential | undefined;
status: {
+4
View File
@@ -13,6 +13,9 @@ export const setService = (state: IChatdocState, payload: IService): void => {
export const setApplication = (state: IChatdocState, payload: IApplication): void => {
state.application = payload;
};
export const setApplications = (state: IChatdocState, payload: IApplication[]): void => {
state.applications = payload;
};
export const setRepositories = (state: IChatdocState, payload: IChatdocRepository[]): void => {
const currentRepositories = state.repositories;
@@ -63,6 +66,7 @@ export const setRepository = (state: IChatdocState, payload: IChatdocRepository)
export default {
setService,
setApplication,
setApplications,
setRepositories,
setRepository,
setCredential,
+1
View File
@@ -5,6 +5,7 @@ export default (): IChatdocState => {
return {
service: undefined,
application: undefined,
applications: undefined,
repositories: undefined,
credential: undefined,
status: {
+5 -4
View File
@@ -33,7 +33,7 @@ export const getApplications = async ({
state,
rootState
}: ActionContext<ILumaState, IRootState>): Promise<IApplication[]> => {
console.debug('start to get applications for qrart');
console.debug('start to get applications for luma');
return new Promise((resolve, reject) => {
state.status.getApplications = Status.Request;
applicationOperator
@@ -44,7 +44,6 @@ export const getApplications = async ({
.then((response) => {
console.debug('get applications success', response?.data);
state.status.getApplications = Status.Success;
commit('setApplication', 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);
@@ -64,12 +63,14 @@ export const getApplications = async ({
);
console.debug('set credential with Usage', application);
commit('setCredential', credential);
} else {
console.debug('set application with null', response.data.items?.[0]);
commit('setApplication', response.data.items?.[0]);
}
resolve(response.data.items);
console.debug('save applications success', response.data.items);
console.debug('save application success', response.data.items[0]);
})
.catch((error) => {
console.error('get applications error', error);
state.status.getApplications = Status.Error;
reject(error);
});
+1
View File
@@ -3,6 +3,7 @@ import { ILumaConfig, ILumaTask } from '@/models';
export interface ILumaState {
application: IApplication | undefined;
applications: IApplication[] | undefined;
service: IService | undefined;
credential: ICredential | undefined;
config: ILumaConfig | undefined;
+5
View File
@@ -21,6 +21,10 @@ export const setApplication = (state: ILumaState, payload: IApplication): void =
state.application = payload;
};
export const setApplications = (state: ILumaState, payload: IApplication[]): void => {
state.applications = payload;
};
export const setConfig = (state: ILumaState, payload: ILumaConfig): void => {
state.config = payload;
};
@@ -56,6 +60,7 @@ export const setTasks = (state: ILumaState, payload: any): void => {
export default {
setTasks,
setApplication,
setApplications,
setConfig,
setCredential,
setService,
+1
View File
@@ -5,6 +5,7 @@ export default (): ILumaState => {
return {
service: undefined,
application: undefined,
applications: undefined,
tasks: undefined,
credential: undefined,
config: undefined,
+3 -1
View File
@@ -56,7 +56,6 @@ 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);
@@ -76,6 +75,9 @@ export const getApplications = async ({
);
console.debug('set credential with Usage', application);
commit('setCredential', credential);
} else {
console.debug('set application with null', response.data.items?.[0]);
commit('setApplication', response.data.items?.[0]);
}
resolve(response.data.items);
console.debug('save application success', response.data.items[0]);
+4 -4
View File
@@ -11,10 +11,6 @@ export const resetAll = (state: IMidjourneyState): void => {
};
};
export const setApplications = (state: IMidjourneyState, payload: IApplication[]): void => {
state.applications = payload;
};
export const setService = (state: IMidjourneyState, payload: IService): void => {
state.service = payload;
};
@@ -27,6 +23,10 @@ export const setApplication = (state: IMidjourneyState, payload: IApplication):
state.application = payload;
};
export const setApplications = (state: IMidjourneyState, payload: IApplication[]): void => {
state.applications = payload;
};
export const setPreset = (state: IMidjourneyState, payload: IMidjourneyPreset): void => {
state.preset = payload;
};
+4 -3
View File
@@ -44,7 +44,6 @@ 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);
@@ -64,12 +63,14 @@ export const getApplications = async ({
);
console.debug('set credential with Usage', application);
commit('setCredential', credential);
} else {
console.debug('set application with null', response.data.items?.[0]);
commit('setApplication', response.data.items?.[0]);
}
resolve(response.data.items);
console.debug('save applications success', response.data.items);
console.debug('save application success', response.data.items[0]);
})
.catch((error) => {
console.error('get applications error', error);
state.status.getApplications = Status.Error;
reject(error);
});
-1
View File
@@ -4,7 +4,6 @@ import { IQrartState } from './models';
export const resetAll = (state: IQrartState): void => {
state.service = undefined;
state.application = undefined;
state.applications = undefined;
state.config = undefined;
state.credential = undefined;
state.tasks = undefined;
+5 -2
View File
@@ -42,8 +42,8 @@ export const getApplications = async ({
service_id: SUNO_SERVICE_ID
})
.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);
@@ -63,9 +63,12 @@ export const getApplications = async ({
);
console.debug('set credential with Usage', application);
commit('setCredential', credential);
} else {
console.debug('set application with null', response.data.items?.[0]);
commit('setApplication', response.data.items?.[0]);
}
resolve(response.data.items);
console.debug('save applications success', response.data.items);
console.debug('save application success', response.data.items[0]);
})
.catch((error) => {
state.status.getApplications = Status.Error;