mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
tools dropdown in message row header
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -11,8 +11,8 @@
|
|||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||||
<meta name="apple-mobile-web-app-title" content="Roomba Rover" />
|
<meta name="apple-mobile-web-app-title" content="Roomba Rover" />
|
||||||
<title>Roomba Rover</title>
|
<title>Roomba Rover</title>
|
||||||
<script type="module" crossorigin src="/assets/index-CK-TYSk4.js"></script>
|
<script type="module" crossorigin src="/assets/index-B3XVdF7k.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-BtUMEmG6.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-DSJcZoco.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|||||||
@@ -119,11 +119,11 @@ export function ChatIdentity({ message }) {
|
|||||||
|
|
||||||
function chatRowClass(message) {
|
function chatRowClass(message) {
|
||||||
if (isBotMessage(message)) {
|
if (isBotMessage(message)) {
|
||||||
return 'surface-muted flex items-center gap-0.5 border border-emerald-500/40 bg-emerald-900/15 text-sm';
|
return 'surface-muted flex flex-col gap-0.5 border border-emerald-500/40 bg-emerald-900/15 text-sm';
|
||||||
}
|
}
|
||||||
const isAdmin =
|
const isAdmin =
|
||||||
message.role === 'admin' || message.role === 'lockdown' || message.role === 'lockdown-admin';
|
message.role === 'admin' || message.role === 'lockdown' || message.role === 'lockdown-admin';
|
||||||
return `surface-muted flex items-center gap-0.5 text-sm ${
|
return `surface-muted flex flex-col gap-0.5 text-sm ${
|
||||||
isAdmin
|
isAdmin
|
||||||
? 'border border-amber-400/30'
|
? 'border border-amber-400/30'
|
||||||
: message.fromDiscord
|
: message.fromDiscord
|
||||||
@@ -139,40 +139,40 @@ export default function ChatMessageRow({ message }) {
|
|||||||
const hasText = Boolean(String(message?.text || '').trim());
|
const hasText = Boolean(String(message?.text || '').trim());
|
||||||
return (
|
return (
|
||||||
<div className={chatRowClass(message)}>
|
<div className={chatRowClass(message)}>
|
||||||
<span
|
<div className="flex w-full items-center gap-0.5">
|
||||||
className={`min-w-0 flex-1 break-words leading-tight whitespace-pre-wrap ${isBot ? 'text-emerald-100' : 'text-slate-100'}`}
|
<span
|
||||||
>
|
className={`min-w-0 flex-1 break-words leading-tight whitespace-pre-wrap ${isBot ? 'text-emerald-100' : 'text-slate-100'}`}
|
||||||
<ChatIdentity message={message} />{hasText ? ` ${message.text}` : ''}
|
>
|
||||||
|
<ChatIdentity message={message} />{hasText ? ` ${message.text}` : ''}
|
||||||
|
</span>
|
||||||
{toolCalls.length > 0 ? (
|
{toolCalls.length > 0 ? (
|
||||||
<span className="mt-0.5 block">
|
<button
|
||||||
<button
|
type="button"
|
||||||
type="button"
|
className="shrink-0 rounded border border-slate-600/70 bg-slate-800/60 px-1 py-[1px] text-[0.65rem] text-slate-200 hover:bg-slate-700/70"
|
||||||
className="rounded border border-slate-600/70 bg-slate-800/60 px-1 py-[1px] text-[0.65rem] text-slate-200 hover:bg-slate-700/70"
|
onClick={() => setOpen((v) => !v)}
|
||||||
onClick={() => setOpen((v) => !v)}
|
>
|
||||||
>
|
{open ? '▼' : '▶'} Tools ({toolCalls.length})
|
||||||
{open ? '▼' : '▶'} Tools ({toolCalls.length})
|
</button>
|
||||||
</button>
|
|
||||||
{open ? (
|
|
||||||
<div className="mt-0.5 rounded border border-slate-700/70 bg-slate-900/70 p-0.5 text-[0.68rem] text-slate-200">
|
|
||||||
{toolCalls.map((entry, idx) => {
|
|
||||||
const status = String(entry?.status || 'unknown');
|
|
||||||
const statusLabel = status === 'ok' ? 'ok' : status === 'blocked' ? 'blocked' : status === 'error' ? 'error' : 'unknown';
|
|
||||||
const argsText = JSON.stringify(entry?.args && typeof entry.args === 'object' ? entry.args : {});
|
|
||||||
return (
|
|
||||||
<div key={`${entry?.tool || 'tool'}-${idx}`} className="mb-0.5 last:mb-0">
|
|
||||||
<div>{statusLabel} {entry?.tool || 'unknown'} args={argsText}</div>
|
|
||||||
{entry?.error ? <div className="text-rose-300">error: {String(entry.error)}</div> : null}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</span>
|
|
||||||
) : null}
|
) : null}
|
||||||
</span>
|
<span className="shrink-0 text-[0.65rem] text-slate-400/60">
|
||||||
<span className="ml-auto shrink-0 text-[0.65rem] text-slate-400/60">
|
{formatTime(message.ts)}
|
||||||
{formatTime(message.ts)}
|
</span>
|
||||||
</span>
|
</div>
|
||||||
|
{open && toolCalls.length > 0 ? (
|
||||||
|
<div className="w-full rounded border border-slate-700/70 bg-slate-900/70 p-0.5 text-[0.68rem] text-slate-200">
|
||||||
|
{toolCalls.map((entry, idx) => {
|
||||||
|
const status = String(entry?.status || 'unknown');
|
||||||
|
const statusLabel = status === 'ok' ? 'ok' : status === 'blocked' ? 'blocked' : status === 'error' ? 'error' : 'unknown';
|
||||||
|
const argsText = JSON.stringify(entry?.args && typeof entry.args === 'object' ? entry.args : {});
|
||||||
|
return (
|
||||||
|
<div key={`${entry?.tool || 'tool'}-${idx}`} className="mb-0.5 last:mb-0">
|
||||||
|
<div>{statusLabel} {entry?.tool || 'unknown'} args={argsText}</div>
|
||||||
|
{entry?.error ? <div className="text-rose-300">error: {String(entry.error)}</div> : null}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user