Skip to content

Commit 0c5ac0b

Browse files
fix application bug (#120)
1 parent d77cd82 commit 0c5ac0b

17 files changed

+51
-24
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "fix application bug",
4+
"packageName": "@acedatacloud/nexior",
5+
"email": "1348977728@qq.com",
6+
"dependentChangeType": "patch"
7+
}

src/components/luma/config/CustomSelector.vue

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export default defineComponent({
2828
...this.$store.state.luma?.config,
2929
custom: val
3030
});
31-
console.log(JSON.stringify(this.$store.state.luma?.config));
3231
}
3332
}
3433
},

src/store/chat/actions.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,17 @@ export const getApplications = async ({
6969
state,
7070
rootState
7171
}: ActionContext<IChatState, IRootState>): Promise<IApplication[]> => {
72+
console.debug('start to get applications for chat');
7273
return new Promise((resolve, reject) => {
73-
console.debug('start to get applications for chat');
7474
state.status.getApplications = Status.Request;
7575
applicationOperator
7676
.getAll({
7777
user_id: rootState?.user?.id,
7878
service_id: CHAT_SERVICE_ID
7979
})
8080
.then((response) => {
81-
console.debug('get application success', response?.data);
81+
console.debug('get applications success', response?.data);
8282
state.status.getApplications = Status.Success;
83-
commit('setApplications', response.data.items);
8483
// check if there is any application with 'Period' type
8584
const application = response.data.items?.find((application) => application?.type === IApplicationType.PERIOD);
8685
const application2 = response.data.items?.find((application) => application?.type === IApplicationType.USAGE);
@@ -100,9 +99,12 @@ export const getApplications = async ({
10099
);
101100
console.debug('set credential with Usage', application);
102101
commit('setCredential', credential);
102+
} else {
103+
console.debug('set application with null', response.data.items?.[0]);
104+
commit('setApplication', response.data.items?.[0]);
103105
}
104106
resolve(response.data.items);
105-
console.debug('save applications success', response.data.items);
107+
console.debug('save application success', response.data.items[0]);
106108
})
107109
.catch((error) => {
108110
state.status.getApplications = Status.Error;

src/store/chat/mutations.ts

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { IChatState } from './models';
44
export const resetAll = (state: IChatState): void => {
55
state.application = undefined;
66
state.conversations = undefined;
7-
state.applications = undefined;
87
state.credential = undefined;
98
state.service = undefined;
109
};

src/store/chatdoc/actions.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export const getApplications = async ({
4949
.then((response) => {
5050
console.debug('get applications success', response?.data);
5151
state.status.getApplications = Status.Success;
52-
commit('setApplications', response.data.items);
5352
// check if there is any application with 'Period' type
5453
const application = response.data.items?.find((application) => application?.type === IApplicationType.PERIOD);
5554
const application2 = response.data.items?.find((application) => application?.type === IApplicationType.USAGE);
@@ -69,12 +68,14 @@ export const getApplications = async ({
6968
);
7069
console.debug('set credential with Usage', application);
7170
commit('setCredential', credential);
71+
} else {
72+
console.debug('set application with null', response.data.items?.[0]);
73+
commit('setApplication', response.data.items?.[0]);
7274
}
7375
resolve(response.data.items);
74-
console.debug('save applications success', response.data.items);
76+
console.debug('save application success', response.data.items[0]);
7577
})
7678
.catch((error) => {
77-
console.error('get applications error', error);
7879
state.status.getApplications = Status.Error;
7980
reject(error);
8081
});

src/store/chatdoc/models.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { IApplication, IChatdocRepository, ICredential, IService, Status } from
33
export interface IChatdocState {
44
service: IService | undefined;
55
application: IApplication | undefined;
6+
applications: IApplication[] | undefined;
67
repositories: IChatdocRepository[] | undefined;
78
credential: ICredential | undefined;
89
status: {

src/store/chatdoc/mutations.ts

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export const setService = (state: IChatdocState, payload: IService): void => {
1313
export const setApplication = (state: IChatdocState, payload: IApplication): void => {
1414
state.application = payload;
1515
};
16+
export const setApplications = (state: IChatdocState, payload: IApplication[]): void => {
17+
state.applications = payload;
18+
};
1619

1720
export const setRepositories = (state: IChatdocState, payload: IChatdocRepository[]): void => {
1821
const currentRepositories = state.repositories;
@@ -63,6 +66,7 @@ export const setRepository = (state: IChatdocState, payload: IChatdocRepository)
6366
export default {
6467
setService,
6568
setApplication,
69+
setApplications,
6670
setRepositories,
6771
setRepository,
6872
setCredential,

src/store/chatdoc/state.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export default (): IChatdocState => {
55
return {
66
service: undefined,
77
application: undefined,
8+
applications: undefined,
89
repositories: undefined,
910
credential: undefined,
1011
status: {

src/store/luma/actions.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const getApplications = async ({
3333
state,
3434
rootState
3535
}: ActionContext<ILumaState, IRootState>): Promise<IApplication[]> => {
36-
console.debug('start to get applications for qrart');
36+
console.debug('start to get applications for luma');
3737
return new Promise((resolve, reject) => {
3838
state.status.getApplications = Status.Request;
3939
applicationOperator
@@ -44,7 +44,6 @@ export const getApplications = async ({
4444
.then((response) => {
4545
console.debug('get applications success', response?.data);
4646
state.status.getApplications = Status.Success;
47-
commit('setApplication', response.data.items);
4847
// check if there is any application with 'Period' type
4948
const application = response.data.items?.find((application) => application?.type === IApplicationType.PERIOD);
5049
const application2 = response.data.items?.find((application) => application?.type === IApplicationType.USAGE);
@@ -64,12 +63,14 @@ export const getApplications = async ({
6463
);
6564
console.debug('set credential with Usage', application);
6665
commit('setCredential', credential);
66+
} else {
67+
console.debug('set application with null', response.data.items?.[0]);
68+
commit('setApplication', response.data.items?.[0]);
6769
}
6870
resolve(response.data.items);
69-
console.debug('save applications success', response.data.items);
71+
console.debug('save application success', response.data.items[0]);
7072
})
7173
.catch((error) => {
72-
console.error('get applications error', error);
7374
state.status.getApplications = Status.Error;
7475
reject(error);
7576
});

src/store/luma/models.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ILumaConfig, ILumaTask } from '@/models';
33

44
export interface ILumaState {
55
application: IApplication | undefined;
6+
applications: IApplication[] | undefined;
67
service: IService | undefined;
78
credential: ICredential | undefined;
89
config: ILumaConfig | undefined;

src/store/luma/mutations.ts

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ export const setApplication = (state: ILumaState, payload: IApplication): void =
2121
state.application = payload;
2222
};
2323

24+
export const setApplications = (state: ILumaState, payload: IApplication[]): void => {
25+
state.applications = payload;
26+
};
27+
2428
export const setConfig = (state: ILumaState, payload: ILumaConfig): void => {
2529
state.config = payload;
2630
};
@@ -56,6 +60,7 @@ export const setTasks = (state: ILumaState, payload: any): void => {
5660
export default {
5761
setTasks,
5862
setApplication,
63+
setApplications,
5964
setConfig,
6065
setCredential,
6166
setService,

src/store/luma/state.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export default (): ILumaState => {
55
return {
66
service: undefined,
77
application: undefined,
8+
applications: undefined,
89
tasks: undefined,
910
credential: undefined,
1011
config: undefined,

src/store/midjourney/actions.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ export const getApplications = async ({
5656
.then((response) => {
5757
console.debug('get applications success', response?.data);
5858
state.status.getApplications = Status.Success;
59-
commit('setApplications', response.data.items);
6059
// check if there is any application with 'Period' type
6160
const application = response.data.items?.find((application) => application?.type === IApplicationType.PERIOD);
6261
const application2 = response.data.items?.find((application) => application?.type === IApplicationType.USAGE);
@@ -76,6 +75,9 @@ export const getApplications = async ({
7675
);
7776
console.debug('set credential with Usage', application);
7877
commit('setCredential', credential);
78+
} else {
79+
console.debug('set application with null', response.data.items?.[0]);
80+
commit('setApplication', response.data.items?.[0]);
7981
}
8082
resolve(response.data.items);
8183
console.debug('save application success', response.data.items[0]);

src/store/midjourney/mutations.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ export const resetAll = (state: IMidjourneyState): void => {
1111
};
1212
};
1313

14-
export const setApplications = (state: IMidjourneyState, payload: IApplication[]): void => {
15-
state.applications = payload;
16-
};
17-
1814
export const setService = (state: IMidjourneyState, payload: IService): void => {
1915
state.service = payload;
2016
};
@@ -27,6 +23,10 @@ export const setApplication = (state: IMidjourneyState, payload: IApplication):
2723
state.application = payload;
2824
};
2925

26+
export const setApplications = (state: IMidjourneyState, payload: IApplication[]): void => {
27+
state.applications = payload;
28+
};
29+
3030
export const setPreset = (state: IMidjourneyState, payload: IMidjourneyPreset): void => {
3131
state.preset = payload;
3232
};

src/store/qrart/actions.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export const getApplications = async ({
4444
.then((response) => {
4545
console.debug('get applications success', response?.data);
4646
state.status.getApplications = Status.Success;
47-
commit('setApplications', response.data.items);
4847
// check if there is any application with 'Period' type
4948
const application = response.data.items?.find((application) => application?.type === IApplicationType.PERIOD);
5049
const application2 = response.data.items?.find((application) => application?.type === IApplicationType.USAGE);
@@ -64,12 +63,14 @@ export const getApplications = async ({
6463
);
6564
console.debug('set credential with Usage', application);
6665
commit('setCredential', credential);
66+
} else {
67+
console.debug('set application with null', response.data.items?.[0]);
68+
commit('setApplication', response.data.items?.[0]);
6769
}
6870
resolve(response.data.items);
69-
console.debug('save applications success', response.data.items);
71+
console.debug('save application success', response.data.items[0]);
7072
})
7173
.catch((error) => {
72-
console.error('get applications error', error);
7374
state.status.getApplications = Status.Error;
7475
reject(error);
7576
});

src/store/qrart/mutations.ts

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { IQrartState } from './models';
44
export const resetAll = (state: IQrartState): void => {
55
state.service = undefined;
66
state.application = undefined;
7-
state.applications = undefined;
87
state.config = undefined;
98
state.credential = undefined;
109
state.tasks = undefined;

src/store/suno/actions.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export const getApplications = async ({
4242
service_id: SUNO_SERVICE_ID
4343
})
4444
.then((response) => {
45+
console.debug('get applications success', response?.data);
4546
state.status.getApplications = Status.Success;
46-
commit('setApplications', response.data.items);
4747
// check if there is any application with 'Period' type
4848
const application = response.data.items?.find((application) => application?.type === IApplicationType.PERIOD);
4949
const application2 = response.data.items?.find((application) => application?.type === IApplicationType.USAGE);
@@ -63,9 +63,12 @@ export const getApplications = async ({
6363
);
6464
console.debug('set credential with Usage', application);
6565
commit('setCredential', credential);
66+
} else {
67+
console.debug('set application with null', response.data.items?.[0]);
68+
commit('setApplication', response.data.items?.[0]);
6669
}
6770
resolve(response.data.items);
68-
console.debug('save applications success', response.data.items);
71+
console.debug('save application success', response.data.items[0]);
6972
})
7073
.catch((error) => {
7174
state.status.getApplications = Status.Error;

0 commit comments

Comments
 (0)