Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rag/improve file manage #393

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

SuperEver
Copy link
Contributor

No description provided.

@SuperEver SuperEver marked this pull request as ready for review December 17, 2024 02:15
@SuperEver SuperEver force-pushed the rag/improve_file_manage branch from 3bca1fe to 7bdeed6 Compare December 17, 2024 02:19
lazyllm/tools/rag/utils.py Outdated Show resolved Hide resolved
lazyllm/tools/rag/utils.py Outdated Show resolved Hide resolved
@@ -238,7 +304,7 @@ def list_kb_group_files(self, group: str = None, limit: Optional[int] = None, de
upload_status: Union[str, List[str]] = DocListManager.Status.all,
exclude_upload_status: Optional[Union[str, List[str]]] = None):
query = """
SELECT documents.doc_id, documents.path, documents.status, documents.metadata,
SELECT documents.doc_id, documents.path, documents.status, documents.meta,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里为什么要把metadata改名为meta

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sqlalchemy 的保留关键字,不能用metadata

lazyllm/tools/rag/utils.py Outdated Show resolved Hide resolved
def get_safe_delete_files(self):
ids = []
with self._db_lock, self._engine.connect() as conn:
stmt = select(KBDocument.doc_id).where(KBDocument.status.in_(["success", "failed"]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是不是也一次性把waiting的状态更新为failed,然后返回出来

lazyllm/tools/rag/doc_manager.py Outdated Show resolved Hide resolved
lazyllm/tools/rag/utils.py Outdated Show resolved Hide resolved
zhangyongchao added 6 commits December 19, 2024 13:53
   thread
2. add delete_obsolete_files in doclistmaager, it will find
   status==delting and reference_count==0 file to delete
3. Add reference_count, when adding to kbgroup document reference_count
   will be updated to +1, when deleting from kbgroup it will be updated
   to -1
4. Add KBOperationLogs, currently only deleting file operation will be
   recoreder
5. Modifiy worker thread. when group is default, it will check to delete
   obsolete file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants