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
49677e9c
"examples/vscode:/vscode.git/clone" did not exist on "ba74a8be7a620da0558f27802a19736627e9e64a"
Commit
49677e9c
authored
Aug 04, 2024
by
Timothy J. Baek
Browse files
refac
parent
a084938d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
15 deletions
+17
-15
backend/apps/webui/routers/chats.py
backend/apps/webui/routers/chats.py
+1
-1
src/lib/components/chat/Chat.svelte
src/lib/components/chat/Chat.svelte
+7
-7
src/lib/components/chat/Messages.svelte
src/lib/components/chat/Messages.svelte
+1
-1
src/lib/components/chat/Tags.svelte
src/lib/components/chat/Tags.svelte
+1
-1
src/lib/components/layout/Sidebar.svelte
src/lib/components/layout/Sidebar.svelte
+3
-1
src/lib/components/layout/Sidebar/ChatItem.svelte
src/lib/components/layout/Sidebar/ChatItem.svelte
+3
-3
src/lib/utils/index.ts
src/lib/utils/index.ts
+1
-1
No files found.
backend/apps/webui/routers/chats.py
View file @
49677e9c
...
@@ -45,7 +45,7 @@ router = APIRouter()
...
@@ -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
...
...
src/lib/components/chat/Chat.svelte
View file @
49677e9c
...
@@ -423,7 +423,7 @@
...
@@ -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 @@
...
@@ -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 @@
...
@@ -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 @@
...
@@ -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 @@
...
@@ -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 @@
...
@@ -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 @@
...
@@ -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));
}
}
};
};
...
...
src/lib/components/chat/Messages.svelte
View file @
49677e9c
...
@@ -90,7 +90,7 @@
...
@@ -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));
};
};
...
...
src/lib/components/chat/Tags.svelte
View file @
49677e9c
...
@@ -61,7 +61,7 @@
...
@@ -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'));
}
}
...
...
src/lib/components/layout/Sidebar.svelte
View file @
49677e9c
...
@@ -209,7 +209,7 @@
...
@@ -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 @@
...
@@ -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 @@
...
@@ -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);
}}
}}
...
...
src/lib/components/layout/Sidebar/ChatItem.svelte
View file @
49677e9c
...
@@ -41,7 +41,7 @@
...
@@ -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 @@
...
@@ -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 @@
...
@@ -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'));
};
};
...
...
src/lib/utils/index.ts
View file @
49677e9c
...
@@ -784,7 +784,7 @@ export const bestMatchingLanguage = (supportedLanguages, preferredLanguages, def
...
@@ -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
);
};
};
...
...
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