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

1.1 KB
Raw Blame
import { memo } from 'react';
import type { MemoExoticComponent, ReactNode } from 'react';

/**
 * Re-attributes response content to its author mid-message. A `SteerPart`
 * renders a full user turn inside the response, so the parts that resume
 * after it need the author's icon and label restated. The message-level
 * header only renders once, above the first part. Sits on the same left
 * edge as the message body.
 */
type AuthorHeaderProps = { icon: ReactNode; label: string };

const AuthorHeader: MemoExoticComponent<(props: AuthorHeaderProps) => ReactNode> = memo(
  function AuthorHeader({ icon, label }: AuthorHeaderProps) {
    return (
      <div className="relative flex min-h-7 w-full items-center gap-2" data-testid="author-header">
        <div
          className="flex size-6 shrink-0 items-center justify-center overflow-hidden rounded-full"
          aria-hidden="true"
        >
          {icon}
        </div>
        <h2 className="text-text-primary min-w-0 truncate text-sm font-semibold select-none">
          {label}
        </h2>
      </div>
    );
  },
);

export default AuthorHeader;