Repository navigation
[1410] 修复 /login 后 /model 与 --list-models 看不到新登录 provider - #16
Open
PinkMagicFly wants to merge 2 commits into
Open
PinkMagicFly wants to merge 2 commits into
PinkMagicFly wants to merge 2 commits into
Conversation
da-liii
force-pushed
the
da/1410/task
branch
from
November 23, 2026 16:04
b65852c to
9d88dac
Compare
CI check 作业报 tui/liii/pi/tui/interactive/worker.scm 需要格式化, 运行 gf fmt 后该文件通过 gf fmt --check 与 gf check。
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.
问题
/login一个新 provider 后,/model与--list-models都看不到该 provider,因为:pi-save-auth-key只写auth.json,从不写models/providers.json白名单pi-app-models在启动时一次性构建后只读不刷新;reload_models只更新 worker,不发事件回主 app修复(对齐上游 pi completeProviderAuthentication + synchronizeCredentialState)
ai/liii/pi/ai/auth.scm:pi-save-auth-key在原子写auth.json之后,把 provider id 以不重复追加方式合并进models/providers.json白名单(读现状,缺失回退内置全集,原子落盘)。保持 ai 层纯净,仅用 ai 层 + 标准库原语实现,不反向 import code 层(避免循环依赖)。tui/liii/pi/tui/interactive/worker.scm:%worker-reload-cfg增加event-chan参数,在pi-build-user-catalog重建成功后投递(models_updated dir-str)事件回主 app(失败静默忽略)。tui/liii/pi/tui/interactive/app-events.scm:%pi-app-handle-event!新增models_updated分支,按事件 config-dir 调pi-app-model-catalog重建 models/default-model,写回 state 并重渲。重建全程 catch,失败不崩溃。测试
pi-save-auth-key-test.scm:断言保存 key 后白名单含该 provider,既有 provider 不被覆盖,重复登录幂等models-updated-event-test.scm:models_updated 事件后 pi-app-models/default-model 重建reload-models-event-test.scm:reload_models 成功后投递 models_updated 事件login-models-refresh-test.scm:login → 白名单 → reload_models → models_updated → app 刷新全链路pi-app-submit-login-bang-test.scm:通过 GF_CONFIG_DIR 重定向验证 login 写白名单并投递 reload_models验证
gf fmt --check与gf check全部通过