refac
This commit is contained in:
1 parent
ec36972c2b
commit
083e351441
10 files changed
+384
-74
No files matched your search
@@ -168,7 +168,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if resolvable && pendingToolTokens.length === 1}
|
||||
{#if resolvable && pendingToolTokens.length === 1 && pendingToolTokens[0]?.attributes?.name !== 'ask_user'}
|
||||
{@const pendingCallId = pendingToolTokens[0]?.attributes?.id ?? ''}
|
||||
<span class="flex gap-1 shrink-0">
|
||||
<button
|
||||
@@ -210,24 +210,26 @@
|
||||
<span class="text-xs text-gray-500 dark:text-gray-400 flex-1 min-w-0 line-clamp-1">
|
||||
{token?.attributes?.name ?? $i18n.t('tool')}
|
||||
</span>
|
||||
<span class="flex gap-1 shrink-0">
|
||||
<button
|
||||
type="button"
|
||||
class="text-[0.6875rem] px-2.5 py-0.5 rounded-md text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-white/8 hover:bg-gray-200 dark:hover:bg-white/12 transition-colors duration-100 disabled:opacity-50"
|
||||
disabled={!pendingCallId || resolvingCallId === pendingCallId}
|
||||
on:click={() => onResolve(pendingCallId, true)}
|
||||
>
|
||||
{$i18n.t('Allow')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="text-[0.6875rem] px-2 py-0.5 rounded-md text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors duration-100 disabled:opacity-50"
|
||||
disabled={!pendingCallId || resolvingCallId === pendingCallId}
|
||||
on:click={() => onResolve(pendingCallId, false)}
|
||||
>
|
||||
{$i18n.t('Deny')}
|
||||
</button>
|
||||
</span>
|
||||
{#if token?.attributes?.name !== 'ask_user'}
|
||||
<span class="flex gap-1 shrink-0">
|
||||
<button
|
||||
type="button"
|
||||
class="text-[0.6875rem] px-2.5 py-0.5 rounded-md text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-white/8 hover:bg-gray-200 dark:hover:bg-white/12 transition-colors duration-100 disabled:opacity-50"
|
||||
disabled={!pendingCallId || resolvingCallId === pendingCallId}
|
||||
on:click={() => onResolve(pendingCallId, true)}
|
||||
>
|
||||
{$i18n.t('Allow')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="text-[0.6875rem] px-2 py-0.5 rounded-md text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors duration-100 disabled:opacity-50"
|
||||
disabled={!pendingCallId || resolvingCallId === pendingCallId}
|
||||
on:click={() => onResolve(pendingCallId, false)}
|
||||
>
|
||||
{$i18n.t('Deny')}
|
||||
</button>
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
@@ -145,7 +145,8 @@ function buildToolCallToken(item: OutputItem, toolOutputByCallId: Record<string,
|
||||
}
|
||||
|
||||
return {
|
||||
summary: status === 'pending' ? 'Tool Approval Needed' : isDone ? 'Tool Executed' : 'Executing...',
|
||||
summary:
|
||||
status === 'pending' ? 'Tool Approval Needed' : isDone ? 'Tool Executed' : 'Executing...',
|
||||
text: getToolResultText(resultItem),
|
||||
attributes: {
|
||||
type: 'tool_calls',
|
||||
@@ -299,6 +300,14 @@ export function buildOutputDisplayItems(output: OutputItem[] = []): OutputDispla
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
item?.type === 'function_call' &&
|
||||
item.name === 'ask_user' &&
|
||||
(item.status === 'pending' || item.status === 'in_progress')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (item?.type && GROUPABLE_OUTPUT_TYPES.has(item.type)) {
|
||||
const token = buildDetailToken(item, index === output.length - 1, toolOutputByCallId);
|
||||
if (token) {
|
||||
|
||||
Reference in new issue
Block a user