Skip to content

Commit 917a191

Browse files
committed
Add sidebar container
1 parent f92dab1 commit 917a191

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

dist/js/chat.v1.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ const set_conversation = async (conversation_id) => {
13691369
};
13701370

13711371
const new_conversation = async (private = false) => {
1372-
if (window.location.search) {
1372+
if (window.location.hash) {
13731373
history.pushState({}, null, `/chat/`);
13741374
}
13751375
window.conversation_id = private ? null : generateUUID();
@@ -2241,22 +2241,24 @@ async function on_load() {
22412241
await load_conversations();
22422242
return;
22432243
}
2244-
const conversation_id = window.location.search.replace("?", "");
2244+
const conversation_id = window.location.hash.replace("#", "");
22452245
if (conversation_id) {
22462246
window.conversation_id = conversation_id;
22472247
} else {
22482248
window.conversation_id = generateUUID();
22492249
}
22502250
chatPrompt.value = document.getElementById("systemPrompt")?.value || "";
22512251
chatPrompt.value = document.getElementById("systemPrompt")?.value || "";
2252-
let chat_params = new URLSearchParams(window.location.search);
2252+
let chat_params = new URLSearchParams(window.location.query);
22532253
if (chat_params.get("prompt")) {
22542254
userInput.value = chat_params.get("prompt");
22552255
userInput.style.height = "100%";
22562256
userInput.focus();
22572257
await load_conversations();
22582258
} else if (!conversation_id) {
22592259
await new_conversation();
2260+
} else {
2261+
await load_conversations();
22602262
}
22612263
if (window.hljs) {
22622264
hljs.addPlugin(new HtmlRenderPlugin())

qrcode.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ <h2>QR Code</h2>
3232

3333
<script type="module">
3434
const backend_url = localStorage.getItem('backend_url');
35-
const conversation_id = window.location.search.replace("?", "");
35+
const conversation_id = window.location.hash.replace("#", "");
3636
if (!conversation_id) {
3737
document.getElementById('generateQRCode')
3838
.setAttribute('disabled', 'disabled');
@@ -84,7 +84,7 @@ <h2>QR Code</h2>
8484
headers: {'content-type': 'application/json'},
8585
body: JSON.stringify(conversation)
8686
});
87-
const share = `${window.location.origin}/chat/?${encodeURI(conversation.id)}`;
87+
const share = `${window.location.origin}/chat/#${encodeURI(conversation.id)}`;
8888
const qrcodeStatus = document.getElementById('qrcode-status');
8989
if (response.status !== 200) {
9090
qrcodeStatus.innerText = 'Error generating QR code: ' + response.statusText;

0 commit comments

Comments
 (0)