feat: 增加账单
This commit is contained in:
@@ -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);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user