ragflow/api/db/services
lgphone 7f80d7304d
Fix: Optimized the get_by_id method to resolve the issue of missing exceptions and improve query performance (#6320)
Fix: Optimized the get_by_id method to resolve the issue of missing
exceptions and improve query performance

### What problem does this PR solve?

Optimized the get_by_id method to resolve the issue of missing
exceptions and improve query performance.
Optimization details:
1. The original method used a custom query method that required
concatenating SQL, which impacted performance.
2. The query method returned a list, which needed to be accessed by
index, posing a risk of index out-of-bounds errors.
3. The original method used except Exception to catch all errors, which
is not a best practice in Python programming and may lead to missing
exceptions. The get_or_none method accurately catches DoesNotExist
errors while allowing other errors to be raised normally.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
- [x] Performance Improvement
2025-03-20 23:23:48 +08:00
..
__init__.py Fix errors detected by Ruff (#3918) 2024-12-08 14:21:12 +08:00
api_service.py Feat(api): Add dsl parameters to control whether dsl fields are included (#5769) 2025-03-07 16:58:00 +08:00
canvas_service.py Feat: add agent share team viewer (#6222) 2025-03-19 19:04:13 +08:00
common_service.py Fix: Optimized the get_by_id method to resolve the issue of missing exceptions and improve query performance (#6320) 2025-03-20 23:23:48 +08:00
conversation_service.py Fix issue of ask API. (#5400) 2025-02-26 19:45:22 +08:00
dialog_service.py Feat: add token comsumption & speed to little lamp. (#6077) 2025-03-14 13:37:31 +08:00
document_service.py Introduced task priority (#6118) 2025-03-14 23:43:46 +08:00
file2document_service.py Tagging (#4426) 2025-01-09 17:07:21 +08:00
file_service.py Improve API Documentation, Standardize Error Handling, and Enhance Comments (#5990) 2025-03-13 19:06:50 +08:00
knowledgebase_service.py Fix: fix document concurrent upload issue (#6095) 2025-03-14 16:31:44 +08:00
llm_service.py Feat: add vision LLM PDF parser (#6173) 2025-03-18 14:52:20 +08:00
task_service.py Introduced task priority (#6118) 2025-03-14 23:43:46 +08:00
user_canvas_version.py Feat: support agent version history. (#6130) 2025-03-19 15:22:53 +08:00
user_service.py Improve API Documentation, Standardize Error Handling, and Enhance Comments (#5990) 2025-03-13 19:06:50 +08:00