From 194711e20698dd765c113a6d78bf7af0e4fd0474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Troed=20S=C3=A5ngberg?= Date: Fri, 21 Aug 2026 13:54:39 +0200 Subject: [PATCH] feat: poll only the current session's llama-server --- tui.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tui.tsx b/tui.tsx index 5765fb8..10f900f 100644 --- a/tui.tsx +++ b/tui.tsx @@ -2,7 +2,7 @@ import type { TextRenderable } from "@opentui/core" import type { TuiPlugin, TuiPluginModule } from "@opencode-ai/plugin/tui" import { onCleanup } from "solid-js" -import { backoffDelayMs, processPoll, resolveServerUrls } from "./src/stats.ts" +import { backoffDelayMs, processPoll, resolveServerUrls, selectSessionUrls } from "./src/stats.ts" type StreamSample = { at: number @@ -184,6 +184,7 @@ const tui: TuiPlugin = async (api, options) => { if (!llamaServerUrls.length) return let model = llamaServerModel + let sessionProviderId: string | undefined if (!model) { const routeSessionID = api.route.current.params?.sessionID if (routeSessionID) { @@ -191,10 +192,13 @@ const tui: TuiPlugin = async (api, options) => { if (session?.model?.id) { model = session.model.id } + sessionProviderId = session?.model?.providerID } } - for (const baseUrl of llamaServerUrls) { + const activeUrls = selectSessionUrls(llamaServerUrls, api.state.provider, sessionProviderId) + if (!activeUrls.length) return + for (const baseUrl of activeUrls) { const now = Date.now() const backoff = backoffByUrl.get(baseUrl) if (backoff && now < backoff.nextRetryAt) {