-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
264 additions
and
178 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { IApplication } from '@/operators'; | ||
|
||
export const setApplications = async ({ commit }: any, payload: IApplication[]) => { | ||
commit('setApplications', payload); | ||
}; | ||
|
||
export default { | ||
setApplications | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Module } from 'vuex'; | ||
import { IChatState } from './models'; | ||
import state from './state'; | ||
import actions from './actions'; | ||
import mutations from './mutations'; | ||
|
||
export const chat: Module<IChatState, any> = { | ||
namespaced: true, | ||
state, | ||
mutations, | ||
actions | ||
}; | ||
|
||
export default chat; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { IApplication } from '@/operators'; | ||
import { Status } from '../common/models'; | ||
|
||
export interface IChatState { | ||
applications: IApplication[] | undefined; | ||
applicationsStatus: Status | undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { IApplication } from '@/operators'; | ||
import { IChatState } from './models'; | ||
import { Status } from '../common/models'; | ||
|
||
export const setApplications = (state: IChatState, payload: IApplication[]): void => { | ||
state.applications = payload; | ||
}; | ||
|
||
export const setApplicationsStatus = (state: IChatState, payload: Status): void => { | ||
state.applicationsStatus = payload; | ||
}; | ||
|
||
export default { | ||
setApplications, | ||
setApplicationsStatus | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { IChatState } from './models'; | ||
|
||
export default (): IChatState => { | ||
return { | ||
applications: undefined, | ||
applicationsStatus: undefined | ||
}; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { ActionContext } from 'vuex'; | ||
import { IRootState, IToken } from '../common/models'; | ||
import { IApplication, IUser } from '@/operators'; | ||
|
||
export const resetToken = ({ commit }: ActionContext<IRootState, IRootState>) => { | ||
commit('resetToken'); | ||
}; | ||
|
||
export const setToken = ({ commit }: ActionContext<IRootState, IRootState>, payload: IToken) => { | ||
commit('setToken', payload); | ||
}; | ||
|
||
export const setUser = ({ commit }: ActionContext<IRootState, IRootState>, payload: IUser) => { | ||
commit('setUser', payload); | ||
}; | ||
|
||
export const setApplications = ({ commit }: ActionContext<IRootState, IRootState>, payload: IApplication[]) => { | ||
commit('setApplications', payload); | ||
}; | ||
|
||
export default { | ||
resetToken, | ||
setToken, | ||
setUser, | ||
setApplications | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { IRootState } from './models'; | ||
|
||
export const authenticated = (state: IRootState): boolean => { | ||
return !!state.token.access; | ||
}; | ||
|
||
export const user = (state: IRootState): any => { | ||
return state.user; | ||
}; | ||
|
||
export const token = (state: IRootState): any => { | ||
return state.token; | ||
}; | ||
|
||
export const setting = (state: IRootState): any => { | ||
return state.setting; | ||
}; | ||
|
||
export const applications = (state: IRootState): any => { | ||
return state.applications; | ||
}; | ||
|
||
export default { | ||
authenticated, | ||
user, | ||
token, | ||
setting, | ||
applications | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import state from './state'; | ||
import mutations from './mutations'; | ||
import actions from './actions'; | ||
import getters from './getters'; | ||
|
||
export default { | ||
state, | ||
mutations, | ||
actions, | ||
getters | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { IApplication, IUser } from '@/operators'; | ||
import { IMidjourneyState } from '../midjourney/models'; | ||
import { IChatState } from '../chat/models'; | ||
|
||
export enum Status { | ||
Request = 'Request', | ||
Success = 'Success', | ||
Error = 'Error' | ||
} | ||
|
||
export interface IToken { | ||
access?: string; | ||
refresh?: string; | ||
} | ||
|
||
export interface ISetting { | ||
stream?: boolean; | ||
endpoint?: string; | ||
} | ||
|
||
export interface ICommonState { | ||
token: IToken; | ||
user: IUser; | ||
setting: ISetting; | ||
applications: IApplication[] | undefined; | ||
} | ||
|
||
export interface IRootState extends ICommonState { | ||
midjourney?: IMidjourneyState; | ||
chat?: IChatState; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { IUser } from '@/operators'; | ||
import { IRootState } from './models'; | ||
|
||
export const setUser = (state: IRootState, payload: IUser): void => { | ||
state.user = { | ||
...state.user, | ||
...payload | ||
}; | ||
}; | ||
|
||
export const setToken = (state: IRootState, payload: any): void => { | ||
state.token = { | ||
...state.token, | ||
...payload | ||
}; | ||
}; | ||
|
||
export const resetToken = (state: IRootState): void => { | ||
state.token = {}; | ||
}; | ||
|
||
export const setSetting = (state: IRootState, payload: any): void => { | ||
state.setting = { | ||
...state.setting, | ||
...payload | ||
}; | ||
}; | ||
|
||
export const setApplications = (state: IRootState, payload: any): void => { | ||
state.applications = payload; | ||
}; | ||
|
||
export default { | ||
setUser, | ||
setToken, | ||
resetToken, | ||
setSetting, | ||
setApplications | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { ENDPOINT } from '@/constants'; | ||
import { IRootState } from './models'; | ||
|
||
export default (): IRootState => { | ||
return { | ||
user: {}, | ||
token: { | ||
access: undefined, | ||
refresh: undefined | ||
}, | ||
setting: { | ||
endpoint: ENDPOINT, | ||
stream: false | ||
}, | ||
applications: undefined | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { IApplication, IMidjourneyPreset } from '@/operators'; | ||
|
||
export const setPreset = ({ commit }: any, payload: IMidjourneyPreset) => { | ||
commit('setPreset', payload); | ||
}; | ||
|
||
export const setApplications = ({ commit }: any, payload: IApplication[]) => { | ||
commit('setApplications', payload); | ||
}; | ||
|
||
export default { | ||
setPreset, | ||
setApplications | ||
}; |
Oops, something went wrong.