Skip to content

[BUG]LIGHTRAG BUG #776

@Meteor-de

Description

@Meteor-de

Description

When the LightRAG retriever is enabled, the chat session's context appears to get "stuck" on the first document it interacts with. After successfully uploading and indexing two separate documents (Doc A and Doc B), if I start a new chat and select Doc B, the application still loads the knowledge graph from Doc A and generates answers based on Doc A's content.
This indicates that the session state, specifically the file_id used by the LightRAGRetrieverPipeline, is not being correctly updated or reset when a user initiates a new conversation with a different document.
If I ask a question that is highly relevant to the selected document, the system can provide a relatively accurate answer. In this case, a partial knowledge graph is generated, but the main structure of the graph still belongs to the previous document.
Furthermore, for some other documents, the system completely fails to provide any answer or display any graph at all.

在使用 LightRAG 检索器时,聊天会话的上下文似乎被“卡”在了它交互的第一个文档上。我分别上传并成功索引了两个不同的文档(文档A和文档B)后,如果我开启一个新聊天并选择文档B,应用程序仍然会加载文档A的知识图谱,并且基于文档A的内容进行回答。
这表明会话的状态,特别是 LightRAGRetrieverPipeline 使用的 file_id,在用户开启一个新对话并选择不同文档时,没有被正确地更新或重置。
如果选择正确的问题描述,他会给出比较准确的回答,会有部分图的产生,但是图的大体仍然是之前的。并且部分文件仍然完全无法给出回答和显示图。

已尝试的解决方法
1.重启应用程序 (python app.py)。
2.重新启动机器。
3.删除 ktem_app_data 目录以强制进行彻底的数据重置。

Reproduction steps

1.启用 LightRAG 检索器并启动应用
2.上传第一个文档,我们称之为 文档A.pdf。等待索引完成。
3.上传第二个不同的文档,文档B.pdf。等待其索引完成。
4.与 文档A.pdf 开始一个聊天会话,提出一个问题。此时知识图谱显示正确,回答也正确。
5.点击“新聊天”按钮,开启一个全新的对话。
6.在新的聊天窗口中,从文件列表中选择 文档B.pdf。
7.提出了一个与 文档B.pdf 内容相关的问题。

1.Launch the application with the LightRAG retriever enabled.
2.Upload the first document, Document_A.pdf, and wait for indexing to complete.
3.Upload a second, different document, Document_B.pdf, and wait for it to be indexed.
4.Start a chat session with Document_A.pdf and ask a question. The knowledge graph and the 5.answer are both correct at this point.
6.Click the "New Chat" button to start a fresh conversation.
7.In the new chat window, select Document_B.pdf from the file list.
8.Ask a question related to the content of Document_B.pdf.

Screenshots

![DESCRIPTION](LINK.png)

Logs

Retrievers [DocumentRetrievalPipeline(DS=<kotaemon.storages.docstores.lancedb.LanceDBDocumentStore object at 0x7f47604de980>, FSPath=PosixPath('/root/kotaemon/ktem_app_data/user_data/files/index_1'), Index=<class 'ktem.index.file.index.IndexTable'>, Source=<class 'ktem.index.file.index.Source'>, VS=<kotaemon.storages.vectorstores.chroma.ChromaVectorStore object at 0x7f47604dde40>, get_extra_table=False, llm_scorer=LLMTrulensScoring(concurrent=True, normalize=10, prompt_template=<kotaemon.llms.prompts.template.PromptTemplate object at 0x7f47cf2bc3d0>, system_prompt_template=<kotaemon.llms.prompts.template.PromptTemplate object at 0x7f47cf2bf520>, top_k=3, user_prompt_template=<kotaemon.llms.prompts.template.PromptTemplate object at 0x7f47cf2be9b0>), mmr=False, rerankers=[CohereReranking(base_url=None, cohere_api_key='<COHERE_API_KEY>', model_name='rerank-multilingual-v2.0')], retrieval_mode='hybrid', top_k=10, user_id='92021f5bde6949cca8dc7a6b2e983844'), GraphRAGRetrieverPipeline(DS=<theflow.base.unset_ object at 0x7f48325f0e20>, FSPath=<theflow.base.unset_ object at 0x7f48325f0e20>, Index=<class 'ktem.index.file.index.IndexTable'>, Source=<theflow.base.unset_ object at 0x7f48325f0e20>, VS=<theflow.base.unset_ object at 0x7f48325f0e20>, file_ids=[], user_id=<theflow.base.unset_ object at 0x7f48325f0e20>), LightRAGRetrieverPipeline(DS=<theflow.base.unset_ object at 0x7f48325f0e20>, FSPath=<theflow.base.unset_ object at 0x7f48325f0e20>, Index=<class 'ktem.index.file.index.IndexTable'>, Source=<theflow.base.unset_ object at 0x7f48325f0e20>, VS=<theflow.base.unset_ object at 0x7f48325f0e20>, file_ids=['219b3c04-784d-4c2f-b353-ef6610ff9e82'], search_type='local', user_id=<theflow.base.unset_ object at 0x7f48325f0e20>)]

Browsers

No response

OS

Linux

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions