setModelPath method

  1. @override
Future<void> setModelPath(
  1. String path, {
  2. String? loraPath,
})
override

Sets direct path to existing model files

Implementation

@override
Future<void> setModelPath(String path, {String? loraPath}) async {
  await _ensureInitialized();

  // For web, treat as URL
  _path = path;
  _loraPath = loraPath;

  final spec = InferenceModelSpec(
    name: path.split('/').last.replaceAll('.bin', '').replaceAll('.task', ''),
    modelUrl: path.startsWith('http') ? path : 'file://$path',
    loraUrl: loraPath != null ? (loraPath.startsWith('http') ? loraPath : 'file://$loraPath') : null,
  );

  await ensureModelReady(spec.name, spec.modelUrl);
  _currentActiveModel = spec;
}