mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 06:19:43 +08:00
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.
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
/**
|
|
* Placement for a menu that hangs off a row inside a narrow, scrolling panel.
|
|
*
|
|
* The sidebar is ~220px wide and its lists scroll, so a menu anchored to a row
|
|
* has to escape the panel horizontally and flip vertically near the bottom of
|
|
* the window. Callers render it in a portal at these fixed coordinates.
|
|
*/
|
|
|
|
export interface FloatingMenuPosition {
|
|
left: number;
|
|
top: number;
|
|
maxHeight: number;
|
|
openUpward: boolean;
|
|
}
|
|
|
|
const MENU_GAP = 8;
|
|
const VIEWPORT_MARGIN = 12;
|
|
const MAX_MENU_HEIGHT = 380;
|
|
|
|
export function placeMenu(
|
|
anchor: DOMRect,
|
|
menuWidth: number,
|
|
): FloatingMenuPosition {
|
|
const viewportWidth = window.innerWidth;
|
|
const viewportHeight = window.innerHeight;
|
|
const preferredHeight = Math.min(
|
|
MAX_MENU_HEIGHT,
|
|
viewportHeight - VIEWPORT_MARGIN * 2,
|
|
);
|
|
const roomBelow = viewportHeight - anchor.bottom - MENU_GAP - VIEWPORT_MARGIN;
|
|
const roomAbove = anchor.top - MENU_GAP - VIEWPORT_MARGIN;
|
|
const openUpward = roomBelow < preferredHeight && roomAbove > roomBelow;
|
|
const maxHeight = Math.max(
|
|
140,
|
|
Math.min(preferredHeight, openUpward ? roomAbove : roomBelow),
|
|
);
|
|
|
|
const roomRight = viewportWidth - anchor.right - MENU_GAP - VIEWPORT_MARGIN;
|
|
const roomLeft = anchor.left - MENU_GAP - VIEWPORT_MARGIN;
|
|
const preferredLeft =
|
|
roomRight >= menuWidth || roomRight >= roomLeft
|
|
? anchor.right + MENU_GAP
|
|
: anchor.left - menuWidth - MENU_GAP;
|
|
const left = Math.max(
|
|
VIEWPORT_MARGIN,
|
|
Math.min(preferredLeft, viewportWidth - menuWidth - VIEWPORT_MARGIN),
|
|
);
|
|
const top = openUpward ? anchor.top - MENU_GAP : anchor.bottom + MENU_GAP;
|
|
|
|
return { left, top, maxHeight, openUpward };
|
|
}
|