Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
d78df834
"...composable_kernel_onnxruntime.git" did not exist on "c7a6545ec471dd9e655275b8cfd9b73e7922f21b"
Commit
d78df834
authored
Dec 26, 2023
by
Timothy J. Baek
Browse files
feat: delete idb after migration
parent
e2a59648
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
19 deletions
+21
-19
backend/apps/web/models/chats.py
backend/apps/web/models/chats.py
+2
-2
src/lib/components/layout/Sidebar.svelte
src/lib/components/layout/Sidebar.svelte
+0
-9
src/routes/(app)/+layout.svelte
src/routes/(app)/+layout.svelte
+19
-8
No files found.
backend/apps/web/models/chats.py
View file @
d78df834
...
...
@@ -119,8 +119,8 @@ class ChatTable:
for
chat
in
Chat
.
select
()
.
where
(
Chat
.
user_id
==
user_id
)
.
order_by
(
Chat
.
timestamp
.
desc
())
.
limit
(
limit
)
.
offset
(
skip
)
#
.limit(limit)
#
.offset(skip)
]
def
get_chat_by_id_and_user_id
(
self
,
id
:
str
,
user_id
:
str
)
->
Optional
[
ChatModel
]:
...
...
src/lib/components/layout/Sidebar.svelte
View file @
d78df834
...
...
@@ -49,15 +49,6 @@
await deleteChatById(localStorage.token, id);
await chats.set(await getChatList(localStorage.token));
};
// const deleteChatHistory = async () => {
// await $db.deleteAllChat();
// const tx = this.db.transaction('chats', 'readwrite');
// await Promise.all([tx.store.clear(), tx.done]);
// await chats.set(await this.getChats());
// };
</script>
<div
...
...
src/routes/(app)/+layout.svelte
View file @
d78df834
<script lang="ts">
import toast from 'svelte-french-toast';
import { openDB } from 'idb';
import { openDB
, deleteDB
} from 'idb';
import { onMount, tick } from 'svelte';
import { goto } from '$app/navigation';
...
...
@@ -72,16 +72,26 @@
if ($user === undefined) {
await goto('/auth');
} else if (['user', 'admin'].includes($user.role)) {
DB = await openDB('Chats', 1);
try {
// Check if IndexedDB exists
DB = await openDB('Chats', 1);
if (DB) {
const chats = await DB.getAllFromIndex('chats', 'timestamp');
localDBChats = chats.map((item, idx) => chats[chats.length - 1 - idx]);
if (DB) {
const chats = await DB.getAllFromIndex('chats', 'timestamp');
localDBChats = chats.map((item, idx) => chats[chats.length - 1 - idx]);
console.log('localdb', localDBChats);
}
if (localDBChats.length === 0) {
await deleteDB('Chats');
}
console.log('localdb', localDBChats);
}
console.log(DB);
console.log(DB);
} catch (error) {
// IndexedDB Not Found
console.log('IDB Not Found');
}
console.log();
await settings.set(JSON.parse(localStorage.getItem('settings') ?? '{}'));
...
...
@@ -214,6 +224,7 @@
const tx = DB.transaction('chats', 'readwrite');
await Promise.all([tx.store.clear(), tx.done]);
await deleteDB('Chats');
localDBChats = [];
}}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment