Skip to content

Fix setup credentials for active profile#838

Open
lucyonegit wants to merge 1 commit into
fathah:mainfrom
lucyonegit:fix/setup-active-profile-key
Open

Fix setup credentials for active profile#838
lucyonegit wants to merge 1 commit into
fathah:mainfrom
lucyonegit:fix/setup-active-profile-key

Conversation

@lucyonegit

Copy link
Copy Markdown

问题描述

在初始化 Setup 页面配置模型 Provider 和 API Key 时,桌面端没有把当前正在配置的 active profile 传给保存逻辑。

对于新用户来说通常不会暴露问题,因为没有 active_profile 时系统默认使用 default profile,Setup 保存和后续读取都会落在 default

但对于已有多个 profile 的用户,如果当前 active profile 不是 default,例如 work,启动时发现当前 profile 缺少 API Key 并进入 Setup,用户在 Setup 中填写 DashScope / Qwen Key 后,配置可能被写入默认 profile,而不是当前 active profile。进入应用后仍然读取当前 profile,导致用户刚刚填写的 Key 没有生效,看起来像“初始化页配置没有带进来”。

解决方案

让 Setup 页面明确接收当前 active profile,并在保存 API Key 和模型配置时传递该 profile。

具体调整:

  • App 在安装检查时读取 checkInstall() 返回的 activeProfile
  • 如果没有 active profile,则兜底为 default
  • 将该 profile 传入 Setup 页面
  • Setup 保存 setEnv 时带上 profile
  • Setup 保存 setModelConfig 时带上 profile
  • 添加回归测试,验证 DashScope API Key 会保存到当前 setup profile,而不是隐式写入默认 profile

影响范围

  • 新用户行为保持一致:仍然使用 default profile
  • 多 profile 用户行为修复:Setup 中填写的配置会写入当前 active profile
  • 不改变 provider 映射、模型选择、OAuth 逻辑

@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes the first-run setup flow save credentials for the active profile.

  • Stores the setup profile from checkInstall() in App.
  • Passes the setup profile into the Setup screen.
  • Sends the profile to setEnv and setModelConfig.
  • Adds a DashScope regression test for named-profile setup.
  • Documents the profile-aware setup behavior.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
src/renderer/src/App.tsx Adds setup-profile state from the install check and passes it to setup.
src/renderer/src/screens/Setup/Setup.tsx Forwards the optional profile to credential and model-config writes.
src/renderer/src/screens/Setup/Setup.test.tsx Adds regression coverage for saving DashScope setup data to a named profile.
lat.md/provider-setup.md Documents that setup writes credentials and config to the active profile.

Reviews (1): Last reviewed commit: "Fix setup credentials for active profile" | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant