Skip to content

Commit

Permalink
fix: 补上从插件更新逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
he0119 committed Dec 17, 2024
1 parent 5425c17 commit f518935
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/providers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,10 @@ def metadata(self) -> dict[str, Any]:

def update(self, store: StorePlugin) -> "RegistryPlugin":
"""根据商店数据更新注册表数据"""
return RegistryPlugin(**self.model_dump(), **store.model_dump())
# TODO: 如果 author_id 变化,应该重新获取 author
data = self.model_dump()
data.update(store.model_dump())
return RegistryPlugin(**data)


RegistryModels: TypeAlias = (
Expand Down
12 changes: 6 additions & 6 deletions src/providers/store_test/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,12 @@ async def sync_store(self):
self._previous_drivers[key] = self._store_drivers[key].to_registry()
for key in self._store_plugins:
if key in self._previous_plugins:
plugin_data = self._previous_plugins[key].model_dump()
# 更新插件数据,假设商店数据的数据没有问题的
# TODO: 如果 author_id 变化,应该重新获取 author
plugin_data.update(self._store_plugins[key].model_dump())
self._previous_plugins[key] = RegistryPlugin(**plugin_data)
# TODO: 如果插件不存在,尝试重新测试获取相关信息验证
self._previous_plugins[key] = self._previous_plugins[key].update(
self._store_plugins[key]
)
else:
# TODO: 如果插件不存在,尝试重新测试获取相关信息验证
pass

def generate_github_summary(self, results: dict[str, StoreTestResult]):
"""生成 GitHub 摘要"""
Expand Down

0 comments on commit f518935

Please sign in to comment.