mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-04 14:57:42 +00:00
refactor: drop the steer and queue toggle copy
This commit is contained in:
parent
f7baeb9f29
commit
ecb1ee1e07
7 changed files with 15 additions and 75 deletions
|
|
@ -8,14 +8,12 @@ import { cn } from '~/utils';
|
|||
* identical across kinds — only the leading icon carries the accent — so the
|
||||
* tray reads as one list rather than four stacked systems.
|
||||
*/
|
||||
export type ChipTone = 'file' | 'quote' | 'skill' | 'queued' | 'failed' | 'tool';
|
||||
export type ChipTone = 'file' | 'quote' | 'skill' | 'tool';
|
||||
|
||||
const TONE_ICON: Record<ChipTone, string> = {
|
||||
file: 'text-text-secondary',
|
||||
quote: 'text-cyan-500',
|
||||
skill: 'text-purple-500',
|
||||
queued: 'text-cyan-500',
|
||||
failed: 'text-red-500',
|
||||
/** Tools carry their own accent; this is only the fallback (MCP servers,
|
||||
* whose icons are their own branding and shouldn't be tinted). */
|
||||
tool: 'text-text-primary',
|
||||
|
|
@ -35,9 +33,6 @@ export interface ChipProps {
|
|||
iconClassName?: string;
|
||||
/** Square preview rendered in place of `icon`, used by image attachments. */
|
||||
thumbnail?: ReactNode;
|
||||
/** Stretches the chip to fill the tray width, for queued and failed rows
|
||||
* whose actions do not fit an inline pill. */
|
||||
block?: boolean;
|
||||
/** Rendered between the label and the remove button. */
|
||||
trailing?: ReactNode;
|
||||
onRemove?: () => void;
|
||||
|
|
@ -53,7 +48,6 @@ function Chip({
|
|||
icon,
|
||||
iconClassName,
|
||||
thumbnail,
|
||||
block = false,
|
||||
trailing,
|
||||
onRemove,
|
||||
removeLabel,
|
||||
|
|
@ -65,12 +59,7 @@ function Chip({
|
|||
role="listitem"
|
||||
data-testid={testId}
|
||||
data-tone={tone}
|
||||
className={cn(
|
||||
BASE_CLASS,
|
||||
block ? 'flex w-full px-3 py-2' : 'max-w-full px-2.5 py-1',
|
||||
tone === 'failed' ? 'border-red-500/60' : 'border-border-light',
|
||||
className,
|
||||
)}
|
||||
className={cn(BASE_CLASS, 'max-w-full border-border-light px-2.5 py-1', className)}
|
||||
>
|
||||
{thumbnail ?? (
|
||||
<span
|
||||
|
|
@ -80,10 +69,7 @@ function Chip({
|
|||
{icon}
|
||||
</span>
|
||||
)}
|
||||
<span
|
||||
className={cn('truncate', block ? 'min-w-0 flex-1' : 'max-w-[14rem]')}
|
||||
title={title ?? label}
|
||||
>
|
||||
<span className="max-w-[14rem] truncate" title={title ?? label}>
|
||||
{label}
|
||||
</span>
|
||||
{trailing}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ function Tray({ items, conversation, files, setFiles, setFilesLoading, isRTL }:
|
|||
|
||||
return (
|
||||
<div
|
||||
role="list"
|
||||
aria-label={localize('com_ui_composer_staged_context')}
|
||||
data-testid="composer-tray"
|
||||
className="flex flex-col gap-1.5 px-2 pt-2"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import React from 'react';
|
||||
import { RecoilRoot } from 'recoil';
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import type { ComposerItem } from '~/hooks/Input/useComposerItems';
|
||||
import type { ExtendedFile } from '~/common';
|
||||
|
|
@ -29,16 +28,14 @@ const item = (overrides: Partial<ComposerItem> = {}): ComposerItem => ({
|
|||
|
||||
function renderTray(items: ComposerItem[], files: Map<string, ExtendedFile> = new Map()) {
|
||||
return render(
|
||||
<RecoilRoot>
|
||||
<Tray
|
||||
items={items}
|
||||
conversation={null}
|
||||
files={files}
|
||||
setFiles={jest.fn()}
|
||||
setFilesLoading={jest.fn()}
|
||||
isRTL={false}
|
||||
/>
|
||||
</RecoilRoot>,
|
||||
<Tray
|
||||
items={items}
|
||||
conversation={null}
|
||||
files={files}
|
||||
setFiles={jest.fn()}
|
||||
setFilesLoading={jest.fn()}
|
||||
isRTL={false}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
import { memo, useState, useRef, useEffect } from 'react';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { Constants } from 'librechat-data-provider';
|
||||
import { CSSTransition } from 'react-transition-group';
|
||||
import type { TMessage } from 'librechat-data-provider';
|
||||
import { useScreenshot, useMessageScrolling, useLocalize } from '~/hooks';
|
||||
import ScrollToBottom from '~/components/Messages/ScrollToBottom';
|
||||
import { steerOverlayHeightFamily } from '~/store/steer';
|
||||
import { MessagesViewProvider } from '~/Providers';
|
||||
import { fontSizeAtom } from '~/store/fontSize';
|
||||
import MultiMessage from './MultiMessage';
|
||||
|
|
@ -102,13 +100,6 @@ function MessagesViewContent({
|
|||
|
||||
const { conversationId } = conversation ?? {};
|
||||
|
||||
/** The in-flight steer overlay floats above the composer over the bottom of
|
||||
* the thread (see `InFlightSteers`); reserve an equal band here so the
|
||||
* newest message rests above it and older ones scroll behind. */
|
||||
const steerOverlayHeight = useAtomValue(
|
||||
steerOverlayHeightFamily(conversationId ?? Constants.NEW_CONVO),
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="relative flex-1 overflow-hidden overflow-y-auto">
|
||||
|
|
@ -123,15 +114,7 @@ function MessagesViewContent({
|
|||
width: '100%',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
ref={contentRef}
|
||||
className="flex flex-col pb-9 pt-14 dark:bg-transparent"
|
||||
style={
|
||||
steerOverlayHeight > 0
|
||||
? { paddingBottom: `calc(2.25rem + ${steerOverlayHeight}px)` }
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<div ref={contentRef} className="flex flex-col pb-9 pt-14 dark:bg-transparent">
|
||||
{(_messagesTree && _messagesTree.length == 0) || _messagesTree === null ? (
|
||||
<div
|
||||
className={cn(
|
||||
|
|
|
|||
|
|
@ -1057,7 +1057,6 @@
|
|||
"com_ui_conversation_not_found": "Conversation not found",
|
||||
"com_ui_conversation_summarized": "Conversation summarized",
|
||||
"com_ui_conversations": "conversations",
|
||||
"com_ui_convert_to_queue": "Queue for after the response",
|
||||
"com_ui_convo_archived": "Conversation archived",
|
||||
"com_ui_convo_delete_error": "Failed to delete conversation",
|
||||
"com_ui_convo_delete_success": "Conversation successfully deleted",
|
||||
|
|
@ -1964,7 +1963,7 @@
|
|||
"com_ui_steer_cancel": "Cancel steering message",
|
||||
"com_ui_steer_cancel_failed": "Could not cancel the steering message — it may still reach the agent",
|
||||
"com_ui_steer_delivery_unconfirmed": "Delivery unconfirmed",
|
||||
"com_ui_steer_edit_queued": "Your composer already has a draft, so that steering message was queued for after the response instead",
|
||||
"com_ui_steer_edit_queued": "Your composer already has a draft, so that message was queued instead",
|
||||
"com_ui_steer_failed": "Steering failed",
|
||||
"com_ui_steer_failed_inline": "Couldn't add to this reply",
|
||||
"com_ui_steer_in_flight": "Steering",
|
||||
|
|
@ -1972,9 +1971,10 @@
|
|||
"com_ui_steer_interrupts_default": "Steering interrupts generation",
|
||||
"com_ui_steer_interrupts_default_info": "When on, Enter stops the response at the next safe point instead of waiting for the agent's next tool step. Either way the partial answer is kept and the response continues.",
|
||||
"com_ui_steer_interrupts_enable_info": "Switches the during-run default to steering and stops the response at the next safe point. The partial answer is kept and the response continues.",
|
||||
"com_ui_steer_paused_queued": "The agent is waiting for your review — your message was queued instead",
|
||||
"com_ui_steer_paused_queued": "The assistant is waiting for your review, so your message was queued",
|
||||
"com_ui_steer_preempt_unsupported": "This deployment can't interrupt mid-response, so that steering message stays queued for the next tool step",
|
||||
"com_ui_steer_retry": "Retry steering",
|
||||
"com_ui_steer_run_ended_queued": "The reply finished, so your message was queued and will send now",
|
||||
"com_ui_steer_send": "Steer the current response",
|
||||
"com_ui_steered_info": "You added this message while the response was generating, so it was inserted into the response at this point.",
|
||||
"com_ui_stop": "Stop",
|
||||
|
|
@ -2074,8 +2074,6 @@
|
|||
"com_ui_travel": "Travel",
|
||||
"com_ui_trust_app": "I trust this application",
|
||||
"com_ui_try_adjusting_search": "Try adjusting your search terms",
|
||||
"com_ui_turn_on_queueing": "Turn on queueing",
|
||||
"com_ui_turn_on_steering": "Turn on steering",
|
||||
"com_ui_ui_resource_error": "UI Resource Error ({{0}})",
|
||||
"com_ui_ui_resource_not_found": "UI Resource not found (index: {{0}})",
|
||||
"com_ui_unarchive": "Unarchive",
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ export * from './favorites';
|
|||
export * from './subagents';
|
||||
export * from './sandbox';
|
||||
export * from './usage';
|
||||
export * from './steer';
|
||||
|
||||
export default {
|
||||
...artifacts,
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
import { atom } from 'jotai';
|
||||
import { atomFamily } from 'jotai/utils';
|
||||
|
||||
/**
|
||||
* Measured pixel height of the in-flight steer overlay for a conversation.
|
||||
* The overlay floats above the composer over the bottom of the message scroll
|
||||
* area; the messages reserve an equal band of bottom padding (see
|
||||
* `MessagesView`) so the newest message clears it at rest and older messages
|
||||
* scroll behind it. `InFlightSteers` publishes its height here and resets it to
|
||||
* 0 on unmount, so the entry is never stale — the atomFamily is not GC'd, but
|
||||
* each holds a single number per visited conversation.
|
||||
*/
|
||||
export const steerOverlayHeightFamily = atomFamily((_conversationId: string) => atom<number>(0));
|
||||
|
||||
/**
|
||||
* Set synchronously before a bubble's arm request and cleared on settlement.
|
||||
* Purely a UX gate: with the atomic in-place arm, a double-arm is harmless
|
||||
* server-side (the run seals once and drains the whole queue in order), but
|
||||
* every escalation control advertises "one interrupt at a time" by disabling,
|
||||
* and the chip-derived check cannot see an arm until its response lands.
|
||||
*/
|
||||
export const escalatingSteerFamily = atomFamily((_conversationId: string) => atom<boolean>(false));
|
||||
Loading…
Add table
Add a link
Reference in a new issue