File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
src/services/code-index/vector-store Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -157,8 +157,13 @@ export class QdrantVectorStore implements IVectorStore {
157157 * @param payload Payload to check
158158 * @returns Boolean indicating if the payload is valid
159159 */
160- private isPayloadValid ( payload : Record < string , unknown > ) : payload is Payload {
161- return "filePath" in payload && "codeChunk" in payload && "startLine" in payload && "endLine" in payload
160+ private isPayloadValid ( payload : Record < string , unknown > | null | undefined ) : payload is Payload {
161+ if ( ! payload ) {
162+ return false
163+ }
164+ const validKeys = [ "filePath" , "codeChunk" , "startLine" , "endLine" ]
165+ const hasValidKeys = validKeys . every ( ( key ) => key in payload )
166+ return hasValidKeys
162167 }
163168
164169 /**
@@ -205,7 +210,7 @@ export class QdrantVectorStore implements IVectorStore {
205210 }
206211
207212 const operationResult = await this . client . query ( this . collectionName , searchRequest )
208- const filteredPoints = operationResult . points . filter ( ( p ) => this . isPayloadValid ( p . payload ! ) )
213+ const filteredPoints = operationResult . points . filter ( ( p ) => this . isPayloadValid ( p . payload ) )
209214
210215 return filteredPoints as VectorStoreSearchResult [ ]
211216 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments