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:
1 parent
f4443dca4f
commit
4179fb1a0a
2 files changed
+15
No files matched your search
@@ -601,6 +601,10 @@ setKeyState();
|
|||||||
loadHealth();
|
loadHealth();
|
||||||
loadProjects();
|
loadProjects();
|
||||||
loadWorkers();
|
loadWorkers();
|
||||||
|
// 回访用户 key 已在 localStorage 里:初始化也要加载模型列表,
|
||||||
|
// 否则下拉永远只有默认项(此前只在点“保存”时调一次,
|
||||||
|
// 2026-10-27 实测:存过 key 后重开页面模型选不了)。
|
||||||
|
if (getKey()) loadRelayModels();
|
||||||
setInterval(function () { if ($("#projectSelect").value) loadTasks(); loadHealth(); }, 10000);
|
setInterval(function () { if ($("#projectSelect").value) loadTasks(); loadHealth(); }, 10000);
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -86,6 +86,17 @@ class ConsoleTestCase(unittest.TestCase):
|
|||||||
text = body.decode("utf-8")
|
text = body.decode("utf-8")
|
||||||
self.assertNotIn(self.owner_id, text)
|
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__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
Reference in new issue
Block a user