onData method

  1. @override
void onData(
  1. LlamaCommand data
)

A callback to run when new data is received from the parent.

Implementation

@override
void onData(LlamaCommand data) {
  switch (data) {
    case LlamaStop():
      _handleStop();

    case LlamaClear():
      _handleClear();

    case LlamaLoad(
        :final path,
        :final modelParams,
        :final contextParams,
        :final samplingParams,
        :final verbose,
        :final mmprojPath
      ):
      _handleLoad(path, modelParams, contextParams, samplingParams, verbose,
          mmprojPath);

    case LlamaPrompt(
        :final prompt,
        :final promptId,
        :final images,
        :final slotId
      ):
      _handlePrompt(prompt, promptId, images, slotId);

    case LlamaInit(:final libraryPath):
      _handleInit(libraryPath);

    case LlamaEmbedd(:final prompt):
      _handleEmbedding(prompt);

    case LlamaDispose():
      _handleDispose();

    case LlamaSaveState(:final slotId):
      _handleSaveState(slotId);

    case LlamaLoadState(:final slotId, :final data):
      _handleLoadState(slotId, data);

    case LlamaLoadSession(:final slotId, :final path):
      _handleLoadSession(slotId, path);

    case LlamaFreeSlot(:final slotId):
      _handleFreeSlot(slotId);
  }
}