Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .claude/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
{
"name": "website-dev",
"runtimeExecutable": "/bin/bash",
"runtimeArgs": ["-c", "export PATH=/Users/blove/.nvm/versions/node/v22.14.0/bin:$PATH && npx nx serve website"],
"port": 3000
"runtimeArgs": ["-c", "export PATH=/Users/blove/.nvm/versions/node/v22.14.0/bin:$PATH && npx nx serve website --port $PORT"],
"port": 3000,
"autoPort": true
},
{
"name": "cockpit",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@ For plain HTTP requests that return a single value and complete, Angular's built
<Card
title="Quickstart"
icon="rocket"
href="/docs-v2/quickstart"
href="/docs/agent/getting-started/quickstart"
>
Build your first streaming component end-to-end in under five minutes.
</Card>
<Card
title="Streaming Guide"
icon="wave-sine"
href="/docs-v2/guides/streaming"
href="/docs/agent/guides/streaming"
>
Deep dive into SSE lifecycle, error handling, and reconnect strategies.
</Card>
<Card
title="Angular Signals"
icon="bolt"
href="/docs-v2/concepts/angular-signals"
href="/docs/agent/concepts/angular-signals"
>
Understand how angular integrates with Angular's reactivity model.
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ The transport handles:
<Card
title="Streaming Guide"
icon="wave-sine"
href="/docs-v2/guides/streaming"
href="/docs/agent/guides/streaming"
>
Learn how the SSE lifecycle maps to resource signals and how to handle reconnects.
</Card>
<Card
title="Deployment"
icon="server"
href="/docs-v2/guides/deployment"
href="/docs/agent/guides/deployment"
>
Server configuration for SSE: headers, timeouts, and edge runtime considerations.
</Card>
<Card
title="MockAgentTransport"
icon="flask"
href="/docs-v2/api/mock-stream-transport"
href="/docs/agent/api/mock-stream-transport"
>
The test-time counterpart — push values synchronously without a real server.
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,21 @@ describe('RepoComponent', () => {
<Card
title="Testing Guide"
icon="flask"
href="/docs-v2/guides/testing"
href="/docs/agent/guides/testing"
>
Full testing patterns including component harnesses and multi-stream scenarios.
</Card>
<Card
title="FetchStreamTransport"
icon="globe"
href="/docs-v2/api/fetch-stream-transport"
href="/docs/agent/api/fetch-stream-transport"
>
The production transport that MockAgentTransport replaces in tests.
</Card>
<Card
title="agent() API"
icon="code"
href="/docs-v2/api/angular"
href="/docs/agent/api/angular"
>
Full reference for the primitive you are testing against.
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,21 @@ provideAgent({ transport: MockAgentTransport })
<Card
title="Installation"
icon="package"
href="/docs-v2/installation"
href="/docs/agent/getting-started/installation"
>
Step-by-step setup guide including peer dependencies and NgModule support.
</Card>
<Card
title="Deployment"
icon="server"
href="/docs-v2/guides/deployment"
href="/docs/agent/guides/deployment"
>
Configure transports for production, SSR, and edge runtimes.
</Card>
<Card
title="agent() API"
icon="code"
href="/docs-v2/api/angular"
href="/docs/agent/api/angular"
>
Full reference for the core primitive you configure here.
</Card>
Expand Down
132 changes: 132 additions & 0 deletions apps/website/content/docs/chat/api/chat-config.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# 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:**

```typescript
import type { ChatConfig } from '@cacheplane/chat';
```

## Interface Definition

```typescript
interface ChatConfig {
/** Default render registry for generative UI components. */
renderRegistry?: AngularRegistry;

/** Override the default AI avatar label (default: "A"). */
avatarLabel?: string;

/** Override the default assistant display name (default: "Assistant"). */
assistantName?: string;
}
```

## Properties

### renderRegistry

```typescript
renderRegistry?: AngularRegistry
```

The component registry used by `ChatGenerativeUiComponent` to resolve JSON UI specs to Angular components. This is an `AngularRegistry` from `@cacheplane/render`.

When not provided, generative UI components will not render -- the `chat-generative-ui` primitive will simply show nothing for any spec passed to it.

**Example:**

```typescript
import { createAngularRegistry } from '@cacheplane/render';
import { WeatherCardComponent } from './weather-card.component';
import { ChartComponent } from './chart.component';

const registry = createAngularRegistry({
weather_card: WeatherCardComponent,
chart: ChartComponent,
});

provideChat({ renderRegistry: registry });
```

See the [Generative UI guide](/docs/chat/guides/generative-ui) for detailed setup.

### avatarLabel

```typescript
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:**

```typescript
provideChat({ avatarLabel: 'AI' });
```

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

### assistantName

```typescript
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:**

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

## Accessing ChatConfig at Runtime

Inject `CHAT_CONFIG` to read configuration values in your own components:

```typescript
import { inject } from '@angular/core';
import { CHAT_CONFIG } from '@cacheplane/chat';
import type { ChatConfig } from '@cacheplane/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';
}
}
```

## Relationship to Other Types

`ChatConfig` references the following external type:

| Type | Package | Description |
|------|---------|-------------|
| `AngularRegistry` | `@cacheplane/render` | Maps JSON spec type strings to Angular component classes |

## 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:

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