mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
fix(panel): replace native width input, fix select menu open reflow, and gate context window settings behind risk consent
- Replace native <input type="number"> in popover width settings with CustomNumberInput stepper and hide native number spinbuttons globally - Eliminate single/multi-select option reflow on open by removing scale(0.985) GPU layer teardown in anim-popover-in, floating .scrollbar-rail without flex width squeeze, and reconciling options before unhiding .select-menu - Gate Model Context Settings behind a persistent risk consent mask (contextWindowRiskAccepted, default false and re-locked on factory reset)
This commit is contained in:
+120
-34
@@ -759,6 +759,9 @@ const I18N_MESSAGES_ZH_CN = Object.freeze({
|
|||||||
'settings.oth.orchCompact': '精简代号 (如 orchestrator-argon)',
|
'settings.oth.orchCompact': '精简代号 (如 orchestrator-argon)',
|
||||||
'settings.oth.orchFull': '原始完整 ID (如 gemini-pro-orchestrator)',
|
'settings.oth.orchFull': '原始完整 ID (如 gemini-pro-orchestrator)',
|
||||||
'settings.oth.baselineTitle': '模型上下文设置',
|
'settings.oth.baselineTitle': '模型上下文设置',
|
||||||
|
'settings.oth.ctxRiskTitle': '非官方能力风险提示',
|
||||||
|
'settings.oth.ctxRiskBody': 'Google 官方并未授权在 Antigravity App / IDE 中修改模型上下文上限。擅自修改可能导致 Antigravity 或 GCP 服务被禁用,甚至触发账号封禁;启用该功能即默认由你自行承担全部风险。你最好清楚自己在做什么!',
|
||||||
|
'settings.oth.ctxRiskAcceptBtn': '我已知晓风险,继续使用',
|
||||||
'settings.oth.ctxModel': '模型',
|
'settings.oth.ctxModel': '模型',
|
||||||
'settings.oth.ctxBaselineLabel': '上下文窗口上限',
|
'settings.oth.ctxBaselineLabel': '上下文窗口上限',
|
||||||
'settings.oth.ctxChooseModel': '选择模型',
|
'settings.oth.ctxChooseModel': '选择模型',
|
||||||
@@ -1280,6 +1283,9 @@ const I18N_MESSAGES_EN_US = Object.freeze({
|
|||||||
'settings.oth.orchCompact': 'Compact Alias (e.g. orchestrator-argon)',
|
'settings.oth.orchCompact': 'Compact Alias (e.g. orchestrator-argon)',
|
||||||
'settings.oth.orchFull': 'Full Upstream ID (e.g. gemini-pro-orchestrator)',
|
'settings.oth.orchFull': 'Full Upstream ID (e.g. gemini-pro-orchestrator)',
|
||||||
'settings.oth.baselineTitle': 'Model Context Settings',
|
'settings.oth.baselineTitle': 'Model Context Settings',
|
||||||
|
'settings.oth.ctxRiskTitle': 'Unofficial Override Risk Warning',
|
||||||
|
'settings.oth.ctxRiskBody': 'Google has not authorized modifying model context limits in Antigravity App / IDE. Altering context limits may get your Antigravity access, GCP services, or Google account disabled or banned; enabling this feature means you assume all associated risks. Make sure you know what you are doing!',
|
||||||
|
'settings.oth.ctxRiskAcceptBtn': 'I Understand the Risk, Unlock',
|
||||||
'settings.oth.ctxModel': 'Model',
|
'settings.oth.ctxModel': 'Model',
|
||||||
'settings.oth.ctxBaselineLabel': 'Context Window Limit',
|
'settings.oth.ctxBaselineLabel': 'Context Window Limit',
|
||||||
'settings.oth.ctxChooseModel': 'Choose a model',
|
'settings.oth.ctxChooseModel': 'Choose a model',
|
||||||
@@ -2978,6 +2984,9 @@ function isEquivalentTelemetry(prev, next) {
|
|||||||
if ((pSet?.language ?? 'zh-CN') !== (nSet?.language ?? 'zh-CN')) return false;
|
if ((pSet?.language ?? 'zh-CN') !== (nSet?.language ?? 'zh-CN')) return false;
|
||||||
if ((pSet?.themeAccent ?? 'host') !== (nSet?.themeAccent ?? 'host')) return false;
|
if ((pSet?.themeAccent ?? 'host') !== (nSet?.themeAccent ?? 'host')) return false;
|
||||||
if ((pSet?.fontScale ?? 'md') !== (nSet?.fontScale ?? 'md')) return false;
|
if ((pSet?.fontScale ?? 'md') !== (nSet?.fontScale ?? 'md')) return false;
|
||||||
|
if (Boolean(pSet?.contextWindowRiskAccepted) !== Boolean(nSet?.contextWindowRiskAccepted)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
JSON.stringify(pSet?.modelContextWindows) !== JSON.stringify(nSet?.modelContextWindows) ||
|
JSON.stringify(pSet?.modelContextWindows) !== JSON.stringify(nSet?.modelContextWindows) ||
|
||||||
JSON.stringify(prev.contextWindowModels) !== JSON.stringify(next.contextWindowModels)
|
JSON.stringify(prev.contextWindowModels) !== JSON.stringify(next.contextWindowModels)
|
||||||
@@ -3727,6 +3736,9 @@ async function saveSettingsPatch(patch) {
|
|||||||
if (Object.prototype.hasOwnProperty.call(safePatch, 'popoverWidth')) {
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'popoverWidth')) {
|
||||||
safePatch.popoverWidth = normalizeClientPopoverWidth(safePatch.popoverWidth);
|
safePatch.popoverWidth = normalizeClientPopoverWidth(safePatch.popoverWidth);
|
||||||
}
|
}
|
||||||
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'contextWindowRiskAccepted')) {
|
||||||
|
safePatch.contextWindowRiskAccepted = Boolean(safePatch.contextWindowRiskAccepted);
|
||||||
|
}
|
||||||
if (Object.prototype.hasOwnProperty.call(safePatch, 'orchestratorIdMode')) {
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'orchestratorIdMode')) {
|
||||||
safePatch.orchestratorIdMode = normalizeClientOrchestratorIdMode(safePatch.orchestratorIdMode);
|
safePatch.orchestratorIdMode = normalizeClientOrchestratorIdMode(safePatch.orchestratorIdMode);
|
||||||
}
|
}
|
||||||
@@ -4232,10 +4244,6 @@ const CustomSelect = defineComponent({
|
|||||||
|
|
||||||
function toggleOpen(nextOpen) {
|
function toggleOpen(nextOpen) {
|
||||||
isOpen = Boolean(nextOpen);
|
isOpen = Boolean(nextOpen);
|
||||||
patchClasses(rootEl, { 'is-open': isOpen });
|
|
||||||
patchAttr(triggerBtn, 'aria-expanded', isOpen ? 'true' : 'false');
|
|
||||||
patchAttr(menuEl, 'hidden', !isOpen);
|
|
||||||
patchSvgIcon(chevronIcon, isOpen ? 'chevron-up' : 'chevron-down');
|
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
const opts = getProps().options || [];
|
const opts = getProps().options || [];
|
||||||
const selSet = getSelectedSet();
|
const selSet = getSelectedSet();
|
||||||
@@ -4245,6 +4253,10 @@ const CustomSelect = defineComponent({
|
|||||||
);
|
);
|
||||||
renderMenuOptions();
|
renderMenuOptions();
|
||||||
}
|
}
|
||||||
|
patchClasses(rootEl, { 'is-open': isOpen });
|
||||||
|
patchAttr(triggerBtn, 'aria-expanded', isOpen ? 'true' : 'false');
|
||||||
|
patchAttr(menuEl, 'hidden', !isOpen);
|
||||||
|
patchSvgIcon(chevronIcon, isOpen ? 'chevron-up' : 'chevron-down');
|
||||||
}
|
}
|
||||||
|
|
||||||
function chooseOption(option) {
|
function chooseOption(option) {
|
||||||
@@ -4539,6 +4551,7 @@ const CustomNumberInput = defineComponent({
|
|||||||
commitManualInput();
|
commitManualInput();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onChange: () => commitManualInput(),
|
||||||
onBlur: () => commitManualInput(),
|
onBlur: () => commitManualInput(),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -4564,12 +4577,13 @@ const CustomNumberInput = defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function syncFieldDisplay(val = getProps().modelValue) {
|
function syncFieldDisplay(val = getProps().modelValue) {
|
||||||
const { min, max } = getProps();
|
const { min, max, ariaLabel } = getProps();
|
||||||
const normalized = clampValue(val);
|
const normalized = clampValue(val);
|
||||||
if (textField.value !== String(normalized)) {
|
if (textField.value !== String(normalized)) {
|
||||||
textField.value = String(normalized);
|
textField.value = String(normalized);
|
||||||
}
|
}
|
||||||
patchAttr(textField, 'aria-valuenow', normalized);
|
patchAttr(textField, 'aria-valuenow', normalized);
|
||||||
|
if (ariaLabel) patchAttr(textField, 'aria-label', ariaLabel);
|
||||||
if (Number.isFinite(min)) patchAttr(textField, 'aria-valuemin', min);
|
if (Number.isFinite(min)) patchAttr(textField, 'aria-valuemin', min);
|
||||||
if (Number.isFinite(max)) patchAttr(textField, 'aria-valuemax', max);
|
if (Number.isFinite(max)) patchAttr(textField, 'aria-valuemax', max);
|
||||||
}
|
}
|
||||||
@@ -13563,18 +13577,15 @@ const SettingsStructureTab = defineComponent({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const popoverWidthInput = h('input', {
|
const popoverWidthStepper = CustomNumberInput({
|
||||||
type: 'number',
|
modelValue: draftPopoverWidth,
|
||||||
className: 'settings-text-input',
|
min: MIN_CLIENT_POPOVER_WIDTH,
|
||||||
min: String(MIN_CLIENT_POPOVER_WIDTH),
|
max: MAX_CLIENT_POPOVER_WIDTH,
|
||||||
max: String(MAX_CLIENT_POPOVER_WIDTH),
|
step: 10,
|
||||||
step: '10',
|
ariaLabel: t('settings.str.popoverWidthLabel'),
|
||||||
value: String(draftPopoverWidth),
|
onUpdateModelValue: (val) => {
|
||||||
'aria-label': t('settings.str.popoverWidthLabel'),
|
const nextWidth = normalizeClientPopoverWidth(val);
|
||||||
onChange: () => {
|
|
||||||
const nextWidth = normalizeClientPopoverWidth(popoverWidthInput.value);
|
|
||||||
draftPopoverWidth = nextWidth;
|
draftPopoverWidth = nextWidth;
|
||||||
popoverWidthInput.value = String(nextWidth);
|
|
||||||
syncMountSectionMeta();
|
syncMountSectionMeta();
|
||||||
props.onLayoutChange?.();
|
props.onLayoutChange?.();
|
||||||
void persistStructurePatch(mountSection, {
|
void persistStructurePatch(mountSection, {
|
||||||
@@ -13582,18 +13593,12 @@ const SettingsStructureTab = defineComponent({
|
|||||||
popoverWidth: draftPopoverWidth,
|
popoverWidth: draftPopoverWidth,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onKeydown: (e) => {
|
|
||||||
if (e?.key === 'Enter') {
|
|
||||||
e.preventDefault();
|
|
||||||
popoverWidthInput.blur();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const popoverWidthNumWrap = h(
|
const popoverWidthNumWrap = h(
|
||||||
'span',
|
'span',
|
||||||
{ className: 'settings-number-wrap', hidden: draftPopoverWidthMode !== 'custom' },
|
{ className: 'settings-number-wrap', hidden: draftPopoverWidthMode !== 'custom' },
|
||||||
[popoverWidthInput, h('span', { className: 'settings-number-unit', text: 'px' })]
|
[popoverWidthStepper.el, h('span', { className: 'settings-number-unit', text: 'px' })]
|
||||||
);
|
);
|
||||||
|
|
||||||
const popoverWidthModeToggle = SegmentedControl({
|
const popoverWidthModeToggle = SegmentedControl({
|
||||||
@@ -13666,7 +13671,7 @@ const SettingsStructureTab = defineComponent({
|
|||||||
draftWindowMountMode = 'dual';
|
draftWindowMountMode = 'dual';
|
||||||
draftPopoverWidthMode = 'auto';
|
draftPopoverWidthMode = 'auto';
|
||||||
draftPopoverWidth = DEFAULT_CLIENT_POPOVER_WIDTH;
|
draftPopoverWidth = DEFAULT_CLIENT_POPOVER_WIDTH;
|
||||||
popoverWidthInput.value = String(DEFAULT_CLIENT_POPOVER_WIDTH);
|
popoverWidthStepper.setProps({ modelValue: DEFAULT_CLIENT_POPOVER_WIDTH });
|
||||||
draftEnableCliStatusLine = true;
|
draftEnableCliStatusLine = true;
|
||||||
draftShowTopbarMulti = true;
|
draftShowTopbarMulti = true;
|
||||||
draftTopbarSlots = [...DEFAULT_CLIENT_TOPBAR_SLOTS];
|
draftTopbarSlots = [...DEFAULT_CLIENT_TOPBAR_SLOTS];
|
||||||
@@ -13727,8 +13732,11 @@ const SettingsStructureTab = defineComponent({
|
|||||||
options: getPopoverWidthModeOptions(),
|
options: getPopoverWidthModeOptions(),
|
||||||
});
|
});
|
||||||
patchAttr(popoverWidthNumWrap, 'hidden', draftPopoverWidthMode !== 'custom');
|
patchAttr(popoverWidthNumWrap, 'hidden', draftPopoverWidthMode !== 'custom');
|
||||||
if (document?.activeElement !== popoverWidthInput) {
|
if (document?.activeElement !== popoverWidthStepper.refs.textField) {
|
||||||
popoverWidthInput.value = String(draftPopoverWidth);
|
popoverWidthStepper.setProps({
|
||||||
|
modelValue: draftPopoverWidth,
|
||||||
|
ariaLabel: t('settings.str.popoverWidthLabel'),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
multiSessionToggle.setProps({
|
multiSessionToggle.setProps({
|
||||||
modelValue: draftShowTopbarMulti ? 'show' : 'hide',
|
modelValue: draftShowTopbarMulti ? 'show' : 'hide',
|
||||||
@@ -14349,7 +14357,7 @@ const SettingsStructureTab = defineComponent({
|
|||||||
patchText(mountModeLabelEl, t('settings.str.mountMode'));
|
patchText(mountModeLabelEl, t('settings.str.mountMode'));
|
||||||
patchText(popoverWidthLabelEl, t('settings.str.popoverWidthLabel'));
|
patchText(popoverWidthLabelEl, t('settings.str.popoverWidthLabel'));
|
||||||
patchText(popoverWidthHintEl, t('settings.str.popoverWidthHint'));
|
patchText(popoverWidthHintEl, t('settings.str.popoverWidthHint'));
|
||||||
patchAttr(popoverWidthInput, 'aria-label', t('settings.str.popoverWidthLabel'));
|
popoverWidthStepper.setProps({ ariaLabel: t('settings.str.popoverWidthLabel') });
|
||||||
patchText(multiToggleLabelEl, t('settings.str.multiToggle'));
|
patchText(multiToggleLabelEl, t('settings.str.multiToggle'));
|
||||||
patchText(cliCapsuleLabelEl, t('settings.str.cliCapsuleToggle'));
|
patchText(cliCapsuleLabelEl, t('settings.str.cliCapsuleToggle'));
|
||||||
patchText(capsuleSlotsLabelEl, t('settings.str.capsuleSlotsLabel'));
|
patchText(capsuleSlotsLabelEl, t('settings.str.capsuleSlotsLabel'));
|
||||||
@@ -14417,6 +14425,7 @@ const SettingsStructureTab = defineComponent({
|
|||||||
overviewPreviewHost.destroy();
|
overviewPreviewHost.destroy();
|
||||||
stepTablePreview.destroy();
|
stepTablePreview.destroy();
|
||||||
windowMountSelect.destroy();
|
windowMountSelect.destroy();
|
||||||
|
popoverWidthStepper.destroy();
|
||||||
popoverWidthModeToggle.destroy();
|
popoverWidthModeToggle.destroy();
|
||||||
multiSessionToggle.destroy();
|
multiSessionToggle.destroy();
|
||||||
cliCapsuleToggle.destroy();
|
cliCapsuleToggle.destroy();
|
||||||
@@ -14724,6 +14733,8 @@ const SettingsOtherTab = defineComponent({
|
|||||||
setup({ onCleanup, getProps }) {
|
setup({ onCleanup, getProps }) {
|
||||||
let draftModelDisplayMode = 'short';
|
let draftModelDisplayMode = 'short';
|
||||||
let draftOrchestratorIdMode = 'compact';
|
let draftOrchestratorIdMode = 'compact';
|
||||||
|
let draftContextRiskAccepted = false;
|
||||||
|
let acceptingContextRisk = false;
|
||||||
let latestSettings = null;
|
let latestSettings = null;
|
||||||
let contextWindowModels = [];
|
let contextWindowModels = [];
|
||||||
let contextModelId = '';
|
let contextModelId = '';
|
||||||
@@ -14849,7 +14860,7 @@ const SettingsOtherTab = defineComponent({
|
|||||||
className: 'settings-context-model',
|
className: 'settings-context-model',
|
||||||
options: [],
|
options: [],
|
||||||
onUpdateModelValue: (id) => {
|
onUpdateModelValue: (id) => {
|
||||||
if (savingContextWindow) return;
|
if (!draftContextRiskAccepted || savingContextWindow) return;
|
||||||
contextModelId = id;
|
contextModelId = id;
|
||||||
contextFeedback = '';
|
contextFeedback = '';
|
||||||
renderContextWindows();
|
renderContextWindows();
|
||||||
@@ -14858,7 +14869,7 @@ const SettingsOtherTab = defineComponent({
|
|||||||
const ctxWindowSelect = CustomSelect({
|
const ctxWindowSelect = CustomSelect({
|
||||||
options: [],
|
options: [],
|
||||||
onUpdateModelValue: async (value) => {
|
onUpdateModelValue: async (value) => {
|
||||||
if (savingContextWindow || !contextModelId) return;
|
if (!draftContextRiskAccepted || savingContextWindow || !contextModelId) return;
|
||||||
savingContextWindow = true;
|
savingContextWindow = true;
|
||||||
contextFeedback = 'settings.saving';
|
contextFeedback = 'settings.saving';
|
||||||
renderContextWindows();
|
renderContextWindows();
|
||||||
@@ -14876,8 +14887,82 @@ const SettingsOtherTab = defineComponent({
|
|||||||
});
|
});
|
||||||
const ctxModelRow = h('div', { className: 'form-row' }, [ctxModelLabel, ctxModelSelect.el]);
|
const ctxModelRow = h('div', { className: 'form-row' }, [ctxModelLabel, ctxModelSelect.el]);
|
||||||
const ctxWindowRow = h('div', { className: 'form-row' }, [ctxWindowLabel, ctxWindowSelect.el]);
|
const ctxWindowRow = h('div', { className: 'form-row' }, [ctxWindowLabel, ctxWindowSelect.el]);
|
||||||
|
const ctxControlsBody = h('div', { className: 'ctx-controls-body is-locked' }, [
|
||||||
|
ctxModelRow,
|
||||||
|
ctxWindowRow,
|
||||||
|
h('div', { className: 'form-row' }, [ctxHint]),
|
||||||
|
]);
|
||||||
|
|
||||||
|
const ctxRiskTitleEl = h('strong', {
|
||||||
|
className: 'ctx-risk-title',
|
||||||
|
text: t('settings.oth.ctxRiskTitle'),
|
||||||
|
});
|
||||||
|
const ctxRiskBodyEl = h('p', {
|
||||||
|
className: 'ctx-risk-desc',
|
||||||
|
text: t('settings.oth.ctxRiskBody'),
|
||||||
|
});
|
||||||
|
const ctxRiskAcceptBtnText = h('span', { text: t('settings.oth.ctxRiskAcceptBtn') });
|
||||||
|
const ctxRiskAcceptBtn = h(
|
||||||
|
'button',
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
className: 'btn-secondary btn-danger-confirm ctx-risk-accept-btn',
|
||||||
|
onClick: async () => {
|
||||||
|
if (acceptingContextRisk || draftContextRiskAccepted) return;
|
||||||
|
acceptingContextRisk = true;
|
||||||
|
draftContextRiskAccepted = true;
|
||||||
|
latestSettings = { ...(latestSettings || {}), contextWindowRiskAccepted: true };
|
||||||
|
contextFeedback = 'settings.saving';
|
||||||
|
renderContextWindows();
|
||||||
|
try {
|
||||||
|
await saveSettingsPatch({ contextWindowRiskAccepted: true });
|
||||||
|
contextFeedback = 'settings.saved';
|
||||||
|
} catch {
|
||||||
|
draftContextRiskAccepted = false;
|
||||||
|
latestSettings = { ...(latestSettings || {}), contextWindowRiskAccepted: false };
|
||||||
|
contextFeedback = 'settings.saveFailed';
|
||||||
|
} finally {
|
||||||
|
acceptingContextRisk = false;
|
||||||
|
renderContextWindows();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
[createSvgIcon('warning', { size: 12 }), ctxRiskAcceptBtnText]
|
||||||
|
);
|
||||||
|
const ctxRiskMask = h(
|
||||||
|
'div',
|
||||||
|
{
|
||||||
|
className: 'ctx-risk-mask',
|
||||||
|
role: 'region',
|
||||||
|
'aria-label': t('settings.oth.ctxRiskTitle'),
|
||||||
|
},
|
||||||
|
[
|
||||||
|
h('div', { className: 'ctx-risk-head' }, [
|
||||||
|
createSvgIcon('warning', { size: 14, className: 'ctx-risk-icon' }),
|
||||||
|
ctxRiskTitleEl,
|
||||||
|
]),
|
||||||
|
ctxRiskBodyEl,
|
||||||
|
ctxRiskAcceptBtn,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
const ctxRiskStage = h('div', { className: 'ctx-risk-stage' }, [ctxControlsBody, ctxRiskMask]);
|
||||||
|
|
||||||
function renderContextWindows() {
|
function renderContextWindows() {
|
||||||
|
const unlocked = Boolean(draftContextRiskAccepted);
|
||||||
|
if (!unlocked) {
|
||||||
|
ctxModelSelect.close();
|
||||||
|
ctxWindowSelect.close();
|
||||||
|
}
|
||||||
|
patchClasses(ctxControlsBody, { 'is-locked': !unlocked });
|
||||||
|
patchAttr(ctxControlsBody, 'inert', !unlocked);
|
||||||
|
patchAttr(ctxControlsBody, 'aria-hidden', unlocked ? null : 'true');
|
||||||
|
patchAttr(ctxRiskMask, 'hidden', unlocked);
|
||||||
|
patchAttr(ctxRiskMask, 'aria-label', t('settings.oth.ctxRiskTitle'));
|
||||||
|
patchText(ctxRiskTitleEl, t('settings.oth.ctxRiskTitle'));
|
||||||
|
patchText(ctxRiskBodyEl, t('settings.oth.ctxRiskBody'));
|
||||||
|
patchText(ctxRiskAcceptBtnText, t('settings.oth.ctxRiskAcceptBtn'));
|
||||||
|
patchAttr(ctxRiskAcceptBtn, 'disabled', acceptingContextRisk);
|
||||||
|
|
||||||
const saved = latestSettings?.modelContextWindows || {};
|
const saved = latestSettings?.modelContextWindows || {};
|
||||||
const models = new Map(contextWindowModels.map((model) => [model.id, model]));
|
const models = new Map(contextWindowModels.map((model) => [model.id, model]));
|
||||||
const knownIds = new Set(contextWindowModels.flatMap(({ id, members = [] }) => [id, ...members]));
|
const knownIds = new Set(contextWindowModels.flatMap(({ id, members = [] }) => [id, ...members]));
|
||||||
@@ -14936,8 +15021,8 @@ const SettingsOtherTab = defineComponent({
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
ctxWindowSelect.setProps({ modelValue: selected, options: choices });
|
ctxWindowSelect.setProps({ modelValue: selected, options: choices });
|
||||||
patchAttr(ctxModelSelect.refs.triggerBtn, 'disabled', savingContextWindow);
|
patchAttr(ctxModelSelect.refs.triggerBtn, 'disabled', !unlocked || savingContextWindow);
|
||||||
patchAttr(ctxWindowSelect.refs.triggerBtn, 'disabled', savingContextWindow || (!options.length && !selected));
|
patchAttr(ctxWindowSelect.refs.triggerBtn, 'disabled', !unlocked || savingContextWindow || (!options.length && !selected));
|
||||||
patchAttr(ctxModelSelect.refs.triggerBtn, 'aria-label', t('settings.oth.ctxModel'));
|
patchAttr(ctxModelSelect.refs.triggerBtn, 'aria-label', t('settings.oth.ctxModel'));
|
||||||
patchAttr(ctxWindowSelect.refs.triggerBtn, 'aria-label', t('settings.oth.ctxBaselineLabel'));
|
patchAttr(ctxWindowSelect.refs.triggerBtn, 'aria-label', t('settings.oth.ctxBaselineLabel'));
|
||||||
patchAttr(ctxModelRow, 'hidden', !models.size);
|
patchAttr(ctxModelRow, 'hidden', !models.size);
|
||||||
@@ -14961,9 +15046,7 @@ const SettingsOtherTab = defineComponent({
|
|||||||
]),
|
]),
|
||||||
ctxStatus,
|
ctxStatus,
|
||||||
]),
|
]),
|
||||||
ctxModelRow,
|
ctxRiskStage,
|
||||||
ctxWindowRow,
|
|
||||||
h('div', { className: 'form-row' }, [ctxHint]),
|
|
||||||
]);
|
]);
|
||||||
renderContextWindows();
|
renderContextWindows();
|
||||||
|
|
||||||
@@ -15104,6 +15187,9 @@ const SettingsOtherTab = defineComponent({
|
|||||||
settings.showUpstreamModel
|
settings.showUpstreamModel
|
||||||
);
|
);
|
||||||
draftOrchestratorIdMode = normalizeClientOrchestratorIdMode(settings.orchestratorIdMode);
|
draftOrchestratorIdMode = normalizeClientOrchestratorIdMode(settings.orchestratorIdMode);
|
||||||
|
if (!acceptingContextRisk) {
|
||||||
|
draftContextRiskAccepted = Boolean(settings.contextWindowRiskAccepted);
|
||||||
|
}
|
||||||
stepModelSelect.setProps({
|
stepModelSelect.setProps({
|
||||||
modelValue: draftModelDisplayMode,
|
modelValue: draftModelDisplayMode,
|
||||||
options: getStepModelDisplayOptions(),
|
options: getStepModelDisplayOptions(),
|
||||||
|
|||||||
@@ -508,6 +508,7 @@ export const DEFAULT_SETTINGS_SCHEMA = Object.freeze({
|
|||||||
showStepSpeedColor: false,
|
showStepSpeedColor: false,
|
||||||
stepTokenComboFormat: DEFAULT_STEP_TOKEN_COMBO_FORMAT,
|
stepTokenComboFormat: DEFAULT_STEP_TOKEN_COMBO_FORMAT,
|
||||||
stepTableColumns: DEFAULT_STEP_TABLE_COLUMNS,
|
stepTableColumns: DEFAULT_STEP_TABLE_COLUMNS,
|
||||||
|
contextWindowRiskAccepted: false,
|
||||||
modelContextWindows: Object.freeze({}),
|
modelContextWindows: Object.freeze({}),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -543,6 +544,7 @@ export function createDefaultSettingsObject() {
|
|||||||
showStepSpeedColor: DEFAULT_SETTINGS_SCHEMA.showStepSpeedColor,
|
showStepSpeedColor: DEFAULT_SETTINGS_SCHEMA.showStepSpeedColor,
|
||||||
stepTokenComboFormat: DEFAULT_SETTINGS_SCHEMA.stepTokenComboFormat,
|
stepTokenComboFormat: DEFAULT_SETTINGS_SCHEMA.stepTokenComboFormat,
|
||||||
stepTableColumns: [...DEFAULT_STEP_TABLE_COLUMNS],
|
stepTableColumns: [...DEFAULT_STEP_TABLE_COLUMNS],
|
||||||
|
contextWindowRiskAccepted: DEFAULT_SETTINGS_SCHEMA.contextWindowRiskAccepted,
|
||||||
modelContextWindows: {},
|
modelContextWindows: {},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -600,6 +602,7 @@ export function normalizeFullSettings(rawInput) {
|
|||||||
showStepSpeedColor: safeRaw.showStepSpeedColor === true,
|
showStepSpeedColor: safeRaw.showStepSpeedColor === true,
|
||||||
stepTokenComboFormat: normalizeStepTokenComboFormat(safeRaw.stepTokenComboFormat),
|
stepTokenComboFormat: normalizeStepTokenComboFormat(safeRaw.stepTokenComboFormat),
|
||||||
stepTableColumns: normalizeStepTableColumns(safeRaw.stepTableColumns),
|
stepTableColumns: normalizeStepTableColumns(safeRaw.stepTableColumns),
|
||||||
|
contextWindowRiskAccepted: safeRaw.contextWindowRiskAccepted === true,
|
||||||
modelContextWindows: normalizeModelContextWindows(safeRaw.modelContextWindows),
|
modelContextWindows: normalizeModelContextWindows(safeRaw.modelContextWindows),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>用量监控</title>
|
<title>用量监控</title>
|
||||||
<link rel="stylesheet" href="/styles.css?v=1794815058602">
|
<link rel="stylesheet" href="/styles.css?v=1794819376795">
|
||||||
<script src="/preload.js"></script>
|
<script src="/preload.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app-root"></div>
|
<div id="app-root"></div>
|
||||||
<script src="/app.js?v=1794815058602"></script>
|
<script src="/app.js?v=1794819376795"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ export const CustomNumberInput = defineComponent({
|
|||||||
commitManualInput();
|
commitManualInput();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onChange: () => commitManualInput(),
|
||||||
onBlur: () => commitManualInput(),
|
onBlur: () => commitManualInput(),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -102,12 +103,13 @@ export const CustomNumberInput = defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function syncFieldDisplay(val = getProps().modelValue) {
|
function syncFieldDisplay(val = getProps().modelValue) {
|
||||||
const { min, max } = getProps();
|
const { min, max, ariaLabel } = getProps();
|
||||||
const normalized = clampValue(val);
|
const normalized = clampValue(val);
|
||||||
if (textField.value !== String(normalized)) {
|
if (textField.value !== String(normalized)) {
|
||||||
textField.value = String(normalized);
|
textField.value = String(normalized);
|
||||||
}
|
}
|
||||||
patchAttr(textField, 'aria-valuenow', normalized);
|
patchAttr(textField, 'aria-valuenow', normalized);
|
||||||
|
if (ariaLabel) patchAttr(textField, 'aria-label', ariaLabel);
|
||||||
if (Number.isFinite(min)) patchAttr(textField, 'aria-valuemin', min);
|
if (Number.isFinite(min)) patchAttr(textField, 'aria-valuemin', min);
|
||||||
if (Number.isFinite(max)) patchAttr(textField, 'aria-valuemax', max);
|
if (Number.isFinite(max)) patchAttr(textField, 'aria-valuemax', max);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,10 +104,6 @@ export const CustomSelect = defineComponent({
|
|||||||
|
|
||||||
function toggleOpen(nextOpen) {
|
function toggleOpen(nextOpen) {
|
||||||
isOpen = Boolean(nextOpen);
|
isOpen = Boolean(nextOpen);
|
||||||
patchClasses(rootEl, { 'is-open': isOpen });
|
|
||||||
patchAttr(triggerBtn, 'aria-expanded', isOpen ? 'true' : 'false');
|
|
||||||
patchAttr(menuEl, 'hidden', !isOpen);
|
|
||||||
patchSvgIcon(chevronIcon, isOpen ? 'chevron-up' : 'chevron-down');
|
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
const opts = getProps().options || [];
|
const opts = getProps().options || [];
|
||||||
const selSet = getSelectedSet();
|
const selSet = getSelectedSet();
|
||||||
@@ -117,6 +113,10 @@ export const CustomSelect = defineComponent({
|
|||||||
);
|
);
|
||||||
renderMenuOptions();
|
renderMenuOptions();
|
||||||
}
|
}
|
||||||
|
patchClasses(rootEl, { 'is-open': isOpen });
|
||||||
|
patchAttr(triggerBtn, 'aria-expanded', isOpen ? 'true' : 'false');
|
||||||
|
patchAttr(menuEl, 'hidden', !isOpen);
|
||||||
|
patchSvgIcon(chevronIcon, isOpen ? 'chevron-up' : 'chevron-down');
|
||||||
}
|
}
|
||||||
|
|
||||||
function chooseOption(option) {
|
function chooseOption(option) {
|
||||||
|
|||||||
@@ -487,6 +487,9 @@ export const I18N_MESSAGES_EN_US = Object.freeze({
|
|||||||
'settings.oth.orchCompact': 'Compact Alias (e.g. orchestrator-argon)',
|
'settings.oth.orchCompact': 'Compact Alias (e.g. orchestrator-argon)',
|
||||||
'settings.oth.orchFull': 'Full Upstream ID (e.g. gemini-pro-orchestrator)',
|
'settings.oth.orchFull': 'Full Upstream ID (e.g. gemini-pro-orchestrator)',
|
||||||
'settings.oth.baselineTitle': 'Model Context Settings',
|
'settings.oth.baselineTitle': 'Model Context Settings',
|
||||||
|
'settings.oth.ctxRiskTitle': 'Unofficial Override Risk Warning',
|
||||||
|
'settings.oth.ctxRiskBody': 'Google has not authorized modifying model context limits in Antigravity App / IDE. Altering context limits may get your Antigravity access, GCP services, or Google account disabled or banned; enabling this feature means you assume all associated risks. Make sure you know what you are doing!',
|
||||||
|
'settings.oth.ctxRiskAcceptBtn': 'I Understand the Risk, Unlock',
|
||||||
'settings.oth.ctxModel': 'Model',
|
'settings.oth.ctxModel': 'Model',
|
||||||
'settings.oth.ctxBaselineLabel': 'Context Window Limit',
|
'settings.oth.ctxBaselineLabel': 'Context Window Limit',
|
||||||
'settings.oth.ctxChooseModel': 'Choose a model',
|
'settings.oth.ctxChooseModel': 'Choose a model',
|
||||||
|
|||||||
@@ -487,6 +487,9 @@ export const I18N_MESSAGES_ZH_CN = Object.freeze({
|
|||||||
'settings.oth.orchCompact': '精简代号 (如 orchestrator-argon)',
|
'settings.oth.orchCompact': '精简代号 (如 orchestrator-argon)',
|
||||||
'settings.oth.orchFull': '原始完整 ID (如 gemini-pro-orchestrator)',
|
'settings.oth.orchFull': '原始完整 ID (如 gemini-pro-orchestrator)',
|
||||||
'settings.oth.baselineTitle': '模型上下文设置',
|
'settings.oth.baselineTitle': '模型上下文设置',
|
||||||
|
'settings.oth.ctxRiskTitle': '非官方能力风险提示',
|
||||||
|
'settings.oth.ctxRiskBody': 'Google 官方并未授权在 Antigravity App / IDE 中修改模型上下文上限。擅自修改可能导致 Antigravity 或 GCP 服务被禁用,甚至触发账号封禁;启用该功能即默认由你自行承担全部风险。你最好清楚自己在做什么!',
|
||||||
|
'settings.oth.ctxRiskAcceptBtn': '我已知晓风险,继续使用',
|
||||||
'settings.oth.ctxModel': '模型',
|
'settings.oth.ctxModel': '模型',
|
||||||
'settings.oth.ctxBaselineLabel': '上下文窗口上限',
|
'settings.oth.ctxBaselineLabel': '上下文窗口上限',
|
||||||
'settings.oth.ctxChooseModel': '选择模型',
|
'settings.oth.ctxChooseModel': '选择模型',
|
||||||
|
|||||||
@@ -441,6 +441,9 @@ function isEquivalentTelemetry(prev, next) {
|
|||||||
if ((pSet?.language ?? 'zh-CN') !== (nSet?.language ?? 'zh-CN')) return false;
|
if ((pSet?.language ?? 'zh-CN') !== (nSet?.language ?? 'zh-CN')) return false;
|
||||||
if ((pSet?.themeAccent ?? 'host') !== (nSet?.themeAccent ?? 'host')) return false;
|
if ((pSet?.themeAccent ?? 'host') !== (nSet?.themeAccent ?? 'host')) return false;
|
||||||
if ((pSet?.fontScale ?? 'md') !== (nSet?.fontScale ?? 'md')) return false;
|
if ((pSet?.fontScale ?? 'md') !== (nSet?.fontScale ?? 'md')) return false;
|
||||||
|
if (Boolean(pSet?.contextWindowRiskAccepted) !== Boolean(nSet?.contextWindowRiskAccepted)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
JSON.stringify(pSet?.modelContextWindows) !== JSON.stringify(nSet?.modelContextWindows) ||
|
JSON.stringify(pSet?.modelContextWindows) !== JSON.stringify(nSet?.modelContextWindows) ||
|
||||||
JSON.stringify(prev.contextWindowModels) !== JSON.stringify(next.contextWindowModels)
|
JSON.stringify(prev.contextWindowModels) !== JSON.stringify(next.contextWindowModels)
|
||||||
@@ -1190,6 +1193,9 @@ export async function saveSettingsPatch(patch) {
|
|||||||
if (Object.prototype.hasOwnProperty.call(safePatch, 'popoverWidth')) {
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'popoverWidth')) {
|
||||||
safePatch.popoverWidth = normalizeClientPopoverWidth(safePatch.popoverWidth);
|
safePatch.popoverWidth = normalizeClientPopoverWidth(safePatch.popoverWidth);
|
||||||
}
|
}
|
||||||
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'contextWindowRiskAccepted')) {
|
||||||
|
safePatch.contextWindowRiskAccepted = Boolean(safePatch.contextWindowRiskAccepted);
|
||||||
|
}
|
||||||
if (Object.prototype.hasOwnProperty.call(safePatch, 'orchestratorIdMode')) {
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'orchestratorIdMode')) {
|
||||||
safePatch.orchestratorIdMode = normalizeClientOrchestratorIdMode(safePatch.orchestratorIdMode);
|
safePatch.orchestratorIdMode = normalizeClientOrchestratorIdMode(safePatch.orchestratorIdMode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,11 +35,9 @@
|
|||||||
@keyframes anim-popover-in {
|
@keyframes anim-popover-in {
|
||||||
from {
|
from {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translate3d(0, -3px, 0) scale(0.985);
|
|
||||||
}
|
}
|
||||||
to {
|
to {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,17 @@ input {
|
|||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input[type="number"] {
|
||||||
|
appearance: textfield;
|
||||||
|
-moz-appearance: textfield;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="number"]::-webkit-inner-spin-button,
|
||||||
|
input[type="number"]::-webkit-outer-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.app-shell {
|
.app-shell {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -263,7 +263,7 @@
|
|||||||
box-shadow: var(--shadow-popover);
|
box-shadow: var(--shadow-popover);
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
z-index: 60;
|
z-index: 60;
|
||||||
animation: anim-popover-in var(--dur-fast) var(--ease-fast);
|
animation: anim-popover-in var(--dur-instant) var(--ease-fast);
|
||||||
}
|
}
|
||||||
|
|
||||||
.select-option {
|
.select-option {
|
||||||
@@ -314,6 +314,7 @@
|
|||||||
font-size: var(--fs-md);
|
font-size: var(--fs-md);
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
font-family: var(--font-mono);
|
font-family: var(--font-mono);
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.select-checkbox {
|
.select-checkbox {
|
||||||
@@ -569,7 +570,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
gap: 5px;
|
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
@@ -578,6 +578,7 @@
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
|
padding-right: 6px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
scrollbar-width: none;
|
scrollbar-width: none;
|
||||||
@@ -591,10 +592,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.scrollbar-rail {
|
.scrollbar-rail {
|
||||||
position: relative;
|
position: absolute;
|
||||||
flex-shrink: 0;
|
top: 2px;
|
||||||
width: 5px;
|
right: 0;
|
||||||
margin: 2px 0;
|
bottom: 2px;
|
||||||
|
width: 4px;
|
||||||
border-radius: var(--radius-pill);
|
border-radius: var(--radius-pill);
|
||||||
background: color-mix(in srgb, var(--border-hairline) 35%, transparent);
|
background: color-mix(in srgb, var(--border-hairline) 35%, transparent);
|
||||||
z-index: 15;
|
z-index: 15;
|
||||||
@@ -610,7 +612,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.scrollbar-rail.is-inactive {
|
.scrollbar-rail.is-inactive {
|
||||||
display: none !important;
|
visibility: hidden;
|
||||||
opacity: 0 !important;
|
opacity: 0 !important;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -737,15 +737,101 @@
|
|||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings-number-wrap .settings-text-input {
|
.settings-number-wrap .number-input {
|
||||||
width: 68px;
|
|
||||||
height: 24px;
|
height: 24px;
|
||||||
padding: 0 6px;
|
background: var(--surface-subtle);
|
||||||
text-align: right;
|
}
|
||||||
font-variant-numeric: tabular-nums;
|
|
||||||
|
.settings-number-wrap .num-step-btn {
|
||||||
|
width: 22px;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-number-wrap .num-field {
|
||||||
|
width: 48px;
|
||||||
|
min-width: 48px;
|
||||||
|
padding: 0 4px;
|
||||||
|
text-align: center;
|
||||||
|
font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
|
||||||
|
font-size: var(--fs-md);
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings-number-unit {
|
.settings-number-unit {
|
||||||
font-size: var(--fs-sm);
|
font-size: var(--fs-sm);
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --- 其他页:模型上下文设置风险警告遮罩 --- */
|
||||||
|
.ctx-risk-stage {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-controls-body {
|
||||||
|
grid-area: 1 / 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--space-3);
|
||||||
|
min-width: 0;
|
||||||
|
transition:
|
||||||
|
filter var(--dur-fast) var(--ease-fast),
|
||||||
|
opacity var(--dur-fast) var(--ease-fast);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-controls-body.is-locked {
|
||||||
|
filter: blur(4px);
|
||||||
|
opacity: 0.24;
|
||||||
|
pointer-events: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-risk-mask {
|
||||||
|
grid-area: 1 / 1;
|
||||||
|
z-index: 5;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: center;
|
||||||
|
gap: var(--space-2);
|
||||||
|
padding: var(--space-3) var(--space-4);
|
||||||
|
border-radius: var(--radius-xs);
|
||||||
|
border: 1px solid color-mix(in srgb, var(--metric-warn) 42%, var(--border-hairline));
|
||||||
|
background: color-mix(in srgb, var(--surface-panel) 88%, var(--metric-warn) 7%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-risk-mask[hidden] {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-risk-head {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
color: var(--metric-warn);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-risk-icon {
|
||||||
|
color: var(--metric-warn);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-risk-title {
|
||||||
|
font-size: var(--fs-base);
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--metric-warn);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-risk-desc {
|
||||||
|
margin: 0;
|
||||||
|
font-size: var(--fs-sm);
|
||||||
|
line-height: 1.5;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-risk-accept-btn {
|
||||||
|
margin-top: 2px;
|
||||||
|
height: 26px;
|
||||||
|
padding: 0 var(--space-3);
|
||||||
|
font-size: var(--fs-md);
|
||||||
|
}
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ export const SettingsOtherTab = defineComponent({
|
|||||||
setup({ onCleanup, getProps }) {
|
setup({ onCleanup, getProps }) {
|
||||||
let draftModelDisplayMode = 'short';
|
let draftModelDisplayMode = 'short';
|
||||||
let draftOrchestratorIdMode = 'compact';
|
let draftOrchestratorIdMode = 'compact';
|
||||||
|
let draftContextRiskAccepted = false;
|
||||||
|
let acceptingContextRisk = false;
|
||||||
let latestSettings = null;
|
let latestSettings = null;
|
||||||
let contextWindowModels = [];
|
let contextWindowModels = [];
|
||||||
let contextModelId = '';
|
let contextModelId = '';
|
||||||
@@ -163,7 +165,7 @@ export const SettingsOtherTab = defineComponent({
|
|||||||
className: 'settings-context-model',
|
className: 'settings-context-model',
|
||||||
options: [],
|
options: [],
|
||||||
onUpdateModelValue: (id) => {
|
onUpdateModelValue: (id) => {
|
||||||
if (savingContextWindow) return;
|
if (!draftContextRiskAccepted || savingContextWindow) return;
|
||||||
contextModelId = id;
|
contextModelId = id;
|
||||||
contextFeedback = '';
|
contextFeedback = '';
|
||||||
renderContextWindows();
|
renderContextWindows();
|
||||||
@@ -172,7 +174,7 @@ export const SettingsOtherTab = defineComponent({
|
|||||||
const ctxWindowSelect = CustomSelect({
|
const ctxWindowSelect = CustomSelect({
|
||||||
options: [],
|
options: [],
|
||||||
onUpdateModelValue: async (value) => {
|
onUpdateModelValue: async (value) => {
|
||||||
if (savingContextWindow || !contextModelId) return;
|
if (!draftContextRiskAccepted || savingContextWindow || !contextModelId) return;
|
||||||
savingContextWindow = true;
|
savingContextWindow = true;
|
||||||
contextFeedback = 'settings.saving';
|
contextFeedback = 'settings.saving';
|
||||||
renderContextWindows();
|
renderContextWindows();
|
||||||
@@ -190,8 +192,82 @@ export const SettingsOtherTab = defineComponent({
|
|||||||
});
|
});
|
||||||
const ctxModelRow = h('div', { className: 'form-row' }, [ctxModelLabel, ctxModelSelect.el]);
|
const ctxModelRow = h('div', { className: 'form-row' }, [ctxModelLabel, ctxModelSelect.el]);
|
||||||
const ctxWindowRow = h('div', { className: 'form-row' }, [ctxWindowLabel, ctxWindowSelect.el]);
|
const ctxWindowRow = h('div', { className: 'form-row' }, [ctxWindowLabel, ctxWindowSelect.el]);
|
||||||
|
const ctxControlsBody = h('div', { className: 'ctx-controls-body is-locked' }, [
|
||||||
|
ctxModelRow,
|
||||||
|
ctxWindowRow,
|
||||||
|
h('div', { className: 'form-row' }, [ctxHint]),
|
||||||
|
]);
|
||||||
|
|
||||||
|
const ctxRiskTitleEl = h('strong', {
|
||||||
|
className: 'ctx-risk-title',
|
||||||
|
text: t('settings.oth.ctxRiskTitle'),
|
||||||
|
});
|
||||||
|
const ctxRiskBodyEl = h('p', {
|
||||||
|
className: 'ctx-risk-desc',
|
||||||
|
text: t('settings.oth.ctxRiskBody'),
|
||||||
|
});
|
||||||
|
const ctxRiskAcceptBtnText = h('span', { text: t('settings.oth.ctxRiskAcceptBtn') });
|
||||||
|
const ctxRiskAcceptBtn = h(
|
||||||
|
'button',
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
className: 'btn-secondary btn-danger-confirm ctx-risk-accept-btn',
|
||||||
|
onClick: async () => {
|
||||||
|
if (acceptingContextRisk || draftContextRiskAccepted) return;
|
||||||
|
acceptingContextRisk = true;
|
||||||
|
draftContextRiskAccepted = true;
|
||||||
|
latestSettings = { ...(latestSettings || {}), contextWindowRiskAccepted: true };
|
||||||
|
contextFeedback = 'settings.saving';
|
||||||
|
renderContextWindows();
|
||||||
|
try {
|
||||||
|
await saveSettingsPatch({ contextWindowRiskAccepted: true });
|
||||||
|
contextFeedback = 'settings.saved';
|
||||||
|
} catch {
|
||||||
|
draftContextRiskAccepted = false;
|
||||||
|
latestSettings = { ...(latestSettings || {}), contextWindowRiskAccepted: false };
|
||||||
|
contextFeedback = 'settings.saveFailed';
|
||||||
|
} finally {
|
||||||
|
acceptingContextRisk = false;
|
||||||
|
renderContextWindows();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
[createSvgIcon('warning', { size: 12 }), ctxRiskAcceptBtnText]
|
||||||
|
);
|
||||||
|
const ctxRiskMask = h(
|
||||||
|
'div',
|
||||||
|
{
|
||||||
|
className: 'ctx-risk-mask',
|
||||||
|
role: 'region',
|
||||||
|
'aria-label': t('settings.oth.ctxRiskTitle'),
|
||||||
|
},
|
||||||
|
[
|
||||||
|
h('div', { className: 'ctx-risk-head' }, [
|
||||||
|
createSvgIcon('warning', { size: 14, className: 'ctx-risk-icon' }),
|
||||||
|
ctxRiskTitleEl,
|
||||||
|
]),
|
||||||
|
ctxRiskBodyEl,
|
||||||
|
ctxRiskAcceptBtn,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
const ctxRiskStage = h('div', { className: 'ctx-risk-stage' }, [ctxControlsBody, ctxRiskMask]);
|
||||||
|
|
||||||
function renderContextWindows() {
|
function renderContextWindows() {
|
||||||
|
const unlocked = Boolean(draftContextRiskAccepted);
|
||||||
|
if (!unlocked) {
|
||||||
|
ctxModelSelect.close();
|
||||||
|
ctxWindowSelect.close();
|
||||||
|
}
|
||||||
|
patchClasses(ctxControlsBody, { 'is-locked': !unlocked });
|
||||||
|
patchAttr(ctxControlsBody, 'inert', !unlocked);
|
||||||
|
patchAttr(ctxControlsBody, 'aria-hidden', unlocked ? null : 'true');
|
||||||
|
patchAttr(ctxRiskMask, 'hidden', unlocked);
|
||||||
|
patchAttr(ctxRiskMask, 'aria-label', t('settings.oth.ctxRiskTitle'));
|
||||||
|
patchText(ctxRiskTitleEl, t('settings.oth.ctxRiskTitle'));
|
||||||
|
patchText(ctxRiskBodyEl, t('settings.oth.ctxRiskBody'));
|
||||||
|
patchText(ctxRiskAcceptBtnText, t('settings.oth.ctxRiskAcceptBtn'));
|
||||||
|
patchAttr(ctxRiskAcceptBtn, 'disabled', acceptingContextRisk);
|
||||||
|
|
||||||
const saved = latestSettings?.modelContextWindows || {};
|
const saved = latestSettings?.modelContextWindows || {};
|
||||||
const models = new Map(contextWindowModels.map((model) => [model.id, model]));
|
const models = new Map(contextWindowModels.map((model) => [model.id, model]));
|
||||||
const knownIds = new Set(contextWindowModels.flatMap(({ id, members = [] }) => [id, ...members]));
|
const knownIds = new Set(contextWindowModels.flatMap(({ id, members = [] }) => [id, ...members]));
|
||||||
@@ -250,8 +326,8 @@ export const SettingsOtherTab = defineComponent({
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
ctxWindowSelect.setProps({ modelValue: selected, options: choices });
|
ctxWindowSelect.setProps({ modelValue: selected, options: choices });
|
||||||
patchAttr(ctxModelSelect.refs.triggerBtn, 'disabled', savingContextWindow);
|
patchAttr(ctxModelSelect.refs.triggerBtn, 'disabled', !unlocked || savingContextWindow);
|
||||||
patchAttr(ctxWindowSelect.refs.triggerBtn, 'disabled', savingContextWindow || (!options.length && !selected));
|
patchAttr(ctxWindowSelect.refs.triggerBtn, 'disabled', !unlocked || savingContextWindow || (!options.length && !selected));
|
||||||
patchAttr(ctxModelSelect.refs.triggerBtn, 'aria-label', t('settings.oth.ctxModel'));
|
patchAttr(ctxModelSelect.refs.triggerBtn, 'aria-label', t('settings.oth.ctxModel'));
|
||||||
patchAttr(ctxWindowSelect.refs.triggerBtn, 'aria-label', t('settings.oth.ctxBaselineLabel'));
|
patchAttr(ctxWindowSelect.refs.triggerBtn, 'aria-label', t('settings.oth.ctxBaselineLabel'));
|
||||||
patchAttr(ctxModelRow, 'hidden', !models.size);
|
patchAttr(ctxModelRow, 'hidden', !models.size);
|
||||||
@@ -275,9 +351,7 @@ export const SettingsOtherTab = defineComponent({
|
|||||||
]),
|
]),
|
||||||
ctxStatus,
|
ctxStatus,
|
||||||
]),
|
]),
|
||||||
ctxModelRow,
|
ctxRiskStage,
|
||||||
ctxWindowRow,
|
|
||||||
h('div', { className: 'form-row' }, [ctxHint]),
|
|
||||||
]);
|
]);
|
||||||
renderContextWindows();
|
renderContextWindows();
|
||||||
|
|
||||||
@@ -418,6 +492,9 @@ export const SettingsOtherTab = defineComponent({
|
|||||||
settings.showUpstreamModel
|
settings.showUpstreamModel
|
||||||
);
|
);
|
||||||
draftOrchestratorIdMode = normalizeClientOrchestratorIdMode(settings.orchestratorIdMode);
|
draftOrchestratorIdMode = normalizeClientOrchestratorIdMode(settings.orchestratorIdMode);
|
||||||
|
if (!acceptingContextRisk) {
|
||||||
|
draftContextRiskAccepted = Boolean(settings.contextWindowRiskAccepted);
|
||||||
|
}
|
||||||
stepModelSelect.setProps({
|
stepModelSelect.setProps({
|
||||||
modelValue: draftModelDisplayMode,
|
modelValue: draftModelDisplayMode,
|
||||||
options: getStepModelDisplayOptions(),
|
options: getStepModelDisplayOptions(),
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import { getVisibleMonitorView, uiStore } from '../../store/uiStore.js';
|
|||||||
import { CollapsibleSection } from '../../components/settings/CollapsibleSection.js';
|
import { CollapsibleSection } from '../../components/settings/CollapsibleSection.js';
|
||||||
import { EditableSlotList } from '../../components/settings/EditableSlotList.js';
|
import { EditableSlotList } from '../../components/settings/EditableSlotList.js';
|
||||||
import { buildStructurePreviewTelemetry } from '../../components/settings/structurePreviewMock.js';
|
import { buildStructurePreviewTelemetry } from '../../components/settings/structurePreviewMock.js';
|
||||||
|
import { CustomNumberInput } from '../../components/ui/CustomNumberInput.js';
|
||||||
import { CustomSelect } from '../../components/ui/CustomSelect.js';
|
import { CustomSelect } from '../../components/ui/CustomSelect.js';
|
||||||
import { SegmentedControl } from '../../components/ui/SegmentedControl.js';
|
import { SegmentedControl } from '../../components/ui/SegmentedControl.js';
|
||||||
import { CapsuleBarWidget } from '../../components/widgets/CapsuleBarWidget.js';
|
import { CapsuleBarWidget } from '../../components/widgets/CapsuleBarWidget.js';
|
||||||
@@ -243,18 +244,15 @@ export const SettingsStructureTab = defineComponent({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const popoverWidthInput = h('input', {
|
const popoverWidthStepper = CustomNumberInput({
|
||||||
type: 'number',
|
modelValue: draftPopoverWidth,
|
||||||
className: 'settings-text-input',
|
min: MIN_CLIENT_POPOVER_WIDTH,
|
||||||
min: String(MIN_CLIENT_POPOVER_WIDTH),
|
max: MAX_CLIENT_POPOVER_WIDTH,
|
||||||
max: String(MAX_CLIENT_POPOVER_WIDTH),
|
step: 10,
|
||||||
step: '10',
|
ariaLabel: t('settings.str.popoverWidthLabel'),
|
||||||
value: String(draftPopoverWidth),
|
onUpdateModelValue: (val) => {
|
||||||
'aria-label': t('settings.str.popoverWidthLabel'),
|
const nextWidth = normalizeClientPopoverWidth(val);
|
||||||
onChange: () => {
|
|
||||||
const nextWidth = normalizeClientPopoverWidth(popoverWidthInput.value);
|
|
||||||
draftPopoverWidth = nextWidth;
|
draftPopoverWidth = nextWidth;
|
||||||
popoverWidthInput.value = String(nextWidth);
|
|
||||||
syncMountSectionMeta();
|
syncMountSectionMeta();
|
||||||
props.onLayoutChange?.();
|
props.onLayoutChange?.();
|
||||||
void persistStructurePatch(mountSection, {
|
void persistStructurePatch(mountSection, {
|
||||||
@@ -262,18 +260,12 @@ export const SettingsStructureTab = defineComponent({
|
|||||||
popoverWidth: draftPopoverWidth,
|
popoverWidth: draftPopoverWidth,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onKeydown: (e) => {
|
|
||||||
if (e?.key === 'Enter') {
|
|
||||||
e.preventDefault();
|
|
||||||
popoverWidthInput.blur();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const popoverWidthNumWrap = h(
|
const popoverWidthNumWrap = h(
|
||||||
'span',
|
'span',
|
||||||
{ className: 'settings-number-wrap', hidden: draftPopoverWidthMode !== 'custom' },
|
{ className: 'settings-number-wrap', hidden: draftPopoverWidthMode !== 'custom' },
|
||||||
[popoverWidthInput, h('span', { className: 'settings-number-unit', text: 'px' })]
|
[popoverWidthStepper.el, h('span', { className: 'settings-number-unit', text: 'px' })]
|
||||||
);
|
);
|
||||||
|
|
||||||
const popoverWidthModeToggle = SegmentedControl({
|
const popoverWidthModeToggle = SegmentedControl({
|
||||||
@@ -346,7 +338,7 @@ export const SettingsStructureTab = defineComponent({
|
|||||||
draftWindowMountMode = 'dual';
|
draftWindowMountMode = 'dual';
|
||||||
draftPopoverWidthMode = 'auto';
|
draftPopoverWidthMode = 'auto';
|
||||||
draftPopoverWidth = DEFAULT_CLIENT_POPOVER_WIDTH;
|
draftPopoverWidth = DEFAULT_CLIENT_POPOVER_WIDTH;
|
||||||
popoverWidthInput.value = String(DEFAULT_CLIENT_POPOVER_WIDTH);
|
popoverWidthStepper.setProps({ modelValue: DEFAULT_CLIENT_POPOVER_WIDTH });
|
||||||
draftEnableCliStatusLine = true;
|
draftEnableCliStatusLine = true;
|
||||||
draftShowTopbarMulti = true;
|
draftShowTopbarMulti = true;
|
||||||
draftTopbarSlots = [...DEFAULT_CLIENT_TOPBAR_SLOTS];
|
draftTopbarSlots = [...DEFAULT_CLIENT_TOPBAR_SLOTS];
|
||||||
@@ -407,8 +399,11 @@ export const SettingsStructureTab = defineComponent({
|
|||||||
options: getPopoverWidthModeOptions(),
|
options: getPopoverWidthModeOptions(),
|
||||||
});
|
});
|
||||||
patchAttr(popoverWidthNumWrap, 'hidden', draftPopoverWidthMode !== 'custom');
|
patchAttr(popoverWidthNumWrap, 'hidden', draftPopoverWidthMode !== 'custom');
|
||||||
if (document?.activeElement !== popoverWidthInput) {
|
if (document?.activeElement !== popoverWidthStepper.refs.textField) {
|
||||||
popoverWidthInput.value = String(draftPopoverWidth);
|
popoverWidthStepper.setProps({
|
||||||
|
modelValue: draftPopoverWidth,
|
||||||
|
ariaLabel: t('settings.str.popoverWidthLabel'),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
multiSessionToggle.setProps({
|
multiSessionToggle.setProps({
|
||||||
modelValue: draftShowTopbarMulti ? 'show' : 'hide',
|
modelValue: draftShowTopbarMulti ? 'show' : 'hide',
|
||||||
@@ -1029,7 +1024,7 @@ export const SettingsStructureTab = defineComponent({
|
|||||||
patchText(mountModeLabelEl, t('settings.str.mountMode'));
|
patchText(mountModeLabelEl, t('settings.str.mountMode'));
|
||||||
patchText(popoverWidthLabelEl, t('settings.str.popoverWidthLabel'));
|
patchText(popoverWidthLabelEl, t('settings.str.popoverWidthLabel'));
|
||||||
patchText(popoverWidthHintEl, t('settings.str.popoverWidthHint'));
|
patchText(popoverWidthHintEl, t('settings.str.popoverWidthHint'));
|
||||||
patchAttr(popoverWidthInput, 'aria-label', t('settings.str.popoverWidthLabel'));
|
popoverWidthStepper.setProps({ ariaLabel: t('settings.str.popoverWidthLabel') });
|
||||||
patchText(multiToggleLabelEl, t('settings.str.multiToggle'));
|
patchText(multiToggleLabelEl, t('settings.str.multiToggle'));
|
||||||
patchText(cliCapsuleLabelEl, t('settings.str.cliCapsuleToggle'));
|
patchText(cliCapsuleLabelEl, t('settings.str.cliCapsuleToggle'));
|
||||||
patchText(capsuleSlotsLabelEl, t('settings.str.capsuleSlotsLabel'));
|
patchText(capsuleSlotsLabelEl, t('settings.str.capsuleSlotsLabel'));
|
||||||
@@ -1097,6 +1092,7 @@ export const SettingsStructureTab = defineComponent({
|
|||||||
overviewPreviewHost.destroy();
|
overviewPreviewHost.destroy();
|
||||||
stepTablePreview.destroy();
|
stepTablePreview.destroy();
|
||||||
windowMountSelect.destroy();
|
windowMountSelect.destroy();
|
||||||
|
popoverWidthStepper.destroy();
|
||||||
popoverWidthModeToggle.destroy();
|
popoverWidthModeToggle.destroy();
|
||||||
multiSessionToggle.destroy();
|
multiSessionToggle.destroy();
|
||||||
cliCapsuleToggle.destroy();
|
cliCapsuleToggle.destroy();
|
||||||
|
|||||||
+111
-14
@@ -184,6 +184,17 @@ input {
|
|||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input[type="number"] {
|
||||||
|
appearance: textfield;
|
||||||
|
-moz-appearance: textfield;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="number"]::-webkit-inner-spin-button,
|
||||||
|
input[type="number"]::-webkit-outer-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.app-shell {
|
.app-shell {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -290,11 +301,9 @@ html[data-standalone="true"] .app-shell {
|
|||||||
@keyframes anim-popover-in {
|
@keyframes anim-popover-in {
|
||||||
from {
|
from {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translate3d(0, -3px, 0) scale(0.985);
|
|
||||||
}
|
}
|
||||||
to {
|
to {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: translate3d(0, 0, 0) scale(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,7 +585,7 @@ html[data-standalone="true"] .app-shell {
|
|||||||
box-shadow: var(--shadow-popover);
|
box-shadow: var(--shadow-popover);
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
z-index: 60;
|
z-index: 60;
|
||||||
animation: anim-popover-in var(--dur-fast) var(--ease-fast);
|
animation: anim-popover-in var(--dur-instant) var(--ease-fast);
|
||||||
}
|
}
|
||||||
|
|
||||||
.select-option {
|
.select-option {
|
||||||
@@ -627,6 +636,7 @@ html[data-standalone="true"] .app-shell {
|
|||||||
font-size: var(--fs-md);
|
font-size: var(--fs-md);
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
font-family: var(--font-mono);
|
font-family: var(--font-mono);
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.select-checkbox {
|
.select-checkbox {
|
||||||
@@ -882,7 +892,6 @@ html[data-standalone="true"] .app-shell {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
gap: 5px;
|
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
@@ -891,6 +900,7 @@ html[data-standalone="true"] .app-shell {
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
|
padding-right: 6px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
scrollbar-width: none;
|
scrollbar-width: none;
|
||||||
@@ -904,10 +914,11 @@ html[data-standalone="true"] .app-shell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.scrollbar-rail {
|
.scrollbar-rail {
|
||||||
position: relative;
|
position: absolute;
|
||||||
flex-shrink: 0;
|
top: 2px;
|
||||||
width: 5px;
|
right: 0;
|
||||||
margin: 2px 0;
|
bottom: 2px;
|
||||||
|
width: 4px;
|
||||||
border-radius: var(--radius-pill);
|
border-radius: var(--radius-pill);
|
||||||
background: color-mix(in srgb, var(--border-hairline) 35%, transparent);
|
background: color-mix(in srgb, var(--border-hairline) 35%, transparent);
|
||||||
z-index: 15;
|
z-index: 15;
|
||||||
@@ -923,7 +934,7 @@ html[data-standalone="true"] .app-shell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.scrollbar-rail.is-inactive {
|
.scrollbar-rail.is-inactive {
|
||||||
display: none !important;
|
visibility: hidden;
|
||||||
opacity: 0 !important;
|
opacity: 0 !important;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
@@ -4015,12 +4026,23 @@ html[data-standalone="true"] .app-shell {
|
|||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings-number-wrap .settings-text-input {
|
.settings-number-wrap .number-input {
|
||||||
width: 68px;
|
|
||||||
height: 24px;
|
height: 24px;
|
||||||
padding: 0 6px;
|
background: var(--surface-subtle);
|
||||||
text-align: right;
|
}
|
||||||
font-variant-numeric: tabular-nums;
|
|
||||||
|
.settings-number-wrap .num-step-btn {
|
||||||
|
width: 22px;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-number-wrap .num-field {
|
||||||
|
width: 48px;
|
||||||
|
min-width: 48px;
|
||||||
|
padding: 0 4px;
|
||||||
|
text-align: center;
|
||||||
|
font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
|
||||||
|
font-size: var(--fs-md);
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings-number-unit {
|
.settings-number-unit {
|
||||||
@@ -4028,6 +4050,81 @@ html[data-standalone="true"] .app-shell {
|
|||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --- 其他页:模型上下文设置风险警告遮罩 --- */
|
||||||
|
.ctx-risk-stage {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-controls-body {
|
||||||
|
grid-area: 1 / 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--space-3);
|
||||||
|
min-width: 0;
|
||||||
|
transition:
|
||||||
|
filter var(--dur-fast) var(--ease-fast),
|
||||||
|
opacity var(--dur-fast) var(--ease-fast);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-controls-body.is-locked {
|
||||||
|
filter: blur(4px);
|
||||||
|
opacity: 0.24;
|
||||||
|
pointer-events: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-risk-mask {
|
||||||
|
grid-area: 1 / 1;
|
||||||
|
z-index: 5;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: center;
|
||||||
|
gap: var(--space-2);
|
||||||
|
padding: var(--space-3) var(--space-4);
|
||||||
|
border-radius: var(--radius-xs);
|
||||||
|
border: 1px solid color-mix(in srgb, var(--metric-warn) 42%, var(--border-hairline));
|
||||||
|
background: color-mix(in srgb, var(--surface-panel) 88%, var(--metric-warn) 7%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-risk-mask[hidden] {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-risk-head {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
color: var(--metric-warn);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-risk-icon {
|
||||||
|
color: var(--metric-warn);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-risk-title {
|
||||||
|
font-size: var(--fs-base);
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--metric-warn);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-risk-desc {
|
||||||
|
margin: 0;
|
||||||
|
font-size: var(--fs-sm);
|
||||||
|
line-height: 1.5;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctx-risk-accept-btn {
|
||||||
|
margin-top: 2px;
|
||||||
|
height: 26px;
|
||||||
|
padding: 0 var(--space-3);
|
||||||
|
font-size: var(--fs-md);
|
||||||
|
}
|
||||||
|
|
||||||
/* --- src/styles/overlay.css --- */
|
/* --- src/styles/overlay.css --- */
|
||||||
/*
|
/*
|
||||||
* 双栖模式顶栏胶囊与悬浮面板样式表 (overlay.css).
|
* 双栖模式顶栏胶囊与悬浮面板样式表 (overlay.css).
|
||||||
|
|||||||
@@ -2233,10 +2233,12 @@ test('v1.5 feedback settings schema: custom token combo DSL, 3-way model display
|
|||||||
assert.equal(h.normalizeModelDisplayMode(undefined, true), 'upstream');
|
assert.equal(h.normalizeModelDisplayMode(undefined, true), 'upstream');
|
||||||
assert.equal(h.normalizeModelDisplayMode(undefined, false), 'short');
|
assert.equal(h.normalizeModelDisplayMode(undefined, false), 'short');
|
||||||
|
|
||||||
|
assert.equal(h.loadSettings().contextWindowRiskAccepted, false);
|
||||||
const compactRes = h.executeSettingsAction({
|
const compactRes = h.executeSettingsAction({
|
||||||
modelDisplayMode: 'upstream_compact',
|
modelDisplayMode: 'upstream_compact',
|
||||||
popoverWidthMode: 'custom',
|
popoverWidthMode: 'custom',
|
||||||
popoverWidth: 1500,
|
popoverWidth: 1500,
|
||||||
|
contextWindowRiskAccepted: true,
|
||||||
stepTokenComboFormat: 'in:out:cache',
|
stepTokenComboFormat: 'in:out:cache',
|
||||||
stepTableColumns: ['step', 'model', 'tokens_io_cache', 'tokens_custom', 'cost'],
|
stepTableColumns: ['step', 'model', 'tokens_io_cache', 'tokens_custom', 'cost'],
|
||||||
});
|
});
|
||||||
@@ -2245,6 +2247,7 @@ test('v1.5 feedback settings schema: custom token combo DSL, 3-way model display
|
|||||||
assert.equal(compactRes.updated.showUpstreamModel, true);
|
assert.equal(compactRes.updated.showUpstreamModel, true);
|
||||||
assert.equal(compactRes.updated.popoverWidthMode, 'custom');
|
assert.equal(compactRes.updated.popoverWidthMode, 'custom');
|
||||||
assert.equal(compactRes.updated.popoverWidth, 1080, 'Clamped to MAX_POPOVER_WIDTH 1080');
|
assert.equal(compactRes.updated.popoverWidth, 1080, 'Clamped to MAX_POPOVER_WIDTH 1080');
|
||||||
|
assert.equal(compactRes.updated.contextWindowRiskAccepted, true);
|
||||||
assert.equal(compactRes.updated.stepTokenComboFormat, 'in:out:cache');
|
assert.equal(compactRes.updated.stepTokenComboFormat, 'in:out:cache');
|
||||||
assert.deepEqual([...compactRes.updated.stepTableColumns], [
|
assert.deepEqual([...compactRes.updated.stepTableColumns], [
|
||||||
'step',
|
'step',
|
||||||
|
|||||||
@@ -798,6 +798,7 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
weeklyLimitMode: 'official',
|
weeklyLimitMode: 'official',
|
||||||
weeklyTokenBudget: 150000000,
|
weeklyTokenBudget: 150000000,
|
||||||
weeklyCostBudget: 100,
|
weeklyCostBudget: 100,
|
||||||
|
contextWindowRiskAccepted: false,
|
||||||
modelContextWindows: {},
|
modelContextWindows: {},
|
||||||
};
|
};
|
||||||
const mockSettings = { ...defaultMockSettings };
|
const mockSettings = { ...defaultMockSettings };
|
||||||
@@ -1708,11 +1709,13 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
assert.equal(mockSettings.enableWindowOverlay, true, 'enableWindowOverlay persisted back to true');
|
assert.equal(mockSettings.enableWindowOverlay, true, 'enableWindowOverlay persisted back to true');
|
||||||
assert.equal(previewCapsuleBar.getAttribute('data-mount-mode'), 'dual');
|
assert.equal(previewCapsuleBar.getAttribute('data-mount-mode'), 'dual');
|
||||||
|
|
||||||
// Toggle popover width mode (auto -> custom 640px -> auto), topbar multi-session switch (show -> hide -> show), and CLI bottom capsule switch (on -> off -> on)
|
// Toggle popover width mode (auto -> custom 640px -> step +10px -> auto), topbar multi-session switch (show -> hide -> show), and CLI bottom capsule switch (on -> off -> on)
|
||||||
const topbarSegBtns = sec0.querySelectorAll('.seg-btn');
|
const topbarSegBtns = sec0.querySelectorAll('.seg-btn');
|
||||||
assert.equal(topbarSegBtns.length, 6, 'Popover width + Topbar multi-session + CLI bottom capsule toggles render 6 buttons');
|
assert.equal(topbarSegBtns.length, 6, 'Popover width + Topbar multi-session + CLI bottom capsule toggles render 6 buttons');
|
||||||
const popWidthInput = sec0.querySelector('.settings-text-input');
|
const popWidthInput = sec0.querySelector('.num-field');
|
||||||
assert.ok(popWidthInput, 'Numeric popover width input exists');
|
const popWidthStepBtns = sec0.querySelectorAll('.num-step-btn');
|
||||||
|
assert.ok(popWidthInput, 'CustomNumberInput field exists without native <input type="number">');
|
||||||
|
assert.equal(popWidthStepBtns.length, 2, 'CustomNumberInput renders - / + step buttons');
|
||||||
topbarSegBtns[1].dispatchEvent({ type: 'click', stopPropagation() {} });
|
topbarSegBtns[1].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
await new Promise((r) => setTimeout(r, 30));
|
await new Promise((r) => setTimeout(r, 30));
|
||||||
assert.equal(mockSettings.popoverWidthMode, 'custom', 'Popover width mode switches to custom');
|
assert.equal(mockSettings.popoverWidthMode, 'custom', 'Popover width mode switches to custom');
|
||||||
@@ -1721,6 +1724,10 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
await new Promise((r) => setTimeout(r, 30));
|
await new Promise((r) => setTimeout(r, 30));
|
||||||
assert.equal(mockSettings.popoverWidth, 640, 'Custom popover width persisted');
|
assert.equal(mockSettings.popoverWidth, 640, 'Custom popover width persisted');
|
||||||
assert.equal(popoverEl.style.width, '640px', 'Popover width immediately reflects custom 640px');
|
assert.equal(popoverEl.style.width, '640px', 'Popover width immediately reflects custom 640px');
|
||||||
|
popWidthStepBtns[1].dispatchEvent({ type: 'click', preventDefault() {}, stopPropagation() {} });
|
||||||
|
await new Promise((r) => setTimeout(r, 30));
|
||||||
|
assert.equal(mockSettings.popoverWidth, 650, 'Stepper + button increments custom width by 10px');
|
||||||
|
assert.equal(popoverEl.style.width, '650px', 'Popover width immediately reflects stepped 650px');
|
||||||
topbarSegBtns[0].dispatchEvent({ type: 'click', stopPropagation() {} });
|
topbarSegBtns[0].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
await new Promise((r) => setTimeout(r, 30));
|
await new Promise((r) => setTimeout(r, 30));
|
||||||
assert.equal(mockSettings.popoverWidthMode, 'auto', 'Popover width mode restored to auto');
|
assert.equal(mockSettings.popoverWidthMode, 'auto', 'Popover width mode restored to auto');
|
||||||
@@ -2076,6 +2083,23 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
select.querySelector('.select-trigger').dispatchEvent({ type: 'click', stopPropagation() {} });
|
select.querySelector('.select-trigger').dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
select.querySelectorAll('.select-option')[index].dispatchEvent({ type: 'click', stopPropagation() {} });
|
select.querySelectorAll('.select-option')[index].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
};
|
};
|
||||||
|
const ctxRiskMask = otherPane.querySelector('.ctx-risk-mask');
|
||||||
|
const ctxControlsBody = otherPane.querySelector('.ctx-controls-body');
|
||||||
|
const ctxRiskAcceptBtn = otherPane.querySelector('.ctx-risk-accept-btn');
|
||||||
|
assert.ok(ctxRiskMask && ctxControlsBody && ctxRiskAcceptBtn, 'Context window risk warning mask and accept button exist');
|
||||||
|
assert.equal(ctxRiskMask.hasAttribute('hidden'), false, 'Risk mask visible before consent');
|
||||||
|
assert.equal(ctxControlsBody.classList.contains('is-locked'), true, 'Context controls locked before consent');
|
||||||
|
assert.equal(contextModel.querySelector('.select-trigger').hasAttribute('disabled'), true, 'Model select disabled before consent');
|
||||||
|
selectOption(contextModel, 1);
|
||||||
|
assert.equal(contextWindow.parentNode.hasAttribute('hidden'), true, 'Cannot select context model while locked');
|
||||||
|
|
||||||
|
ctxRiskAcceptBtn.dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
await new Promise((r) => setTimeout(r, 30));
|
||||||
|
assert.equal(mockSettings.contextWindowRiskAccepted, true, 'Accepting risk persists contextWindowRiskAccepted');
|
||||||
|
assert.equal(ctxRiskMask.hasAttribute('hidden'), true, 'Risk mask hidden after consent');
|
||||||
|
assert.equal(ctxControlsBody.classList.contains('is-locked'), false, 'Context controls unlocked after consent');
|
||||||
|
assert.equal(contextModel.querySelector('.select-trigger').hasAttribute('disabled'), false, 'Model select enabled after consent');
|
||||||
|
|
||||||
assert.equal(contextWindow.parentNode.hasAttribute('hidden'), true);
|
assert.equal(contextWindow.parentNode.hasAttribute('hidden'), true);
|
||||||
contextModel.querySelector('.select-trigger').dispatchEvent({ type: 'click', stopPropagation() {} });
|
contextModel.querySelector('.select-trigger').dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
assert.match(contextModel.querySelectorAll('.select-option')[1].querySelector('.select-option-meta').textContent, /默认.*256,000/);
|
assert.match(contextModel.querySelectorAll('.select-option')[1].querySelector('.select-option-meta').textContent, /默认.*256,000/);
|
||||||
@@ -2098,7 +2122,9 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
selectOption(contextModel, 3);
|
selectOption(contextModel, 3);
|
||||||
assert.equal(contextWindow.querySelector('.select-trigger').hasAttribute('disabled'), true);
|
assert.equal(contextWindow.querySelector('.select-trigger').hasAttribute('disabled'), true);
|
||||||
|
|
||||||
const maintBtns = otherPane.querySelectorAll('.btn-secondary');
|
const maintBtns = otherPane
|
||||||
|
.querySelectorAll('.btn-secondary')
|
||||||
|
.filter((btn) => !btn.classList.contains('ctx-risk-accept-btn'));
|
||||||
const rebuildBtn = maintBtns[0];
|
const rebuildBtn = maintBtns[0];
|
||||||
const resetAllBtn = maintBtns[1];
|
const resetAllBtn = maintBtns[1];
|
||||||
rebuildBtn.dispatchEvent({ type: 'click', stopPropagation() {} });
|
rebuildBtn.dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
@@ -2112,6 +2138,8 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
|||||||
resetAllBtn.dispatchEvent({ type: 'click', stopPropagation() {} });
|
resetAllBtn.dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
await new Promise((r) => setTimeout(r, 260));
|
await new Promise((r) => setTimeout(r, 260));
|
||||||
assert.equal(mockSettings.orchestratorIdMode, 'compact', '2nd click resets orchestratorIdMode to default');
|
assert.equal(mockSettings.orchestratorIdMode, 'compact', '2nd click resets orchestratorIdMode to default');
|
||||||
|
assert.equal(mockSettings.contextWindowRiskAccepted, false, 'Reset restores contextWindowRiskAccepted to false');
|
||||||
|
assert.equal(ctxRiskMask.hasAttribute('hidden'), false, 'Risk mask re-locks after factory reset');
|
||||||
|
|
||||||
// Verify ConsumptionView omits "+ 待定" / "3993 步费用待定" and StepsDetailView protects header title
|
// Verify ConsumptionView omits "+ 待定" / "3993 步费用待定" and StepsDetailView protects header title
|
||||||
pillTabs[1].dispatchEvent({ type: 'click', stopPropagation() {} });
|
pillTabs[1].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||||
|
|||||||
Reference in New Issue
Block a user