feat: pullSystemAiModelStreaming for live model-download progress

Wraps HubAdmin/PullSystemAiModelStream: yields the backend's own
status and byte counts per layer, and hands the terminal response to
onFinished, whose errorKind stays the failure signal. Stubs
regenerated from the protos (additive only).

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-09-08 17:51:28 +02:00
parent 1d3d33d55a
commit 4c7db58bce
4 changed files with 294 additions and 0 deletions

View file

@ -818,6 +818,19 @@ class HubAdminClient extends $grpc.Client {
return $createUnaryCall(_$pullSystemAiModel, request, options: options);
}
/// Same pull, with live progress. A model pull moves gigabytes, so
/// the unary form above leaves a person waiting minutes with nothing
/// to look at. Emits Ollama's own status plus byte counts per layer,
/// ending in the response.
$grpc.ResponseStream<$0.PullProgressEvent> pullSystemAiModelStream(
$0.PullSystemAiModelRequest request, {
$grpc.CallOptions? options,
}) {
return $createStreamingCall(
_$pullSystemAiModelStream, $async.Stream.fromIterable([request]),
options: options);
}
/// Drop every cached System-AI explanation. Surfaced in
/// Studio's Settings so operators can force a clean slate
/// without changing model/privacy mode (which also flushes).
@ -1139,6 +1152,11 @@ class HubAdminClient extends $grpc.Client {
'/chain.v1.HubAdmin/PullSystemAiModel',
($0.PullSystemAiModelRequest value) => value.writeToBuffer(),
$0.PullSystemAiModelResponse.fromBuffer);
static final _$pullSystemAiModelStream =
$grpc.ClientMethod<$0.PullSystemAiModelRequest, $0.PullProgressEvent>(
'/chain.v1.HubAdmin/PullSystemAiModelStream',
($0.PullSystemAiModelRequest value) => value.writeToBuffer(),
$0.PullProgressEvent.fromBuffer);
static final _$clearSystemLlmCache =
$grpc.ClientMethod<$1.Empty, $0.ClearSystemLlmCacheResponse>(
'/chain.v1.HubAdmin/ClearSystemLlmCache',
@ -1579,6 +1597,15 @@ abstract class HubAdminServiceBase extends $grpc.Service {
($core.List<$core.int> value) =>
$0.PullSystemAiModelRequest.fromBuffer(value),
($0.PullSystemAiModelResponse value) => value.writeToBuffer()));
$addMethod(
$grpc.ServiceMethod<$0.PullSystemAiModelRequest, $0.PullProgressEvent>(
'PullSystemAiModelStream',
pullSystemAiModelStream_Pre,
false,
true,
($core.List<$core.int> value) =>
$0.PullSystemAiModelRequest.fromBuffer(value),
($0.PullProgressEvent value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$1.Empty, $0.ClearSystemLlmCacheResponse>(
'ClearSystemLlmCache',
clearSystemLlmCache_Pre,
@ -2055,6 +2082,15 @@ abstract class HubAdminServiceBase extends $grpc.Service {
$async.Future<$0.PullSystemAiModelResponse> pullSystemAiModel(
$grpc.ServiceCall call, $0.PullSystemAiModelRequest request);
$async.Stream<$0.PullProgressEvent> pullSystemAiModelStream_Pre(
$grpc.ServiceCall $call,
$async.Future<$0.PullSystemAiModelRequest> $request) async* {
yield* pullSystemAiModelStream($call, await $request);
}
$async.Stream<$0.PullProgressEvent> pullSystemAiModelStream(
$grpc.ServiceCall call, $0.PullSystemAiModelRequest request);
$async.Future<$0.ClearSystemLlmCacheResponse> clearSystemLlmCache_Pre(
$grpc.ServiceCall $call, $async.Future<$1.Empty> $request) async {
return clearSystemLlmCache($call, await $request);