LightningWeb.Channels.AiAssistantJSON (Lightning v2.15.16)

View Source

Renders AI Assistant data structures for channels and controllers.

Provides consistent JSON formatting for chat sessions across the API controller and Phoenix channel.

Summary

Functions

Formats a chat session for API/channel responses.

Formats a list of chat sessions.

Functions

format_session(session)

Formats a chat session for API/channel responses.

Returns a map with session metadata including type-specific fields (job_name/workflow_name for job_code, project_name/workflow_name for workflow_template).

Examples

iex> format_session(session)
%{
  id: "uuid",
  title: "Session title",
  session_type: "job_code",
  message_count: 5,
  updated_at: ~U[2024-01-01 00:00:00Z],
  job_name: "My Job",
  workflow_name: "My Workflow"
}

format_sessions(sessions)

Formats a list of chat sessions.