mirror of
https://github.com/open-webui/open-webui
synced 2025-04-21 23:07:40 +00:00
refac
This commit is contained in:
parent
a084938d9c
commit
49677e9c9d
@ -45,7 +45,7 @@ router = APIRouter()
|
|||||||
async def get_session_user_chat_list(
|
async def get_session_user_chat_list(
|
||||||
user=Depends(get_verified_user), page: Optional[int] = None
|
user=Depends(get_verified_user), page: Optional[int] = None
|
||||||
):
|
):
|
||||||
if page:
|
if page is not None:
|
||||||
limit = 20
|
limit = 20
|
||||||
skip = (page - 1) * limit
|
skip = (page - 1) * limit
|
||||||
|
|
||||||
|
@ -423,7 +423,7 @@
|
|||||||
files: chatFiles
|
files: chatFiles
|
||||||
});
|
});
|
||||||
|
|
||||||
currentChatPage.set(0);
|
currentChatPage.set(1);
|
||||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -471,7 +471,7 @@
|
|||||||
files: chatFiles
|
files: chatFiles
|
||||||
});
|
});
|
||||||
|
|
||||||
currentChatPage.set(0);
|
currentChatPage.set(1);
|
||||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -633,7 +633,7 @@
|
|||||||
timestamp: Date.now()
|
timestamp: Date.now()
|
||||||
});
|
});
|
||||||
|
|
||||||
currentChatPage.set(0);
|
currentChatPage.set(1);
|
||||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||||
await chatId.set(chat.id);
|
await chatId.set(chat.id);
|
||||||
} else {
|
} else {
|
||||||
@ -710,7 +710,7 @@
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
currentChatPage.set(0);
|
currentChatPage.set(1);
|
||||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||||
|
|
||||||
return _responses;
|
return _responses;
|
||||||
@ -959,7 +959,7 @@
|
|||||||
files: chatFiles
|
files: chatFiles
|
||||||
});
|
});
|
||||||
|
|
||||||
currentChatPage.set(0);
|
currentChatPage.set(1);
|
||||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1228,7 +1228,7 @@
|
|||||||
files: chatFiles
|
files: chatFiles
|
||||||
});
|
});
|
||||||
|
|
||||||
currentChatPage.set(0);
|
currentChatPage.set(1);
|
||||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1395,7 +1395,7 @@
|
|||||||
if ($settings.saveChatHistory ?? true) {
|
if ($settings.saveChatHistory ?? true) {
|
||||||
chat = await updateChatById(localStorage.token, _chatId, { title: _title });
|
chat = await updateChatById(localStorage.token, _chatId, { title: _title });
|
||||||
|
|
||||||
currentChatPage.set(0);
|
currentChatPage.set(1);
|
||||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -90,7 +90,7 @@
|
|||||||
history: history
|
history: history
|
||||||
});
|
});
|
||||||
|
|
||||||
currentChatPage.set(0);
|
currentChatPage.set(1);
|
||||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
} else {
|
} else {
|
||||||
// if the tag we deleted is no longer a valid tag, return to main chat list view
|
// if the tag we deleted is no longer a valid tag, return to main chat list view
|
||||||
enablePagination();
|
enablePagination();
|
||||||
currentChatPage.set(0);
|
currentChatPage.set(1);
|
||||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||||
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
allChatsLoaded = false;
|
allChatsLoaded = false;
|
||||||
currentChatPage.set(0);
|
currentChatPage.set(1);
|
||||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||||
|
|
||||||
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
||||||
@ -453,6 +453,7 @@
|
|||||||
on:click={async () => {
|
on:click={async () => {
|
||||||
enablePagination();
|
enablePagination();
|
||||||
allChatsLoaded = false;
|
allChatsLoaded = false;
|
||||||
|
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{$i18n.t('all')}
|
{$i18n.t('all')}
|
||||||
@ -469,6 +470,7 @@
|
|||||||
// if the tag we deleted is no longer a valid tag, return to main chat list view
|
// if the tag we deleted is no longer a valid tag, return to main chat list view
|
||||||
enablePagination();
|
enablePagination();
|
||||||
allChatsLoaded = false;
|
allChatsLoaded = false;
|
||||||
|
chatIds = await getChatList(localStorage.token, $currentChatPage);
|
||||||
}
|
}
|
||||||
await chats.set(chatIds);
|
await chats.set(chatIds);
|
||||||
}}
|
}}
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
title: _title
|
title: _title
|
||||||
});
|
});
|
||||||
|
|
||||||
currentChatPage.set(0);
|
currentChatPage.set(1);
|
||||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||||
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@
|
|||||||
if (res) {
|
if (res) {
|
||||||
goto(`/c/${res.id}`);
|
goto(`/c/${res.id}`);
|
||||||
|
|
||||||
currentChatPage.set(0);
|
currentChatPage.set(1);
|
||||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||||
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@
|
|||||||
const archiveChatHandler = async (id) => {
|
const archiveChatHandler = async (id) => {
|
||||||
await archiveChatById(localStorage.token, id);
|
await archiveChatById(localStorage.token, id);
|
||||||
|
|
||||||
currentChatPage.set(0);
|
currentChatPage.set(1);
|
||||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||||
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
||||||
};
|
};
|
||||||
|
@ -784,7 +784,7 @@ export const bestMatchingLanguage = (supportedLanguages, preferredLanguages, def
|
|||||||
export const enablePagination = () => {
|
export const enablePagination = () => {
|
||||||
// Enable infinite scroll pagination
|
// Enable infinite scroll pagination
|
||||||
chats.set([]);
|
chats.set([]);
|
||||||
currentChatPage.set(0);
|
currentChatPage.set(1);
|
||||||
scrollPaginationEnabled.set(true);
|
scrollPaginationEnabled.set(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user