src/app/core/admin/admin-ai-agent/admin-ai-agent.component.ts

Description

Admin page providing tools to help configure Aam Digital using AI agents.

Allows admins to download all relevant configuration documents as a single JSON file that can be shared with an AI assistant (e.g. ChatGPT, Claude) to provide it with the necessary system context for configuration assistance. No personal data is included — only structural configuration documents.

Example

Metadata

Relationships

Used by

No results matching.

Depends on

Index

Methods

Methods

Async downloadAiContext
downloadAiContext()

Fetches all relevant config documents via EntityMapperService and downloads them as a single JSON file suitable for use as AI agent context.

Returns : Promise<void>
import { ChangeDetectionStrategy, Component, inject } from "@angular/core";
import { MatButtonModule } from "@angular/material/button";
import { MatCardModule } from "@angular/material/card";
import { FontAwesomeModule } from "@fortawesome/angular-fontawesome";
import { EntityMapperService } from "../../entity/entity-mapper/entity-mapper.service";
import { ViewTitleComponent } from "../../common-components/view-title/view-title.component";
import { DownloadService } from "../../export/download-service/download.service";
import { Config } from "../../config/config";
import { ConfigurableEnum } from "../../basic-datatypes/configurable-enum/configurable-enum";
import { ReportEntity } from "#src/app/features/reporting/report-config";
import { PublicFormConfig } from "#src/app/features/public-form/public-form-config";
import moment from "moment";
import { SiteSettings } from "../../site-settings/site-settings";

/**
 * Admin page providing tools to help configure Aam Digital using AI agents.
 *
 * Allows admins to download all relevant configuration documents as a single
 * JSON file that can be shared with an AI assistant (e.g. ChatGPT, Claude)
 * to provide it with the necessary system context for configuration assistance.
 * No personal data is included — only structural configuration documents.
 */
@Component({
  selector: "app-admin-ai-agent",
  templateUrl: "./admin-ai-agent.component.html",
  styleUrls: ["./admin-ai-agent.component.scss"],
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [
    MatButtonModule,
    MatCardModule,
    FontAwesomeModule,
    ViewTitleComponent,
  ],
})
export class AdminAiAgentComponent {
  private readonly entityMapper = inject(EntityMapperService);
  private readonly downloadService = inject(DownloadService);

  /**
   * Fetches all relevant config documents via EntityMapperService and downloads
   * them as a single JSON file suitable for use as AI agent context.
   */
  async downloadAiContext(): Promise<void> {
    const documentSources = [
      this.entityMapper
        .load(Config, Config.CONFIG_KEY)
        .then((document) => [document])
        .catch(() => []),
      this.entityMapper
        .load(Config, Config.PERMISSION_KEY)
        .then((document) => [document])
        .catch(() => []),
      this.entityMapper.loadType(ConfigurableEnum),
      this.entityMapper.loadType(SiteSettings),
      this.entityMapper.loadType(ReportEntity),
      this.entityMapper.loadType(PublicFormConfig),
    ];

    const docs = (await Promise.all(documentSources)).flat();

    await this.downloadService.triggerDownload(
      docs,
      "json",
      "aam-digital-ai-context_" +
        location.hostname +
        "_" +
        moment().format() +
        ".json",
    );
  }
}
<app-view-title i18n>Configure using AI Agents</app-view-title>

<mat-card class="margin-regular">
  <mat-card-content>
    <p i18n>
      Download a snapshot of all configuration documents from this system as a
      single JSON file. You can share this file with an AI assistant (e.g.
      ChatGPT, Claude) so it has the context needed to help you adjust
      configuration, reports, or forms.
    </p>
    <p i18n>
      The download contains only structural configuration — no personal data or
      case records are included.
    </p>
    <p><strong i18n>Included document types:</strong></p>
    <ul>
      <li i18n>Application Configuration</li>
      <li i18n>Permissions</li>
      <li i18n>Configurable Enums</li>
      <li i18n>Site Settings</li>
      <li i18n>Report Configurations</li>
      <li i18n>Public Form Configurations</li>
    </ul>
  </mat-card-content>
  <mat-card-actions>
    <button mat-raised-button color="accent" (click)="downloadAiContext()">
      <fa-icon icon="download"></fa-icon>
      <span i18n>Download AI Context (JSON)</span>
    </button>
  </mat-card-actions>
</mat-card>

./admin-ai-agent.component.scss

Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""