refac
This commit is contained in:
1 parent
94b66b1797
commit
3c5e7968f0
1 file changed
+8
-4
@@ -340,9 +340,7 @@
|
|||||||
|
|
||||||
const generateTitleHandler = async () => {
|
const generateTitleHandler = async () => {
|
||||||
generating = true;
|
generating = true;
|
||||||
if (!chat) {
|
chat = await getChatById(localStorage.token, id);
|
||||||
chat = await getChatById(localStorage.token, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
const chatContent = chat.chat;
|
const chatContent = chat.chat;
|
||||||
|
|
||||||
@@ -367,7 +365,13 @@
|
|||||||
// active branch. This avoids using the stale top-level `models`
|
// active branch. This avoids using the stale top-level `models`
|
||||||
// array which may reference a model from an older edit.
|
// array which may reference a model from an older edit.
|
||||||
let model = '';
|
let model = '';
|
||||||
if (history?.messages && history?.currentId) {
|
|
||||||
|
// For the active chat, prefer the live dropdown selection.
|
||||||
|
if (id === $chatId) {
|
||||||
|
try { model = JSON.parse(sessionStorage.selectedModels || '[]').find((m) => m) ?? ''; } catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!model && history?.messages && history?.currentId) {
|
||||||
let currentId = history.currentId;
|
let currentId = history.currentId;
|
||||||
while (currentId) {
|
while (currentId) {
|
||||||
const msg = history.messages[currentId];
|
const msg = history.messages[currentId];
|
||||||
|
|||||||
Reference in new issue
Block a user