mirror of
https://git.sync.wtf/troed/oc-ls-stats.git
synced 2026-08-31 09:43:38 +03:00
feat: poll only the current session's llama-server
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user