mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-18 22:14:27 +00:00
⛴️ fix: Align Canary Timing Types and CI Formatting
This commit is contained in:
parent
b881b83393
commit
5bd84bb627
14 changed files with 65 additions and 27 deletions
|
|
@ -86,7 +86,7 @@ const TwoFactorScreen: React.FC = React.memo(() => {
|
|||
return (
|
||||
<div className="mt-4">
|
||||
<form onSubmit={handleSubmit(onSubmit)}>
|
||||
<Label className="text-text-primary flex justify-center break-keep text-center text-sm">
|
||||
<Label className="text-text-primary flex justify-center text-center text-sm break-keep">
|
||||
{localize('com_auth_two_factor')}
|
||||
</Label>
|
||||
{!useBackup && (
|
||||
|
|
|
|||
|
|
@ -765,7 +765,7 @@ const ChatForm = memo(function ChatForm({
|
|||
data-testid="composer-context-rail"
|
||||
className={cn(
|
||||
'mx-4 -mb-3 flex min-w-0 flex-wrap items-center gap-1 rounded-t-2xl',
|
||||
'border-border-light bg-surface-secondary border px-2 pb-4 pt-1',
|
||||
'border-border-light bg-surface-secondary border px-2 pt-1 pb-4',
|
||||
isRTL && 'flex-row-reverse',
|
||||
)}
|
||||
>
|
||||
|
|
@ -819,7 +819,7 @@ const ChatForm = memo(function ChatForm({
|
|||
squared off at the bottom (`rounded-t-theme-surface-lg`) and no disclaimer
|
||||
follows it — so the action row is the last thing in it, with no
|
||||
band of padding under the buttons. */
|
||||
'relative flex w-full grow flex-col overflow-hidden rounded-t-theme-surface-lg sm:rounded-theme-surface-lg',
|
||||
'rounded-t-theme-surface-lg sm:rounded-theme-surface-lg relative flex w-full grow flex-col overflow-hidden',
|
||||
composerSurfaceClasses(),
|
||||
isTextAreaFocused ? composerSurfaceShadow.focused : composerSurfaceShadow.blurred,
|
||||
/* Temporary-chat accent is a ChatForm-only override, not part of
|
||||
|
|
@ -922,14 +922,14 @@ const ChatForm = memo(function ChatForm({
|
|||
active={dictation.active}
|
||||
className={cn(
|
||||
'pointer-events-none absolute inset-y-2',
|
||||
isMoreThanThreeRows ? 'left-5 right-2' : 'inset-x-5',
|
||||
isMoreThanThreeRows ? 'right-2 left-5' : 'inset-x-5',
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
{/* Sits over the fade scrim in the corner of the input
|
||||
rather than in its own column beside it, so a long draft
|
||||
does not push an orphaned control off to the side. */}
|
||||
<div className="absolute bottom-1 right-2 z-10">
|
||||
<div className="absolute right-2 bottom-1 z-10">
|
||||
<CollapseChat
|
||||
isCollapsed={isCollapsed}
|
||||
isScrollable={isMoreThanThreeRows}
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ const InterruptSteerButton = React.memo((props: InterruptSteerButtonProps) => {
|
|||
disabled={disabled}
|
||||
onClick={onClick}
|
||||
className={cn(
|
||||
'border-border-light flex size-theme-control items-center justify-center rounded-theme-control-round border',
|
||||
'text-text-secondary transition-colors duration-theme-normal',
|
||||
'border-border-light size-theme-control rounded-theme-control-round flex items-center justify-center border',
|
||||
'text-text-secondary duration-theme-normal transition-colors',
|
||||
'hover:bg-surface-composer-hover hover:text-text-primary',
|
||||
'focus-visible:ring-border-xheavy focus-visible:outline-hidden focus-visible:ring-2',
|
||||
'focus-visible:ring-border-xheavy focus-visible:ring-2 focus-visible:outline-hidden',
|
||||
'disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent',
|
||||
)}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -486,7 +486,7 @@ function FailedPeek({
|
|||
type="button"
|
||||
className={cn(
|
||||
TOOL_ROW_CLASSES,
|
||||
'text-text-secondary hover:text-text-primary focus-visible:ring-border-heavy w-full pl-6 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset',
|
||||
'text-text-secondary hover:text-text-primary focus-visible:ring-border-heavy w-full pl-6 text-left focus-visible:ring-2 focus-visible:outline-none focus-visible:ring-inset',
|
||||
)}
|
||||
onClick={onReveal}
|
||||
data-testid="activity-phase-failed-peek"
|
||||
|
|
@ -495,7 +495,7 @@ function FailedPeek({
|
|||
<TriangleAlert size={14} />
|
||||
</span>
|
||||
<span className="tool-status-text flex min-w-0 items-center gap-2">
|
||||
<span className="text-status-error min-w-0 max-w-full shrink-0 truncate font-medium">
|
||||
<span className="text-status-error max-w-full min-w-0 shrink-0 truncate font-medium">
|
||||
{first.text}
|
||||
</span>
|
||||
{first.detail !== '' && (
|
||||
|
|
@ -768,7 +768,7 @@ export default function ActivityPhaseGroup({
|
|||
const group = !hasContent ? (
|
||||
<div
|
||||
className={cn(
|
||||
'text-text-secondary mb-2 mt-1 flex min-h-7 w-full items-center gap-2 py-1',
|
||||
'text-text-secondary mt-1 mb-2 flex min-h-7 w-full items-center gap-2 py-1',
|
||||
shouldAnimateEntrance && `animate-in fade-in-0 motion-reduce:animate-none ${FOLD_EASING}`,
|
||||
)}
|
||||
data-testid="activity-phase-card"
|
||||
|
|
@ -790,7 +790,7 @@ export default function ActivityPhaseGroup({
|
|||
* groups it stands for, so it carries the same geometry: 16px glyph, 8px
|
||||
* gap, no inset. Boxing it was what put its text on a third left edge and
|
||||
* forced every folded row 13px sideways as the box materialized. */
|
||||
<div className="mb-2 mt-1 w-full" ref={rootRef} data-testid="activity-phase-card">
|
||||
<div className="mt-1 mb-2 w-full" ref={rootRef} data-testid="activity-phase-card">
|
||||
<span className="sr-only" role="status" data-testid="activity-phase-announcer">
|
||||
{announcement}
|
||||
</span>
|
||||
|
|
@ -811,7 +811,7 @@ export default function ActivityPhaseGroup({
|
|||
* supplies it today; stating it here keeps the requirement with
|
||||
* the element that depends on it. */
|
||||
className={cn(
|
||||
'text-text-secondary hover:text-text-primary focus-visible:ring-border-heavy flex h-auto min-h-7 min-w-0 flex-1 items-center justify-start gap-2 rounded-none bg-transparent p-0 py-1 text-left font-medium hover:bg-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-offset-0',
|
||||
'text-text-secondary hover:text-text-primary focus-visible:ring-border-heavy flex h-auto min-h-7 min-w-0 flex-1 items-center justify-start gap-2 rounded-none bg-transparent p-0 py-1 text-left font-medium hover:bg-transparent focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:outline-none focus-visible:ring-inset',
|
||||
/** The open card's title: the one semibold, primary-colour line
|
||||
* in the fold, so the rows under it read as its contents. */
|
||||
isExpanded && 'text-text-primary font-semibold',
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ const Part = memo(function Part({
|
|||
const failed = part.status === 'failed' || part.status === 'partial';
|
||||
return (
|
||||
<div
|
||||
className={`my-1 break-words pl-1 text-sm italic ${failed ? 'text-text-warning' : 'text-text-secondary'}`}
|
||||
className={`my-1 pl-1 text-sm break-words italic ${failed ? 'text-text-warning' : 'text-text-secondary'}`}
|
||||
>
|
||||
{display}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ export default function ProgressText({
|
|||
<span
|
||||
className={cn(
|
||||
showShimmer ? 'shimmer' : '',
|
||||
'min-w-0 max-w-full truncate font-medium',
|
||||
'max-w-full min-w-0 truncate font-medium',
|
||||
subtitle && 'shrink-0',
|
||||
)}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -433,7 +433,7 @@ export default function ToolCall({
|
|||
</div>
|
||||
{showOAuth && (
|
||||
<div className="flex w-full flex-col gap-2.5">
|
||||
<div className="mb-1 mt-2">
|
||||
<div className="mt-2 mb-1">
|
||||
<Button
|
||||
className="inline-flex items-center justify-center rounded-xl px-4 py-2 text-sm font-medium"
|
||||
variant="default"
|
||||
|
|
|
|||
|
|
@ -514,12 +514,12 @@ export default function ToolCallGroup({
|
|||
}, [hasActiveToolCall, userOverride, suppressAutoExpand]);
|
||||
|
||||
return (
|
||||
<div className="mb-2 mt-1" ref={rootRef}>
|
||||
<div className="mt-1 mb-2" ref={rootRef}>
|
||||
<div className="flex w-full items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
className={cn(
|
||||
'text-text-secondary hover:text-text-secondary focus-visible:ring-border-heavy inline-flex h-auto min-w-0 flex-1 items-center justify-start gap-2 rounded-none bg-transparent p-0 py-1 hover:bg-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-0',
|
||||
'text-text-secondary hover:text-text-secondary focus-visible:ring-border-heavy inline-flex h-auto min-w-0 flex-1 items-center justify-start gap-2 rounded-none bg-transparent p-0 py-1 hover:bg-transparent focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:outline-none',
|
||||
/** An open header is the title of the rows under it, so it is the
|
||||
* one line in the fold set in the primary colour. */
|
||||
isExpanded && 'text-text-primary hover:text-text-primary',
|
||||
|
|
@ -565,7 +565,7 @@ export default function ToolCallGroup({
|
|||
</span>
|
||||
{visibleGroupDetail && (
|
||||
<span
|
||||
className="text-text-secondary min-w-0 max-w-[40%] truncate text-xs font-normal"
|
||||
className="text-text-secondary max-w-[40%] min-w-0 truncate text-xs font-normal"
|
||||
title={visibleGroupDetail}
|
||||
>
|
||||
· {visibleGroupDetail}
|
||||
|
|
@ -647,7 +647,7 @@ export default function ToolCallGroup({
|
|||
</div>
|
||||
</FailedRevealContext.Provider>
|
||||
</ToolAuthWarningContext.Provider>
|
||||
{hasPendingAuthRequest && <ToolAuthWarning className="mb-1 mt-2.5" />}
|
||||
{hasPendingAuthRequest && <ToolAuthWarning className="mt-2.5 mb-1" />}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ export function FailedRevealPill({
|
|||
<button
|
||||
type="button"
|
||||
className={cn(
|
||||
'bg-status-error-subtle text-status-error inline-flex h-5 shrink-0 items-center gap-1 rounded-full border border-transparent px-2 text-xs font-semibold leading-none',
|
||||
'bg-status-error-subtle text-status-error inline-flex h-5 shrink-0 items-center gap-1 rounded-full border border-transparent px-2 text-xs leading-none font-semibold',
|
||||
'hover:border-status-error-border focus-visible:border-status-error focus-visible:outline-none',
|
||||
className,
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ export default function MCPToolItem({
|
|||
expanded ? 'opacity-100' : 'opacity-0',
|
||||
)}
|
||||
>
|
||||
<p className="text-text-secondary max-h-44 overflow-y-auto whitespace-pre-wrap text-xs leading-relaxed">
|
||||
<p className="text-text-secondary max-h-44 overflow-y-auto text-xs leading-relaxed whitespace-pre-wrap">
|
||||
{description || localize('com_ui_mcp_no_description')}
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -432,7 +432,7 @@ export default function McpSection({ item }: Props) {
|
|||
return (
|
||||
<div className="flex flex-col gap-5">
|
||||
{item.description && (
|
||||
<p className="text-text-secondary max-h-40 overflow-y-auto whitespace-pre-wrap text-sm leading-relaxed">
|
||||
<p className="text-text-secondary max-h-40 overflow-y-auto text-sm leading-relaxed whitespace-pre-wrap">
|
||||
{item.description}
|
||||
</p>
|
||||
)}
|
||||
|
|
@ -479,7 +479,7 @@ export default function McpSection({ item }: Props) {
|
|||
|
||||
<div className="flex flex-col gap-2">
|
||||
<div className="flex min-h-7 items-center justify-between">
|
||||
<span className="text-text-secondary text-[11px] font-medium uppercase tracking-wide">
|
||||
<span className="text-text-secondary text-[11px] font-medium tracking-wide uppercase">
|
||||
{localize('com_ui_tools_mcp_tools_section')}
|
||||
</span>
|
||||
{(hasTools || runtimeToolsAvailable) && (
|
||||
|
|
|
|||
|
|
@ -457,6 +457,42 @@ describe('steps', () => {
|
|||
expect(replayed.message.content).toEqual(closed.content);
|
||||
});
|
||||
|
||||
it('retains existing timing metadata when a delta and closure omit new timing', () => {
|
||||
const stamps = { toolPreparationStartedAt: 1_000, toolDispatchedAt: 1_100 };
|
||||
const opened = applyToolCallsStep(createResponse(), search, 0, () => stamps).message;
|
||||
const streamed = applyToolCallDelta(
|
||||
opened,
|
||||
search,
|
||||
argsDelta(search.id, '{}'),
|
||||
'call-1',
|
||||
0,
|
||||
) as TMessage;
|
||||
const closed = applyRunStepClosed(
|
||||
streamed,
|
||||
search,
|
||||
{
|
||||
id: search.id,
|
||||
index: 1,
|
||||
type: StepTypes.TOOL_CALLS,
|
||||
status: 'completed',
|
||||
created_at: 1_000,
|
||||
closed_at: 1_250,
|
||||
},
|
||||
0,
|
||||
);
|
||||
expect(closed?.content?.[1]).toMatchObject({
|
||||
tool_call: {
|
||||
...stamps,
|
||||
args: '{}',
|
||||
runStepStatus: 'completed',
|
||||
runStepDurationMs: 250,
|
||||
runStepClosedAt: 1_250,
|
||||
},
|
||||
});
|
||||
expect(closed?.content?.[1]).not.toHaveProperty('tool_call.toolPreparationDurationMs');
|
||||
expect(closed?.content?.[1]).not.toHaveProperty('tool_call.toolExecutionDurationMs');
|
||||
});
|
||||
|
||||
it('preserves tool timing through completion and settled-step replay', () => {
|
||||
const getTiming = () => ({ toolPreparationStartedAt: 1_000, toolDispatchedAt: 1_100 });
|
||||
const opened = applyToolCallsStep(createResponse(), search, 0, getTiming).message;
|
||||
|
|
|
|||
|
|
@ -299,7 +299,9 @@ export function updateContent(
|
|||
};
|
||||
} else if (contentType === ContentTypes.TOOL_CALL && 'tool_call' in contentPart) {
|
||||
const existingContent = updatedContent[index] as Agents.ToolCallContent | undefined;
|
||||
const existingToolCall = existingContent?.tool_call;
|
||||
const existingToolCall = existingContent?.tool_call as
|
||||
| (Agents.ToolCall & PartMetadata)
|
||||
| undefined;
|
||||
const toolCallArgs = (contentPart.tool_call as Agents.ToolCall).args;
|
||||
/** When args are a valid object, they are likely already invoked */
|
||||
let args =
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { getStepMetadata, updateContent } from './content';
|
|||
type ToolTimingLookup = (
|
||||
callId: string,
|
||||
index?: number,
|
||||
) => Pick<Agents.ToolCall, 'toolPreparationStartedAt' | 'toolDispatchedAt'>;
|
||||
) => Pick<PartMetadata, 'toolPreparationStartedAt' | 'toolDispatchedAt'>;
|
||||
|
||||
/** Mirrors `SKILL_FILE_PREFIX` in `@librechat/api` file-authoring handlers. */
|
||||
const SKILL_FILE_PREFIX = 'skills/';
|
||||
|
|
@ -170,7 +170,7 @@ export function applyRunStepClosed(
|
|||
runStep: Agents.RunStep,
|
||||
closed: Agents.RunStepClosedEvent,
|
||||
editPrefixOffset: number,
|
||||
timing: Pick<Agents.ToolCall, 'toolPreparationDurationMs' | 'toolExecutionDurationMs'> = {},
|
||||
timing: Pick<PartMetadata, 'toolPreparationDurationMs' | 'toolExecutionDurationMs'> = {},
|
||||
): TMessage | undefined {
|
||||
const index = runStep.index + editPrefixOffset;
|
||||
const existing = message.content?.[index];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue