fix(retrieval): bound automatic graph retrieval
This commit is contained in:
@@ -17,6 +17,8 @@ type PluginSearchEntity struct {
|
||||
knowledgeRepo interfaces.KnowledgeRepository
|
||||
}
|
||||
|
||||
const maxGraphChunkResults = 10
|
||||
|
||||
// NewPluginSearchEntity creates a new plugin search entity
|
||||
func NewPluginSearchEntity(
|
||||
eventManager *EventManager,
|
||||
@@ -200,6 +202,12 @@ func filterSeenChunk(ctx context.Context, graph *types.GraphData, searchResult [
|
||||
}
|
||||
seen[chunkID] = true
|
||||
chunkIDs = append(chunkIDs, chunkID)
|
||||
if len(chunkIDs) == maxGraphChunkResults {
|
||||
break
|
||||
}
|
||||
}
|
||||
if len(chunkIDs) == maxGraphChunkResults {
|
||||
break
|
||||
}
|
||||
}
|
||||
logger.Infof(ctx, "filterSeenChunk: new chunkIDs count: %d", len(chunkIDs))
|
||||
|
||||
Reference in New Issue
Block a user