(data)
| 5216 | } |
| 5217 | |
| 5218 | function renderSettings(data) { |
| 5219 | state.settings = data || {}; |
| 5220 | const paths = data.paths || {}; |
| 5221 | const storageStats = data.storage_stats || {}; |
| 5222 | const rowLabels = ui().settings.storageRows; |
| 5223 | const rows = [ |
| 5224 | { label: rowLabels.notesRoot, value: paths.notes_root_dir, envKey: "PAPERFLOW_NOTES_ROOT_DIR" }, |
| 5225 | { label: rowLabels.pdf, value: paths.pdf_dir, derivedRole: "pdf" }, |
| 5226 | { label: rowLabels.reports, value: paths.reading_reports_dir, derivedRole: "reports" }, |
| 5227 | { label: rowLabels.wiki, value: paths.wiki_dir, derivedRole: "wiki" }, |
| 5228 | { label: rowLabels.notesGit, value: paths.reading_notes_git_dir, derivedRole: "git" }, |
| 5229 | { label: rowLabels.notesGitRemote, value: paths.reading_notes_git_remote, envKey: "PAPERFLOW_READING_NOTES_GIT_REMOTE" }, |
| 5230 | { label: rowLabels.notesGitBranch, value: paths.reading_notes_git_branch || "main", envKey: "PAPERFLOW_READING_NOTES_GIT_BRANCH" }, |
| 5231 | { label: rowLabels.feishu, value: paths.write_feishu ? ui().common.yes : ui().common.no }, |
| 5232 | { label: rowLabels.ingest, value: paths.wiki_ingest ? ui().common.yes : ui().common.no } |
| 5233 | ]; |
| 5234 | $("settingsList").className = "settings-list"; |
| 5235 | $("settingsList").innerHTML = rows.map((row) => ` |
| 5236 | <div class="setting-row ${row.envKey ? "editable-path-row" : ""}"> |
| 5237 | <strong>${escapeHtml(row.label)}</strong> |
| 5238 | ${row.envKey |
| 5239 | ? `<input data-env-key="${escapeHtml(row.envKey)}" value="${escapeHtml(row.value || "")}" autocomplete="off">` |
| 5240 | : row.derivedRole |
| 5241 | ? `<input data-derived-path="${escapeHtml(row.derivedRole)}" value="${escapeHtml(row.value || "")}" readonly autocomplete="off">` |
| 5242 | : `<span>${escapeHtml(row.value || "-")}</span>`} |
| 5243 | </div> |
| 5244 | `).join(""); |
| 5245 | const notesRootInput = document.querySelector('[data-env-key="PAPERFLOW_NOTES_ROOT_DIR"]'); |
| 5246 | notesRootInput?.addEventListener("input", updateDerivedNotesPathsPreview); |
| 5247 | updateDerivedNotesPathsPreview(); |
| 5248 | if ($("cacheSizeStat")) $("cacheSizeStat").textContent = storageStats.cache_display || "-"; |
| 5249 | |
| 5250 | const env = envMap(data); |
| 5251 | const concurrency = envInfo(env, "PAPERFLOW_MAX_CONCURRENCY", "5"); |
| 5252 | const fallbackModel = envInfo(env, "PAPERFLOW_FALLBACK_LLM_MODEL", "GPT-4o"); |
| 5253 | if ($("maxConcurrencyInput")) $("maxConcurrencyInput").value = concurrency.value || "5"; |
| 5254 | if ($("fallbackModelInput")) $("fallbackModelInput").value = fallbackModel.value || "GPT-4o"; |
| 5255 | const sourcePrefs = data.source_preferences || {}; |
| 5256 | const reportPrefs = data.report_preferences || {}; |
| 5257 | const advanced = data.advanced || {}; |
| 5258 | $("settingEnableArxiv").checked = sourcePrefs.enable_arxiv !== false; |
| 5259 | $("settingEnableSemanticScholar").checked = sourcePrefs.enable_semantic_scholar !== false; |
| 5260 | $("settingEnableOpenReview").checked = sourcePrefs.enable_openreview !== false; |
| 5261 | $("settingEnableCustomRss").checked = Boolean(sourcePrefs.enable_custom_rss); |
| 5262 | renderSettingTags("settingArxivCategories", sourcePrefs.arxiv_categories || ["cs.CL", "cs.AI", "cs.IR", "cs.LG"]); |
| 5263 | setConferenceAccessMode(sourcePrefs.conference_access_mode || "public"); |
| 5264 | setEnvFieldValue("semanticScholarApiKey", env, "SEMANTIC_SCHOLAR_API_KEY"); |
| 5265 | setEnvFieldValue("openReviewUsername", env, "OPENREVIEW_USERNAME"); |
| 5266 | setEnvFieldValue("openReviewToken", env, "OPENREVIEW_TOKEN"); |
| 5267 | setEnvFieldValue("conferenceCookieFile", env, "PAPERFLOW_CONFERENCE_COOKIE_FILE", "", ["OPENREVIEW_COOKIE_FILE"]); |
| 5268 | updateSourceAuthStatus(sourcePrefs, env); |
| 5269 | renderConferenceSettings(sourcePrefs); |
| 5270 | renderRssUrls(sourcePrefs.custom_rss_urls || []); |
| 5271 | syncDailySourceControls(sourcePrefs); |
| 5272 | document.querySelectorAll("[data-pref-mode]").forEach((button) => { |
| 5273 | button.classList.toggle("active", button.dataset.prefMode === (reportPrefs.style || "standard")); |
| 5274 | }); |
| 5275 | $("directWriteFeishu").checked = Boolean(reportPrefs.write_feishu); |
no test coverage detected