fix: 命令台初始化有 key 即加载模型列表 (#66)

回访用户 key 已在 localStorage 里:此前模型列表只在点“保存”
时加载一次,重开页面下拉永远只有默认项(2026-10-27 实测)。
初始化序列补 if (getKey()) loadRelayModels();单测补初始化
序列含该调用的标记断言。

另:公网 /relay/models 曾因 nginx 缺 /relay/ 代理返回 404,
与本修无关,nginx 侧另行补 location。

Co-authored-by: host <host@test.local>
This commit is contained in:
openqjandhost authored and GitHub committed 2026-10-27 03:33:35 +08:00
1 parent f4443dca4f
commit 4179fb1a0a
2 files changed
+15

No files matched your search

+11
View File
@@ -86,6 +86,17 @@ class ConsoleTestCase(unittest.TestCase):
text = body.decode("utf-8")
self.assertNotIn(self.owner_id, text)
def test_console_init_loads_relay_models(self):
# 回访用户 key 已在 localStorage 里:初始化序列必须含
# loadRelayModels 调用,否则模型下拉永远只有默认项
# (2026-10-27 实测:此前只在点“保存”时调一次)。
_status, _headers, body = self._get("/console")
text = body.decode("utf-8")
anchor = "setKeyState();\nloadHealth();\nloadProjects();\nloadWorkers();"
self.assertIn(anchor, text)
init = text[text.index(anchor):]
self.assertIn("if (getKey()) loadRelayModels();", init)
if __name__ == "__main__":
unittest.main()