mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-04 05:56:08 +00:00
perf: user openai
This commit is contained in:
@@ -24,7 +24,7 @@ const defaultChatData: InitChatResponse = {
|
||||
chatId: '',
|
||||
appId: '',
|
||||
app: {
|
||||
name: '',
|
||||
name: 'FastAI',
|
||||
avatar: '/icon/logo.png',
|
||||
intro: '',
|
||||
canUse: false
|
||||
|
@@ -30,7 +30,7 @@ export const defaultHistory: ShareChatHistoryItemType = {
|
||||
const defaultShareChatData: ShareChatType = {
|
||||
userAvatar: HUMAN_ICON,
|
||||
app: {
|
||||
name: '',
|
||||
name: 'AI',
|
||||
avatar: '/icon/logo.png',
|
||||
intro: ''
|
||||
},
|
||||
|
@@ -53,6 +53,7 @@ export const useUserStore = create<State>()(
|
||||
});
|
||||
},
|
||||
async updateUserInfo(user: UserUpdateParams) {
|
||||
const oldInfo = (get().userInfo ? { ...get().userInfo } : null) as UserType | null;
|
||||
set((state) => {
|
||||
if (!state.userInfo) return;
|
||||
state.userInfo = {
|
||||
@@ -60,7 +61,14 @@ export const useUserStore = create<State>()(
|
||||
...user
|
||||
};
|
||||
});
|
||||
await putUserInfo(user);
|
||||
try {
|
||||
await putUserInfo(user);
|
||||
} catch (error) {
|
||||
set((state) => {
|
||||
state.userInfo = oldInfo;
|
||||
});
|
||||
return Promise.reject(error);
|
||||
}
|
||||
},
|
||||
myApps: [],
|
||||
myCollectionApps: [],
|
||||
|
Reference in New Issue
Block a user