Files
Bingxi Zhao (Frank) ce7c2dc2dc release: v1.6.1 — one key, one navigator, one sidebar you arrange
Model configuration was one layer replicated seven times: every service
stored its own profile with its own credentials, so a single OpenRouter
key had to be pasted into five separate pages. This release splits that
in two — a **connection** holds one vendor credential and links it down
to every service that vendor can serve, and a **task model** takes the
calls nobody asks for (naming a conversation, writing the composer's
starting points) off the model picked for actual reasoning. Both are
opt-in; existing per-service profiles resolve exactly as before.

Around that: Settings drops the card grid for a persistent searchable
navigator whose landing page answers "what state am I in" instead of
repeating the directory; Mastery Path files study conversations under
their topic and opens them in the tutor rather than dropping them on
/home; the sidebar folds features into More and reorders by drag; the
reading companion is rebuilt from /home's own chat components; and the
LightRAG engine talks to the SDK directly, so its extra no longer drags
MinerU in transitively.

Also back-merges PR #1041 (Anthropic SDK 1.x temperature via extra_body)
and PR #741 (owner-only auth secret/token files), which had been merged
straight into main and never flowed back to dev.

Release notes: assets/releases/ver1-6-1.md
Gates: pre-commit 15/15, ruff clean, pytest 5802 passed, web 450 node
tests, eslint 0 errors, docs build clean.
2026-08-30 13:19:42 +08:00

75 lines
2.2 KiB
TypeScript

/** Shared presentation helpers for the Mastery Path dashboard. */
/** The `t` from `useTranslation()`, narrowed to what these helpers need. */
export type Translate = (key: string) => string;
const KNOWLEDGE_TYPE_LABELS: Record<string, string> = {
concept: "Concept",
memory: "Memory",
procedure: "Procedure",
design: "Design",
};
export function knowledgeTypeLabel(type: string, t: Translate): string {
const label = KNOWLEDGE_TYPE_LABELS[type];
return label ? t(label) : type;
}
/**
* Older paths did not require a human-readable title and sometimes stored the
* generated path id as the name. Keep a short trace suffix without exposing a
* database-shaped identifier as the primary label.
*/
export function topicDisplayName(
topic: { name: string; path_id: string },
t: Translate,
): string {
const name = topic.name.trim();
if (
name &&
name !== topic.path_id &&
!/^unified_\d+_[a-z0-9]+$/i.test(name)
) {
return name;
}
const suffix = topic.path_id.split("_").at(-1)?.slice(-4) || "map";
return `${t("Exploration trail")} · ${suffix}`;
}
const MINUTE = 60;
const HOUR = 60 * MINUTE;
const DAY = 24 * HOUR;
/**
* "3 分钟前" / "in 2 days" — engine timestamps are epoch seconds and can point
* either way (an attempt happened, a review is due).
*/
export function formatRelative(epochSeconds: number, zh: boolean): string {
const deltaSeconds = epochSeconds - Date.now() / 1000;
const past = deltaSeconds < 0;
const abs = Math.abs(deltaSeconds);
const [value, unit]: [number, Intl.RelativeTimeFormatUnit] =
abs < MINUTE
? [Math.round(abs), "second"]
: abs < HOUR
? [Math.round(abs / MINUTE), "minute"]
: abs < DAY
? [Math.round(abs / HOUR), "hour"]
: [Math.round(abs / DAY), "day"];
return new Intl.RelativeTimeFormat(zh ? "zh-CN" : "en", {
numeric: "auto",
}).format(past ? -value : value, unit);
}
/** Calendar form, for when "in 3 days" is not precise enough. */
export function formatAbsolute(epochSeconds: number, zh: boolean): string {
return new Date(epochSeconds * 1000).toLocaleString(zh ? "zh-CN" : "en", {
month: "short",
day: "numeric",
hour: "2-digit",
minute: "2-digit",
});
}