fix(providers): enabled append-only auto for xiaomi

Centralized append-only context auto-mode resolution so SDK sessions, interactive sessions, and the status display use the same provider checks. Auto mode now enables for Xiaomi/SGLang hosts and explicit stored-request compat signals while preserving DeepSeek behavior.

Added focused regression coverage for Xiaomi Token Plan SGLang HiCache endpoints and explicit on/off behavior.

Fixes #1851
This commit is contained in:
roboomp
2026-06-04 11:59:47 +00:00
parent f6fca1f5cd
commit 15d4d7fcf9
7 changed files with 95 additions and 25 deletions
@@ -13,6 +13,7 @@ import {
import { Loader, Markdown, padding, Spacer, Text, visibleWidth } from "@oh-my-pi/pi-tui";
import { formatDuration, Snowflake } from "@oh-my-pi/pi-utils";
import { $ } from "bun";
import { shouldEnableAppendOnlyContext } from "../../config/append-only-context-mode";
import { loadCustomShare } from "../../export/custom-share";
import type { CompactOptions } from "../../extensibility/extensions/types";
import {
@@ -397,10 +398,10 @@ export class CommandController {
// Append-only context
{
const setting = this.ctx.settings.get("provider.appendOnlyContext") ?? "auto";
const provider = this.ctx.session.model?.provider;
const mode = setting === "on" ? true : setting === "off" ? false : provider === "deepseek";
const model = this.ctx.session.model;
const mode = shouldEnableAppendOnlyContext(setting, model);
const activeLabel = mode ? theme.fg("success", "active") : theme.fg("dim", "inactive");
const settingLabel = setting === "auto" ? `${setting} (${provider ?? "?"})` : setting;
const settingLabel = setting === "auto" ? `${setting} (${model?.provider ?? "?"})` : setting;
info += `${theme.fg("dim", "Append-Only:")} ${activeLabel} (setting: ${settingLabel})\n`;
}
info += `${theme.bold("Tokens")}\n`;