Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

2.3 KB
Raw Blame
import { ScrollText } from 'lucide-react';
import { ROW_GLYPH_SLOT, TOOL_ROW_CLASSES } from '@librechat/chat/components';
import { useLocalize } from '~/hooks';
import { cn } from '~/utils';

/**
 * Minimal variant of `SkillCall` used for the interim window between
 * submit and the backend's real `skill` tool_call content part landing
 * on the message.
 *
 * Strips the expand/collapse affordance that `SkillCall` inherits from
 * `ProgressText` — there's nothing to expand during priming (empty
 * output), and leaving the chevron + cursor-pointer on a non-functional
 * button is misleading. Same ScrollText icon, same shimmer, same
 * localized label strings (`com_ui_skill_running` / `com_ui_skill_finished`)
 * so the visual language matches the real card it'll be replaced by.
 *
 * `loaded=false` → "Running X" with pulsing icon + shimmer.
 * `loaded=true`  → "Ran X" with static icon; driven by
 *                  `ContentParts.hasRealContent`, which flips true as
 *                  soon as any streamed content part arrives, matching
 *                  the transition users see for model-invoked skills.
 */
export default function PendingSkillCall({
  skillName,
  loaded,
}: {
  skillName: string;
  loaded: boolean;
}) {
  const localize = useLocalize();
  const text = loaded
    ? localize('com_ui_skill_finished', { 0: skillName })
    : localize('com_ui_skill_running', { 0: skillName });

  return (
    <div className={TOOL_ROW_CLASSES}>
      <div className="progress-text-wrapper text-text-secondary relative -mt-[0.046875rem] h-5 w-full leading-5">
        <div className="progress-text-content absolute top-0 right-0 left-0 max-w-full overflow-visible whitespace-nowrap">
          <div className="inline-flex w-full items-center gap-2">
            {/** The real `SkillCall` replaces this row in place once the skill
             *   finalizes; sharing its glyph slot keeps that swap still. */}
            <span className={ROW_GLYPH_SLOT} aria-hidden="true">
              <ScrollText
                className={cn('text-text-secondary size-4 shrink-0', !loaded && 'animate-pulse')}
              />
            </span>
            <span className={cn(!loaded && 'shimmer', 'min-w-0 truncate font-medium')}>{text}</span>
          </div>
        </div>
      </div>
    </div>
  );
}