Skip to content

@graphty/graphty-element / ai / AiController

Class: AiController ​

Defined in: graphty-element/src/ai/AiController.ts:54

Controller that orchestrates LLM providers and command execution. Manages the conversation flow, command dispatch, and status updates.

Constructors ​

Constructor ​

new AiController(options): AiController

Defined in: graphty-element/src/ai/AiController.ts:72

Creates a new AiController instance.

Parameters ​

options ​

AiControllerOptions

Configuration options for the controller

Returns ​

AiController

Methods ​

cancel() ​

cancel(): void

Defined in: graphty-element/src/ai/AiController.ts:545

Cancel the current operation.

Returns ​

void


clearLastError() ​

clearLastError(): void

Defined in: graphty-element/src/ai/AiController.ts:208

Clear the last error.

Returns ​

void


dispose() ​

dispose(): void

Defined in: graphty-element/src/ai/AiController.ts:563

Dispose of the controller and clean up resources.

Returns ​

void


execute() ​

execute(input): Promise<ExecutionResult>

Defined in: graphty-element/src/ai/AiController.ts:104

Execute a natural language command.

Parameters ​

input ​

string

The user's natural language input

Returns ​

Promise<ExecutionResult>

Promise resolving to the execution result


getLastError() ​

getLastError(): Error | null

Defined in: graphty-element/src/ai/AiController.ts:201

Get the last error that occurred.

Returns ​

Error | null

The last error or null if no error occurred


getLastInput() ​

getLastInput(): string | null

Defined in: graphty-element/src/ai/AiController.ts:193

Get the last input that was executed.

Returns ​

string | null

The last input or null if no command has been executed


getStatus() ​

getStatus(): AiStatus

Defined in: graphty-element/src/ai/AiController.ts:529

Get the current status snapshot.

Returns ​

AiStatus

Current AI status


onStatusChange() ​

onStatusChange(callback): () => void

Defined in: graphty-element/src/ai/AiController.ts:538

Subscribe to status changes.

Parameters ​

callback ​

StatusChangeCallback

Function to call on status change

Returns ​

Unsubscribe function

() => void