diff --git a/change/@acedatacloud-nexior-76135fa3-ba5e-49a4-b086-7be79dd4babd.json b/change/@acedatacloud-nexior-76135fa3-ba5e-49a4-b086-7be79dd4babd.json new file mode 100644 index 00000000..a462dd00 --- /dev/null +++ b/change/@acedatacloud-nexior-76135fa3-ba5e-49a4-b086-7be79dd4babd.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "fix application bug", + "packageName": "@acedatacloud/nexior", + "email": "1348977728@qq.com", + "dependentChangeType": "patch" +} diff --git a/src/components/luma/config/CustomSelector.vue b/src/components/luma/config/CustomSelector.vue index a834e0b9..6db2b46a 100644 --- a/src/components/luma/config/CustomSelector.vue +++ b/src/components/luma/config/CustomSelector.vue @@ -28,7 +28,6 @@ export default defineComponent({ ...this.$store.state.luma?.config, custom: val }); - console.log(JSON.stringify(this.$store.state.luma?.config)); } } }, diff --git a/src/store/chat/actions.ts b/src/store/chat/actions.ts index 29b30946..9a2adefb 100644 --- a/src/store/chat/actions.ts +++ b/src/store/chat/actions.ts @@ -69,8 +69,8 @@ export const getApplications = async ({ state, rootState }: ActionContext): Promise => { + 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; diff --git a/src/store/chat/mutations.ts b/src/store/chat/mutations.ts index 372dd9a8..d469d72c 100644 --- a/src/store/chat/mutations.ts +++ b/src/store/chat/mutations.ts @@ -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; }; diff --git a/src/store/chatdoc/actions.ts b/src/store/chatdoc/actions.ts index 89dc1987..ac1f65fc 100644 --- a/src/store/chatdoc/actions.ts +++ b/src/store/chatdoc/actions.ts @@ -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); }); diff --git a/src/store/chatdoc/models.ts b/src/store/chatdoc/models.ts index a4c2cc67..54a8fd88 100644 --- a/src/store/chatdoc/models.ts +++ b/src/store/chatdoc/models.ts @@ -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: { diff --git a/src/store/chatdoc/mutations.ts b/src/store/chatdoc/mutations.ts index a7d53be8..69c2b709 100644 --- a/src/store/chatdoc/mutations.ts +++ b/src/store/chatdoc/mutations.ts @@ -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, diff --git a/src/store/chatdoc/state.ts b/src/store/chatdoc/state.ts index 70e45fc0..669a232a 100644 --- a/src/store/chatdoc/state.ts +++ b/src/store/chatdoc/state.ts @@ -5,6 +5,7 @@ export default (): IChatdocState => { return { service: undefined, application: undefined, + applications: undefined, repositories: undefined, credential: undefined, status: { diff --git a/src/store/luma/actions.ts b/src/store/luma/actions.ts index e1f5b1e2..90ece3ce 100644 --- a/src/store/luma/actions.ts +++ b/src/store/luma/actions.ts @@ -33,7 +33,7 @@ export const getApplications = async ({ state, rootState }: ActionContext): Promise => { - 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); }); diff --git a/src/store/luma/models.ts b/src/store/luma/models.ts index 3b94ddd4..c1fd9565 100644 --- a/src/store/luma/models.ts +++ b/src/store/luma/models.ts @@ -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; diff --git a/src/store/luma/mutations.ts b/src/store/luma/mutations.ts index 37b48101..de64be47 100644 --- a/src/store/luma/mutations.ts +++ b/src/store/luma/mutations.ts @@ -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, diff --git a/src/store/luma/state.ts b/src/store/luma/state.ts index 11709d9f..c50d9bc1 100644 --- a/src/store/luma/state.ts +++ b/src/store/luma/state.ts @@ -5,6 +5,7 @@ export default (): ILumaState => { return { service: undefined, application: undefined, + applications: undefined, tasks: undefined, credential: undefined, config: undefined, diff --git a/src/store/midjourney/actions.ts b/src/store/midjourney/actions.ts index c4c33edb..f8a93940 100644 --- a/src/store/midjourney/actions.ts +++ b/src/store/midjourney/actions.ts @@ -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]); diff --git a/src/store/midjourney/mutations.ts b/src/store/midjourney/mutations.ts index 00436b51..4f005449 100644 --- a/src/store/midjourney/mutations.ts +++ b/src/store/midjourney/mutations.ts @@ -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; }; diff --git a/src/store/qrart/actions.ts b/src/store/qrart/actions.ts index ced391f3..2ab002cb 100644 --- a/src/store/qrart/actions.ts +++ b/src/store/qrart/actions.ts @@ -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); }); diff --git a/src/store/qrart/mutations.ts b/src/store/qrart/mutations.ts index 192fd17a..2ac5bf4d 100644 --- a/src/store/qrart/mutations.ts +++ b/src/store/qrart/mutations.ts @@ -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; diff --git a/src/store/suno/actions.ts b/src/store/suno/actions.ts index df020a08..e5eab066 100644 --- a/src/store/suno/actions.ts +++ b/src/store/suno/actions.ts @@ -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;