(sourcePrefs = {})
| 2142 | history.replaceState(null, "", `${window.location.pathname}${window.location.search}#${name}`); |
| 2143 | } |
| 2144 | window.scrollTo({ top: 0, left: 0 }); |
| 2145 | if (name === "reports" && !options.skipLoad) runAction(() => refreshReports({ keepSelection: true }), "加载报告"); |
| 2146 | if (name === "wiki" && !options.skipLoad) runAction(loadWiki, "加载 Wiki"); |
| 2147 | if (name === "chat" && !options.skipLoad) runAction(() => loadChatSessions({ openLatest: true }), "加载历史对话"); |
| 2148 | if (name === "settings") runAction(loadSettings, "加载设置"); |
| 2149 | if (name === "papers") { |
| 2150 | resumeDailyTask().catch((error) => { |
| 2151 | console.error(error); |
| 2152 | }); |
| 2153 | } |
| 2154 | persistUiPrefs(); |
| 2155 | } |
| 2156 | |
| 2157 | function currentUser() { |
| 2158 | return $("userSelect").value || state.currentUser || "user_demo"; |
| 2159 | } |
| 2160 | |
| 2161 | function normalizeUser(raw) { |
| 2162 | if (typeof raw === "string") { |
| 2163 | return { user_id: raw, label: raw, is_current: false, description: "", affiliation: "", has_profile: false, updated_at: "" }; |
| 2164 | } |
| 2165 | const userId = raw?.user_id || raw?.id || raw?.name || ""; |
| 2166 | const role = raw?.role_name ? `${raw.role_name} · ` : ""; |
no test coverage detected