mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-05 02:57:57 -05:00
refac
This commit is contained in:
1 parent
22500ecc24
commit
46ac49fe09
4 files changed
+11
-7
No files matched your search
@@ -21,7 +21,7 @@
|
||||
const [head, ...result] = report.split('--- RESULT ---');
|
||||
const field = (pattern: RegExp) => head.match(pattern)?.[1]?.trim() ?? '';
|
||||
return {
|
||||
task: field(/^Original task: (.*)$/m),
|
||||
title: field(/^Title: (.*)\nOriginal task: /m) || field(/^Original task: (.*)$/m),
|
||||
chatId: field(/^Subagent chat: (.*)$/m),
|
||||
status: field(/^Status: (\S+)/m),
|
||||
duration: field(/Duration: (\S+)/),
|
||||
@@ -44,7 +44,7 @@
|
||||
aria-expanded={!!expanded[index]}
|
||||
on:click={() => (expanded[index] = !expanded[index])}
|
||||
>
|
||||
<span dir="auto" class="min-w-0 truncate">{label(report.status)} · {report.task}</span>
|
||||
<span dir="auto" class="min-w-0 truncate">{label(report.status)} · {report.title}</span>
|
||||
<span class="shrink-0 text-xs tabular-nums">{report.duration}</span>
|
||||
<ChevronDown
|
||||
strokeWidth="3.5"
|
||||
@@ -70,7 +70,7 @@
|
||||
type="button"
|
||||
class="mt-1 text-xs text-base-400 transition hover:text-base-600 dark:text-base-600 dark:hover:text-base-400"
|
||||
on:click={() =>
|
||||
appLayout?.openPageTab?.({ href: `/c/${report.chatId}`, label: report.task })}
|
||||
appLayout?.openPageTab?.({ href: `/c/${report.chatId}`, label: report.title })}
|
||||
>
|
||||
{$i18n.t('Open thread')}
|
||||
</button>
|
||||
|
||||
@@ -238,9 +238,7 @@ export function buildToolCallToken(
|
||||
typeof item.arguments === 'string'
|
||||
? JSON.parse(item.arguments || '{}')
|
||||
: (item.arguments ?? {});
|
||||
const task = typeof args.task === 'string' && args.task ? args.task : '?';
|
||||
const label = args.background ? 'Background sub-agent' : 'Sub-agent';
|
||||
name = `${label}: "${task.length > 60 ? `${task.slice(0, 60)}...` : task}"`;
|
||||
name = String(args.title || args.task || 'Sub-agent').slice(0, 60);
|
||||
} catch {
|
||||
name = 'Sub-agent';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user