DocsChatAPI ReferenceChatConfig

ChatConfig

ChatConfig is the configuration interface accepted by provideChat(). It defines global settings for chat composition components including the generative UI registry, avatar styling, and assistant naming.

Import:

import type { ChatConfig } from '@ngaf/chat';

Interface Definition

interface ChatConfig {
  /** Override the default AI avatar label (default: "A"). */
  avatarLabel?: string;
  /** Override the default assistant display name (default: "Assistant"). */
  assistantName?: string;
}

Properties

avatarLabel

avatarLabel?: string

A short string (typically one or two characters) displayed in the AI avatar badge that appears next to assistant messages in composition components.

Default: "A"

Example:

provideChat({ avatarLabel: 'AI' });

The avatar badge is a small square element styled with --chat-avatar-bg and --chat-avatar-text CSS variables.

assistantName

assistantName?: string

The display name for the AI assistant. Used in labels, ARIA attributes, and any place where the assistant needs a human-readable name.

Default: "Assistant"

Example:

provideChat({ assistantName: 'Code Copilot' });

Accessing ChatConfig at Runtime

Inject CHAT_CONFIG to read configuration values in your own components:

import { inject } from '@angular/core';
import { CHAT_CONFIG } from '@ngaf/chat';
import type { ChatConfig } from '@ngaf/chat';
 
@Component({
  selector: 'app-chat-header',
  template: `
    <h2>{{ assistantName }}</h2>
  `,
})
export class ChatHeaderComponent {
  private config = inject(CHAT_CONFIG, { optional: true });
 
  get assistantName(): string {
    return this.config?.assistantName ?? 'Assistant';
  }
}

Type Location

The ChatConfig interface is defined in two files within the library:

  • libs/chat/src/lib/provide-chat.ts -- The canonical definition with JSDoc comments, alongside the provideChat() function and CHAT_CONFIG token
  • libs/chat/src/lib/chat.types.ts -- A simplified re-export for internal use

The public API exports ChatConfig as a type-only export:

export type { ChatConfig } from './lib/provide-chat';