feat: 增加账单

This commit is contained in:
archer
2023-03-21 14:01:35 +08:00
parent dc467c26b5
commit 42c26bd155
15 changed files with 211 additions and 64 deletions

View File

@@ -19,6 +19,7 @@ export const useChatStore = create<Props>()(
chatHistory: [],
pushChatHistory(item: HistoryItem) {
set((state) => {
if (state.chatHistory.find((history) => history.chatId === item.chatId)) return;
state.chatHistory = [item, ...state.chatHistory].slice(0, 20);
});
},

View File

@@ -5,6 +5,7 @@ import type { UserType, UserUpdateParams } from '@/types/user';
import type { ModelSchema } from '@/types/mongoSchema';
import { setToken } from '@/utils/user';
import { getMyModels } from '@/api/model';
import { formatPrice } from '@/utils/user';
type State = {
userInfo: UserType | null;
@@ -21,7 +22,10 @@ export const useUserStore = create<State>()(
userInfo: null,
setUserInfo(user: UserType, token?: string) {
set((state) => {
state.userInfo = user;
state.userInfo = {
...user,
balance: formatPrice(user.balance)
};
});
token && setToken(token);
},