feat: 登录页/首页/设置入口与自定义模型配置页 UX 优化 - #34
Merged
Merged
Conversation
- 登录页:Turnstile 人机验证组件容器内居中;背景从渐变改为统一 bg-dark-primary,消除与全站色差 - 首页:搜索框示例文案替换(去掉「把 minimax 加入港股通」示例) - 设置入口:未登录时显示在顶部导航登录按钮左侧的齿轮图标;登录后顶部不显示、只在页脚显示——任何登录状态全站唯一入口 - 自定义模型:只保留 OpenAI 兼容 / Anthropic 兼容两种接口类型(不指定提供商),每种提供 API Key 与 Base URL 配置,Base URL 随账户存 localStorage - 重新生成 FA 图标子集(新增 fa-gear) Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Pull request overview
本 PR 聚焦于前端 UX:统一登录页背景与 Turnstile 布局、更新首页搜索示例,并重构“自定义模型设置”入口与配置方式(从具体 provider 列表调整为两类兼容接口的配置入口)。
Changes:
- 登录页视觉统一:AuthLayout 背景改为
bg-dark-primary,Turnstile 组件居中对齐。 - 首页搜索框示例文案更新,移除不合适的示例指令。
- 设置入口与自定义模型配置页调整:Header/Footer 的入口分流;新增
customModelConfig用于保存自定义 Base URL(localStorage)。
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| web/frontend/src/lib/customModelConfig.ts | 新增自定义模型 Base URL 的本地存储读写封装(按 userId + type 隔离)。 |
| web/frontend/src/components/site/SiteHeader.tsx | 移除导航里的“自定义模型”,未登录时在登录按钮左侧增加齿轮入口。 |
| web/frontend/src/components/site/SiteFooter.tsx | 登录后在页脚显示“自定义模型”入口,并引入 useAuth 做条件渲染。 |
| web/frontend/src/components/site/SearchBar.tsx | 更新搜索框 placeholder 示例文案。 |
| web/frontend/src/components/auth/Turnstile.tsx | Turnstile 容器增加 flex 居中布局。 |
| web/frontend/src/components/auth/AuthLayout.tsx | 登录页背景从渐变改为 bg-dark-primary。 |
| web/frontend/src/app/settings/page.tsx | 重构“自定义模型设置”页:改为两类兼容接口(API Key + Base URL)表单与保存逻辑。 |
Suppressed comments (3)
web/frontend/src/app/settings/page.tsx:37
- 这里把 localStorage 的 KEY 按 CustomModelType(openai-compatible / anthropic-compatible)保存,但分析启动时读取本地 KEY 是按 llm_provider(例如 'openai' / 'anthropic')查找(见 AnalysisConfigForm 对 hasLocalKey(formData.llm_provider) 的用法)。这会导致在本页保存的 API Key 实际不会被分析流程命中。建议在保存/清除本地 KEY 时映射到真实 providerKey(openai/anthropic)。
const save = (type: CustomModelType) => {
if (!user) return;
const keyVal = keyDrafts[type]?.trim();
if (keyVal) saveLocalKey(type, keyVal);
customModelConfig.saveBaseUrl(user.id, type, urlDrafts[type] ?? '');
web/frontend/src/app/settings/page.tsx:76
- UI 上的「已配置」状态同样使用了 hasLocalKey(t.key)(openai-compatible / anthropic-compatible),即使你已按 openai/anthropic 保存了本地 KEY,这里也会显示为未配置并给出错误 placeholder。建议与保存逻辑一致:对 hasLocalKey 做同样的 providerKey 映射。
{CUSTOM_MODEL_TYPES.map((t) => {
const has = user ? hasLocalKey(t.key) : false;
const keyDraft = keyDrafts[t.key] ?? '';
const urlDraft = urlDrafts[t.key] ?? '';
const urlDirty = user ? urlDraft.trim() !== (customModelConfig.getBaseUrl(user.id, t.key) || t.defaultBaseUrl) : false;
web/frontend/src/app/settings/page.tsx:61
- 本页支持配置 Base URL,但当前分析请求的 backend_url 是由 AnalysisConfigForm 从 llmSettings/systemDefault/config 推导的 effectiveBackendUrl 生成,并不会读取这里保存的 customModelConfig Base URL。因此「配置后,分析将优先使用你的自定义模型」这类表述(以及 Base URL 表单)目前不会产生预期效果。建议:要么把 customModelConfig.getBaseUrl(...) 接入生成 backend_url 的逻辑(按 provider/type 覆盖),要么调整文案/移除未生效的配置项。
配置仅写入浏览器 localStorage(按账户隔离),不会随分析请求持久化到服务端,也不会出现在公开报告中。
清除浏览器数据将一并清除。配置后,分析将优先使用你的自定义模型。
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+16
to
+28
| // 登录用户变化 / 首挂载时,用已保存的 Base URL(或默认值)填充表单 | ||
| useEffect(() => { | ||
| if (!user) return; | ||
| setUrlDrafts((prev) => { | ||
| const next = { ...prev }; | ||
| for (const t of CUSTOM_MODEL_TYPES) { | ||
| if (next[t.key] == null) { | ||
| next[t.key] = customModelConfig.getBaseUrl(user.id, t.key) || t.defaultBaseUrl; | ||
| } | ||
| } | ||
| return next; | ||
| }); | ||
| }, [user]); |
Comment on lines
+22
to
+24
| {/* 未登录时设置入口在顶部导航(登录按钮左侧的齿轮图标); | ||
| 登录后顶部不再显示,只保留这里 —— 任何状态全站只有一个入口 */} | ||
| {user && <Link href="/settings" className="hover:text-text-secondary">自定义模型</Link>} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动
验证
🤖 Generated with Claude Code