fix: 优化上游模型同步的写回逻辑,采用增量 JSONB merge,避免脱敏的 credentials 覆盖或丢失原有敏感字段
This commit is contained in:
@@ -172,10 +172,10 @@ def test_sync_upstream_models_workflow(db_session, monkeypatch):
|
||||
assert item_1001.model_count == 2
|
||||
assert item_1001.models == ["gpt-3.5-turbo", "gpt-4"]
|
||||
|
||||
# 1001 的 update 应当 merge credentials
|
||||
# 1001 的 update 应当只传递增量的 model_mapping,防止敏感字段丢失
|
||||
assert len(update_calls) == 1
|
||||
assert update_calls[0][0] == "1001"
|
||||
assert update_calls[0][1]["credentials"]["api_key"] == "k1"
|
||||
assert "api_key" not in update_calls[0][1]["credentials"]
|
||||
assert update_calls[0][1]["credentials"]["model_mapping"] == {
|
||||
"gpt-3.5-turbo": "gpt-3.5-turbo",
|
||||
"gpt-4": "gpt-4"
|
||||
|
||||
Reference in New Issue
Block a user