mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-05 02:41:34 +00:00
Merge e3b052ba4a into a29c969fc7
This commit is contained in:
commit
41555cfdc6
2 changed files with 11 additions and 3 deletions
|
|
@ -107,6 +107,8 @@ PROXY_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS']
|
|||
|
||||
|
||||
@router.api_route('/{server_id}/{path:path}', methods=PROXY_METHODS)
|
||||
# Must stay the lower decorator so it registers before the catch-all, which would swallow chat paths.
|
||||
@router.api_route('/{server_id}/chats/{chat_id}/{path:path}', methods=PROXY_METHODS)
|
||||
async def proxy_terminal(
|
||||
server_id: str,
|
||||
path: str,
|
||||
|
|
@ -151,7 +153,7 @@ async def proxy_terminal(
|
|||
|
||||
headers = {'X-User-Id': user.id}
|
||||
# Forward per-session cwd tracking header
|
||||
session_id = request.headers.get('x-session-id')
|
||||
session_id = request.path_params.get('chat_id') or request.headers.get('x-session-id')
|
||||
if session_id:
|
||||
headers['X-Session-Id'] = session_id
|
||||
if not terminal_context_available(connection, 'chat'):
|
||||
|
|
|
|||
|
|
@ -355,6 +355,11 @@
|
|||
let selectedTerminal: { url: string; key: string } | null = null;
|
||||
let terminalChatContextPending = false;
|
||||
let terminalChatContextHidden = false;
|
||||
let scopedChatId: string | null = null;
|
||||
$: portBaseUrl =
|
||||
selectedTerminal && scopedChatId
|
||||
? `${selectedTerminal.url}/chats/${encodeURIComponent(scopedChatId)}`
|
||||
: (selectedTerminal?.url ?? '');
|
||||
|
||||
const chatContext = (terminal: any) => terminal?.contexts?.chat ?? {};
|
||||
|
||||
|
|
@ -364,6 +369,7 @@
|
|||
: ($terminalServers?.[0] ?? null);
|
||||
const chatConfig = chatContext(systemTerminal);
|
||||
const chatScoped = !!systemTerminal && chatConfig?.context_id === 'chat_id';
|
||||
scopedChatId = chatScoped ? chatId : null;
|
||||
terminalChatContextHidden =
|
||||
!!systemTerminal && (chatConfig === false || (chatScoped && isTemporaryChatId(chatId)));
|
||||
terminalChatContextPending = chatScoped && !terminalChatContextHidden && !isSavedChatId(chatId);
|
||||
|
|
@ -1824,7 +1830,7 @@
|
|||
/>
|
||||
{:else if previewPort !== null}
|
||||
<PortPreview
|
||||
baseUrl={selectedTerminal?.url ?? ''}
|
||||
baseUrl={portBaseUrl}
|
||||
port={previewPort}
|
||||
overlay={overlay || isDraggingHandle}
|
||||
onClose={() => {
|
||||
|
|
@ -2099,7 +2105,7 @@
|
|||
{#if selectedTerminal && !selectedFile && previewPort === null && !isSearching}
|
||||
<div class="shrink-0 border-t border-gray-50 dark:border-gray-850/30">
|
||||
<PortList
|
||||
baseUrl={selectedTerminal.url}
|
||||
baseUrl={portBaseUrl}
|
||||
apiKey={selectedTerminal.key}
|
||||
on:previewPort={(e) => {
|
||||
selectedFile = null;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue