Skip to content

[BUG] LightRAG file selection #561

@newbie-Li

Description

@newbie-Li

Description

select "Search All" or select any group in "Search in Files", empty file_ids will be sent to retriever pipeline

libs\ktem\ktem\index\file\graph\graph_index.GraphRAGIndex -> get_retriever_pipelines

import:

from typing import Any
from sqlalchemy.orm import Session
import json

from ktem.index.file import FileIndex
from ktem.db.models import engine

from ..base import BaseFileIndexIndexing, BaseFileIndexRetriever
from .pipelines import GraphRAGIndexingPipeline, GraphRAGRetrieverPipeline

replace is_all, sel_ids, _ = selected with:

is_all, sel_ids, _ = selected
        if is_all == "all":
            Index = self._resources.get("Index")
            with Session(engine) as session:
                all_id = session.query(Index.source_id).filter(Index.relation_type == "graph").all()
                file_ids = [i[0] for i in all_id]
        else:
            file_ids = []
            for item in sel_ids:
                if item.startswith("["):
                    group_file_ids = json.loads(item)
                    file_ids.extend(group_file_ids)
                else:
                    file_ids.append(item)

Reproduction steps

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

Screenshots

![image](https://github.com/user-attachments/assets/907929ab-b59b-443d-a795-8896418f361a)

Logs

No response

Browsers

No response

OS

No response

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