@gmickel/gno 1.12.2 → 1.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -128,6 +128,7 @@ function formatModelRole(uri: string | undefined): string {
128
128
  }
129
129
 
130
130
  export interface AIModelSelectorProps {
131
+ appStatus?: AppStatusResponse | null;
131
132
  onPresetChange?: (presetId: string) => void;
132
133
  showDetails?: boolean;
133
134
  showDownloadAction?: boolean;
@@ -139,6 +140,7 @@ function isCustomPreset(preset: Preset): boolean {
139
140
  }
140
141
 
141
142
  export function AIModelSelector({
143
+ appStatus,
142
144
  onPresetChange,
143
145
  showDetails = false,
144
146
  showDownloadAction = true,
@@ -164,6 +166,7 @@ export function AIModelSelector({
164
166
  null
165
167
  );
166
168
  const pollInterval = useRef<ReturnType<typeof setInterval> | null>(null);
169
+ const parentOwnsStatus = useRef(appStatus !== undefined);
167
170
  const containerRef = useRef<HTMLDivElement>(null);
168
171
  const menuRef = useRef<HTMLDivElement>(null);
169
172
  const triggerRef = useRef<HTMLButtonElement>(null);
@@ -274,13 +277,15 @@ export function AIModelSelector({
274
277
  setLoading(false);
275
278
  });
276
279
 
277
- void apiFetch<AppStatusResponse>("/api/status").then(({ data }) => {
278
- if (data) {
279
- setModelsNeeded(
280
- data.bootstrap.models.cachedCount < data.bootstrap.models.totalCount
281
- );
282
- }
283
- });
280
+ if (!parentOwnsStatus.current) {
281
+ void apiFetch<AppStatusResponse>("/api/status").then(({ data }) => {
282
+ if (data) {
283
+ setModelsNeeded(
284
+ data.bootstrap.models.cachedCount < data.bootstrap.models.totalCount
285
+ );
286
+ }
287
+ });
288
+ }
284
289
 
285
290
  void apiFetch<DownloadStatus>("/api/models/status").then(({ data }) => {
286
291
  if (data?.active) {
@@ -290,6 +295,16 @@ export function AIModelSelector({
290
295
  });
291
296
  }, [checkCapabilities]);
292
297
 
298
+ useEffect(() => {
299
+ if (!appStatus) {
300
+ return;
301
+ }
302
+ setModelsNeeded(
303
+ appStatus.bootstrap.models.cachedCount <
304
+ appStatus.bootstrap.models.totalCount
305
+ );
306
+ }, [appStatus]);
307
+
293
308
  // Polling
294
309
  useEffect(() => {
295
310
  if (downloading && !pollInterval.current) {