mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-01 15:32:11 +08:00
fix(tui): reuse compact routed labels
This commit is contained in:
@@ -31,15 +31,12 @@ export namespace RoutedModelMeta {
|
||||
return part.type === "step-start" || part.type === "step-finish" || eligible(part, details)
|
||||
}
|
||||
|
||||
export function name(list: Providers, model: NonNullable<StepFinishPart["model"]>) {
|
||||
const id = KiloRoutedModel.display(model.modelID)
|
||||
const name = Model.name(list, model.providerID, model.modelID)
|
||||
return name === model.modelID && id !== model.modelID ? Model.name(list, model.providerID, id) : name
|
||||
}
|
||||
|
||||
export function label(list: Providers, model: StepFinishPart["model"]) {
|
||||
if (!model) return undefined
|
||||
return KiloRoutedModel.displayName(name(list, model))
|
||||
const id = KiloRoutedModel.display(model.modelID)
|
||||
const name = Model.name(list, model.providerID, model.modelID)
|
||||
const text = name === model.modelID && id !== model.modelID ? Model.name(list, model.providerID, id) : name
|
||||
return KiloRoutedModel.displayName(text)
|
||||
}
|
||||
|
||||
function routed(model: StepFinishPart["model"], message: Message) {
|
||||
|
||||
@@ -125,7 +125,7 @@ function View(props: { api: TuiPluginApi; session_id: string }) {
|
||||
{(model) => (
|
||||
<box>
|
||||
<text fg={theme().text} wrapMode="char">
|
||||
<b>{RoutedModelMeta.name(providers(), model)}</b>
|
||||
<b>{RoutedModelMeta.label(providers(), model)}</b>
|
||||
</text>
|
||||
<text fg={theme().textMuted} wrapMode="word">
|
||||
Steps {formatCount(model.steps)} | Cost {formatCost(model.cost)}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, test } from "bun:test"
|
||||
import { Effect } from "effect"
|
||||
import type { Part, Provider, StepFinishPart } from "@kilocode/sdk/v2"
|
||||
import type { Part, StepFinishPart } from "@kilocode/sdk/v2"
|
||||
import { RoutedModelMeta } from "../../src/kilocode/cli/cmd/tui/routes/session/routed-model-meta"
|
||||
import { KiloRoutedModel } from "../../src/kilocode/session/routed-model"
|
||||
import { ModelID, ProviderID } from "../../src/provider/schema"
|
||||
@@ -103,50 +103,6 @@ describe("session routed model", () => {
|
||||
expect(KiloRoutedModel.displayName("o3")).toBe("o3")
|
||||
})
|
||||
|
||||
test("resolves dated routed ids to the formal catalog name", () => {
|
||||
const model = {
|
||||
id: "moonshotai/kimi-k2.7-code",
|
||||
providerID: "kilo",
|
||||
api: { id: "moonshotai/kimi-k2.7-code", url: "https://api.kilo.ai", npm: "@kilocode/kilo-gateway" },
|
||||
name: "MoonshotAI: Kimi K2.7 Code",
|
||||
capabilities: {
|
||||
temperature: true,
|
||||
reasoning: true,
|
||||
attachment: false,
|
||||
toolcall: true,
|
||||
input: { text: true, audio: false, image: false, video: false, pdf: false },
|
||||
output: { text: true, audio: false, image: false, video: false, pdf: false },
|
||||
interleaved: false,
|
||||
},
|
||||
cost: { input: 1, output: 1, cache: { read: 0, write: 0 } },
|
||||
limit: { context: 1, output: 1 },
|
||||
status: "active",
|
||||
options: {},
|
||||
headers: {},
|
||||
release_date: "2026-06-26",
|
||||
} satisfies Provider["models"][string]
|
||||
const providers = new Map([
|
||||
[
|
||||
"kilo",
|
||||
{
|
||||
id: "kilo",
|
||||
name: "Kilo Gateway",
|
||||
source: "api",
|
||||
env: [],
|
||||
options: {},
|
||||
models: { [model.id]: model },
|
||||
} satisfies Provider,
|
||||
],
|
||||
])
|
||||
|
||||
expect(
|
||||
RoutedModelMeta.name(providers, {
|
||||
providerID: "kilo",
|
||||
modelID: "moonshotai/kimi-k2.7-code-20260612",
|
||||
}),
|
||||
).toBe("MoonshotAI: Kimi K2.7 Code")
|
||||
})
|
||||
|
||||
test("shows compact labels only for Kilo auto selections", () => {
|
||||
const model = { providerID: "openai", modelID: "gpt-5.5" }
|
||||
const parts = [reason, finish(model)]
|
||||
|
||||
Reference in New Issue
Block a user