接通主角绑定、开场封印与游玩辅助,让世界模拟器从创作连续落到本局。

直聘插入按模块回馈,并记录请求骨架便于排查。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-22 07:40:08 +08:00
co-authored by Cursor
parent 9306c8e659
commit dd0a9e87d8
88 changed files with 6869 additions and 786 deletions
+85 -5
View File
@@ -1,4 +1,4 @@
/** Color themes + present chrome — aligned with llm_workflow_engine ThemeToggle. */
/** Color themes + UI font scale — aligned with llm_workflow_engine ThemeToggle. */
export const COLOR_THEMES = [
{
@@ -27,7 +27,22 @@ export const COLOR_THEMES = [
},
];
/** 呈现壳气质(tone_chrome),与色主题同属「主题」菜单 */
/** 全局字号:百分比(100 = 默认),+/- 步进调节 */
export const UI_FONT_SCALE_MIN = 80;
export const UI_FONT_SCALE_MAX = 150;
export const UI_FONT_SCALE_STEP = 5;
export const UI_FONT_SCALE_DEFAULT = 100;
const LEGACY_FONT_SCALE_IDS = {
sm: 88,
md: 100,
lg: 112,
xl: 125,
};
/**
* @deprecated 选壳已从主题菜单移除;壳气质跟呈现壳本身。保留常量以免旧引用报错。
*/
export const PRESENT_CHROMES = [
{ id: "default", name: "默认", description: "跟随壳本身" },
{ id: "messenger", name: "讯息", description: "气泡对话感" },
@@ -36,6 +51,7 @@ export const PRESENT_CHROMES = [
];
const STORAGE_KEY = "wa-color-theme";
const FONT_SCALE_STORAGE_KEY = "wa-ui-font-scale";
const CHROME_STORAGE_KEY = "wa-present-chrome";
const THEME_IDS = new Set(COLOR_THEMES.map((t) => t.id));
const CHROME_IDS = new Set(PRESENT_CHROMES.map((t) => t.id));
@@ -76,11 +92,72 @@ export function initColorTheme() {
return applyColorTheme(getStoredColorTheme());
}
function clampFontPercent(n) {
const stepped = Math.round(n / UI_FONT_SCALE_STEP) * UI_FONT_SCALE_STEP;
return Math.min(
UI_FONT_SCALE_MAX,
Math.max(UI_FONT_SCALE_MIN, stepped),
);
}
/** 解析为百分比整数;兼容旧档 sm/md/lg/xl 与 0.x~2 倍缩放 */
export function normalizeUiFontScalePercent(raw) {
if (raw == null) return UI_FONT_SCALE_DEFAULT;
const key = String(raw).trim();
if (Object.prototype.hasOwnProperty.call(LEGACY_FONT_SCALE_IDS, key)) {
return LEGACY_FONT_SCALE_IDS[key];
}
let n = Number(key);
if (!Number.isFinite(n)) return UI_FONT_SCALE_DEFAULT;
if (n > 0 && n <= 2.5) n = Math.round(n * 100);
return clampFontPercent(n);
}
export function getStoredUiFontScale() {
try {
return normalizeUiFontScalePercent(localStorage.getItem(FONT_SCALE_STORAGE_KEY));
} catch {
return UI_FONT_SCALE_DEFAULT;
}
}
/** @deprecated 用 getStoredUiFontScale / applyUiFontScale(percent) */
export function fontScaleById(id) {
const percent = normalizeUiFontScalePercent(id);
return { id: String(percent), scale: percent / 100, name: `${percent}`, description: "" };
}
export function applyUiFontScale(raw) {
const percent = normalizeUiFontScalePercent(raw);
const root = document.documentElement;
root.setAttribute("data-ui-font-scale", String(percent));
root.style.setProperty("--ui-font-scale", String(percent / 100));
try {
localStorage.setItem(FONT_SCALE_STORAGE_KEY, String(percent));
} catch {
/* ignore */
}
return percent;
}
export function bumpUiFontScale(deltaSteps) {
const cur = getStoredUiFontScale();
const steps = Number(deltaSteps);
const delta = Number.isFinite(steps) ? steps : 0;
return applyUiFontScale(cur + delta * UI_FONT_SCALE_STEP);
}
export function initUiFontScale() {
return applyUiFontScale(getStoredUiFontScale());
}
/** @deprecated */
export function normalizePresentChrome(id) {
const v = String(id || "").trim();
return CHROME_IDS.has(v) ? v : DEFAULT_CHROME;
}
/** @deprecated */
export function getStoredPresentChrome() {
try {
return normalizePresentChrome(localStorage.getItem(CHROME_STORAGE_KEY));
@@ -89,13 +166,15 @@ export function getStoredPresentChrome() {
}
}
/** @deprecated */
export function chromeById(id) {
const cid = normalizePresentChrome(id);
return PRESENT_CHROMES.find((t) => t.id === cid) || PRESENT_CHROMES[0];
}
export function applyPresentChrome(id) {
const chrome = normalizePresentChrome(id);
/** @deprecated 菜单已移除;调用仍把属性钉为 default,避免旧存档残留 */
export function applyPresentChrome(_id) {
const chrome = DEFAULT_CHROME;
document.documentElement.setAttribute("data-present-chrome", chrome);
try {
localStorage.setItem(CHROME_STORAGE_KEY, chrome);
@@ -111,6 +190,7 @@ export function applyPresentChrome(id) {
return chrome;
}
/** @deprecated */
export function initPresentChrome() {
return applyPresentChrome(getStoredPresentChrome());
return applyPresentChrome(DEFAULT_CHROME);
}