mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-15 09:31:21 +00:00
refac
This commit is contained in:
parent
1e8a21117e
commit
9260e312fb
2 changed files with 17 additions and 1 deletions
|
|
@ -24,7 +24,10 @@ export const updateBrowserSession = (
|
|||
connection: TerminalConnection,
|
||||
chatId: string | null,
|
||||
id: string,
|
||||
fields: Partial<Pick<BrowserSession, 'url' | 'title' | 'mode'>>
|
||||
fields: Partial<Pick<BrowserSession, 'url' | 'title' | 'mode'>> & {
|
||||
active?: boolean;
|
||||
chat_id?: string;
|
||||
}
|
||||
) =>
|
||||
terminalRequest<BrowserSession>(
|
||||
connection,
|
||||
|
|
|
|||
|
|
@ -40,6 +40,19 @@
|
|||
let chromeForward = false;
|
||||
let frameReady = false;
|
||||
$: viewUrl = session && sessionConnection ? browserViewUrl(sessionConnection, session) : '';
|
||||
$: if (session && sessionConnection) {
|
||||
void updateBrowserSession(sessionConnection, sessionChatId, session.id, { active }).catch(
|
||||
() => {}
|
||||
);
|
||||
}
|
||||
$: if (session && sessionConnection && chatId && !sessionChatId) {
|
||||
const savedChatId = chatId;
|
||||
void updateBrowserSession(sessionConnection, sessionChatId, session.id, {
|
||||
chat_id: savedChatId
|
||||
})
|
||||
.then(() => (sessionChatId = savedChatId))
|
||||
.catch(() => {});
|
||||
}
|
||||
const persist = (url: string, title: string) => {
|
||||
if (session && sessionConnection)
|
||||
void updateBrowserSession(sessionConnection, sessionChatId, session.id, { url, title }).catch(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue