This commit is contained in:
Timothy Jaeryang Baek
2026-11-16 14:21:04 +09:00
Unverified
parent a6d77fbe6a
commit 6f04d48166
7 changed files with 27 additions and 17 deletions
+4 -4
View File
@@ -36,7 +36,7 @@ def answer_value(value):
return value
async def elicit(output, params, native):
async def elicit(output, params, request):
"""Present ACP's flat form schema through the existing ask-user card."""
if params.get('mode') != 'form':
return {'action': 'decline'}
@@ -65,7 +65,7 @@ async def elicit(output, params, native):
)
if not questions:
return {'action': 'decline'}
resolution = await output.approve('ask_user', {'questions': questions}, native)
resolution = await output.approve('ask_user', {'questions': questions}, request)
if resolution['action'] != 'answer' or resolution.get('timed_out'):
return {'action': 'decline'}
content = {}
@@ -141,7 +141,7 @@ async def run(transport, output, prompt, images, options, *, auth_method=None):
call_id,
tool.get('title') or tool.get('kind', 'agent_tool'),
tool.get('rawInput') or {},
native=tool.copy(),
provider_data=tool.copy(),
result=tool.get('rawOutput', tool.get('content', [])),
done=tool.get('status') in {'completed', 'failed'},
)
@@ -150,7 +150,7 @@ async def run(transport, output, prompt, images, options, *, auth_method=None):
'agent_plan',
'Plan',
{'entries': update.get('entries', [])},
native=update,
provider_data=update,
result=update.get('entries', []),
done=True,
)
@@ -113,7 +113,7 @@ async def run(transport, output, prompt, images, options):
elif block['type'] == 'thinking' and not streamed_thinking:
await output.text(block['thinking'], reasoning=True)
elif block['type'] == 'tool_use':
await output.tool(block['id'], block['name'], block['input'], native=block)
await output.tool(block['id'], block['name'], block['input'], provider_data=block)
elif kind == 'user':
blocks = message.get('message', {}).get('content', [])
for block in blocks if isinstance(blocks, list) else []:
@@ -123,7 +123,7 @@ async def run(transport, output, prompt, images, options):
block['tool_use_id'],
previous.get('name', 'agent_tool'),
json.loads(previous.get('arguments', '{}')),
native=block,
provider_data=block,
result=block.get('content'),
done=True,
)
+1 -1
View File
@@ -143,7 +143,7 @@ async def run(transport, output, prompt, images, options):
item.get('id', params.get('itemId')),
item.get('type', 'agent_tool'),
item,
native=item,
provider_data=item,
result=item.get('aggregatedOutput', item),
done=method == 'item/completed',
)
+8 -5
View File
@@ -17,7 +17,7 @@ from redis.asyncio import Redis
class Output:
"""Use WebUI's persisted output cards; provider runners retain native item data."""
"""Use WebUI's persisted output cards; each item keeps the provider's own event in provider_data."""
def __init__(self, metadata, user, check_connection, form_data):
self.metadata, self.user = metadata, user
@@ -109,13 +109,16 @@ class Output:
self.content += text
await self.flush()
async def tool(self, call_id, name, arguments, native=None, result=None, done=False):
async def tool(self, call_id, name, arguments, provider_data=None, result=None, done=False):
item = next((i for i in self.items if i.get('call_id') == call_id and i['type'] == 'function_call'), None)
if item is None:
item = {'type': 'function_call', 'id': call_id, 'call_id': call_id}
self.items.append(item)
item.update(
name=name, arguments=json.dumps(arguments), status='completed' if done else 'in_progress', native=native
name=name,
arguments=json.dumps(arguments),
status='completed' if done else 'in_progress',
provider_data=provider_data,
)
if done:
self.items[:] = [
@@ -134,7 +137,7 @@ class Output:
)
await self.flush(force=True)
async def approve(self, name, arguments, native, timeout=None):
async def approve(self, name, arguments, provider_data, timeout=None):
call_id = f'approval_{uuid4().hex}'
item = {
'type': 'function_call',
@@ -143,7 +146,7 @@ class Output:
'name': name,
'arguments': json.dumps(arguments),
'status': 'pending',
'native': native,
'provider_data': provider_data,
}
resolution = None
# Questions need an answer even when tool execution has Full access.
+1 -1
View File
@@ -94,7 +94,7 @@ async def run(transport, output, prompt, images, options):
call_id,
tool.get('toolName', 'agent_tool'),
tool.get('args', {}),
native=tool.copy(),
provider_data=tool.copy(),
result=tool.get('result', tool.get('partialResult')),
done=kind == 'tool_execution_end',
)
+3 -2
View File
@@ -102,7 +102,8 @@ async def resolve_tool_call_output(
function_call.setdefault('call_id', form_data.call_id)
tool_name = function_call.get('name')
if function_call.get('native') is not None:
# Terminal agent requests carry the provider's event; older saved messages call it 'native'.
if function_call.get('provider_data') is not None or function_call.get('native') is not None:
from open_webui.utils.auth import decode_token
token = (message.get('meta') or {}).get('agent')
@@ -122,7 +123,7 @@ async def resolve_tool_call_output(
raise HTTPException(400, 'Answers must be keyed by question')
function_call['agent_resolution'] = form_data.model_dump()
function_call['status'] = 'queued'
# The running native client consumes this persisted response. Do not start a model/tool loop.
# The running agent client consumes this persisted response. Do not start a model/tool loop.
return {'chat': chat, 'output': output, 'resume': None}
if (
+8 -2
View File
@@ -51,6 +51,7 @@
terminalServers,
functions,
selectedFolder as _selectedFolder,
folders as _folders,
showEmbeds as _showEmbeds,
selectedTerminalId as _selectedTerminalId,
showFileNavPath,
@@ -4226,14 +4227,19 @@
let titleInput: HTMLInputElement;
let generatingTitle = false;
let titleEditChatId = '';
$: if (loading || isShared || $temporaryChatEnabled || $chatId !== titleEditChatId)
// Folder owners can rename chats others made in their folders.
$: canRename =
!isShared ||
(!!chat?.folder_id &&
$_folders.find((folder) => folder.id === chat.folder_id)?.user_id === $user?.id);
$: if (loading || !canRename || $temporaryChatEnabled || $chatId !== titleEditChatId)
editingTitle = false;
$: tabTitleEditor = editingTitle ? renderTitleEditor : undefined;
export const startRename = async () => {
if (
loading ||
isShared ||
!canRename ||
!$chatId ||
$temporaryChatEnabled ||
isTemporaryChatId($chatId) ||