Update onboarding and error handling experience (#29)

This commit is contained in:
AceDataCloud committed 2024-01-03 16:40:24 +08:00
1 parent 916df4b482
commit 9c54ffb7a8
23 files changed
+228 -43

No files matched your search

+5
View File
@@ -17,6 +17,10 @@ import { ActionContext } from 'vuex';
import { log } from '@/utils/log';
import { IChatState } from './models';
export const resetAll = ({ commit }: ActionContext<IChatState, IRootState>): void => {
commit('resetAll');
};
export const setModel = async ({ commit }: any, payload: IChatModel): Promise<void> => {
commit('setModel', payload);
};
@@ -96,6 +100,7 @@ export const getConversations = async ({
};
export default {
resetAll,
setModel,
setApplications,
setConversation,
+9 -1
View File
@@ -2,6 +2,13 @@ import { IApplication, IChatConversation, IChatModel } from '@/operators';
import { IChatState } from './models';
import { Status } from '../common/models';
export const resetAll = (state: IChatState): void => {
state.applications = [];
state.getApplicationsStatus = Status.None;
state.conversations = [];
state.getConversationsStatus = Status.None;
};
export const setModel = (state: IChatState, payload: IChatModel): void => {
state.model = payload;
};
@@ -27,5 +34,6 @@ export default {
setApplications,
setGetApplicationsStatus,
setConversations,
setGetConversationsStatus
setGetConversationsStatus,
resetAll
};
+17 -1
View File
@@ -1,9 +1,22 @@
import { ActionContext } from 'vuex';
import { IRootState, IToken } from '../common/models';
import { IApplication, IUser, userOperator } from '@/operators';
import { IUser, userOperator } from '@/operators';
import { log } from '@/utils/log';
import { oauthOperator } from '@/operators/auth/operator';
export const resetAll = ({ commit }: ActionContext<IRootState, IRootState>) => {
commit('resetToken');
commit('resetUser');
};
export const resetUser = ({ commit }: ActionContext<IRootState, IRootState>) => {
commit('resetUser');
};
export const resetSetting = ({ commit }: ActionContext<IRootState, IRootState>) => {
commit('resetSetting');
};
export const resetToken = ({ commit }: ActionContext<IRootState, IRootState>) => {
commit('resetToken');
};
@@ -41,6 +54,9 @@ export const getToken = async ({ commit }: ActionContext<IRootState, IRootState>
export default {
resetToken,
resetAll,
resetUser,
resetSetting,
setToken,
setUser,
getToken,
+2 -1
View File
@@ -5,7 +5,8 @@ import { IChatState } from '../chat/models';
export enum Status {
Request = 'Request',
Success = 'Success',
Error = 'Error'
Error = 'Error',
None = 'None'
}
export interface IToken {
+11 -1
View File
@@ -19,6 +19,14 @@ export const resetToken = (state: IRootState): void => {
state.token = {};
};
export const resetSetting = (state: IRootState): void => {
state.setting = {};
};
export const resetUser = (state: IRootState): void => {
state.user = {};
};
export const setSetting = (state: IRootState, payload: any): void => {
state.setting = {
...state.setting,
@@ -28,7 +36,9 @@ export const setSetting = (state: IRootState, payload: any): void => {
export default {
setUser,
resetUser,
setToken,
resetToken,
setSetting
setSetting,
resetSetting
};
+5
View File
@@ -15,6 +15,10 @@ import { ActionContext } from 'vuex';
import { log } from '@/utils/log';
import { IRootState, Status } from '../common/models';
export const resetAll = ({ commit }: ActionContext<IMidjourneyState, IRootState>): void => {
commit('resetAll');
};
export const setPreset = ({ commit }: any, payload: IMidjourneyPreset) => {
commit('setPreset', payload);
};
@@ -79,6 +83,7 @@ export const getImagineTasks = async (
};
export default {
resetAll,
setPreset,
setChannel,
setApplications,
+9 -1
View File
@@ -2,6 +2,13 @@ import { IApplication, IMidjourneyChannel, IMidjourneyPreset } from '@/operators
import { IMidjourneyState } from './models';
import { Status } from '../common/models';
export const resetAll = (state: IMidjourneyState): void => {
state.applications = [];
state.preset = {};
state.getApplicationsStatus = Status.None;
state.imagineTasks = [];
};
export const setApplications = (state: IMidjourneyState, payload: IApplication[]): void => {
state.applications = payload;
};
@@ -37,5 +44,6 @@ export default {
setGetApplicationsStatus,
setImagineTasks,
setGetImagineTasksStatus,
setImagineTasksTotal
setImagineTasksTotal,
resetAll
};