imbajin commented on code in PR #304:
URL:
https://github.com/apache/incubator-hugegraph-ai/pull/304#discussion_r2465613804
##########
hugegraph-llm/src/hugegraph_llm/demo/rag_demo/configs_block.py:
##########
@@ -106,6 +106,83 @@ def test_api_connection(
return resp.status_code
+def apply_vector_engine(engine: str):
+ # Persist the vector engine selection
+ setattr(index_settings, "cur_vector_index", engine)
+ try:
+ index_settings.update_env()
+ except Exception: # pylint: disable=W0718
+ pass
Review Comment:
‼️ **错误处理过于宽泛**: 使用了 bare `except Exception` 而没有记录或重新抛出异常,这会隐藏潜在的错误。
```python
try:
index_settings.update_env()
except Exception: # pylint: disable=W0718
pass # 静默失败,没有日志
```
建议:
```python
try:
index_settings.update_env()
except Exception as e:
log.warning("Failed to persist settings to .env: %s", e)
# 或者根据业务需求决定是否需要向用户显示错误
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]