File size: 1,643 Bytes
e785be9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import sys
import os
sys.path.append(os.getcwd())
from app.services.memory_service import memory_service

def debug_search():
    print("--- Debugging Qdrant Memory ---")
    
    # 1. List all names
    print("Fetching snippets...")
    try:
        res = memory_service.client.scroll(
            collection_name="faces",
            limit=50,
            with_payload=True,
            with_vectors=False
        )
        points = res[0]
        print(f"Total Points Found: {len(points)}")
        
        names = []
        for p in points:
            name = p.payload.get('name', 'Unknown')
            names.append(name)
            print(f" - Payload: {p.payload}")
            
        print("\n--- Testing Search ---")
        names = ["emraan", "amir", "test"] 
        for test_name in names:
            print(f"\n--- Checking '{test_name}' ---")
            matches = memory_service.search_by_text(test_name)
            if matches:
                p = matches[0]
                name = p.payload.get("name")
                audio = p.payload.get("audio_base64")
                image = p.payload.get("image_base64") # Check for image
                
                audio_len = len(audio) if audio else 0
                image_len = len(image) if image else 0
                
                print(f"Found: {name}")
                print(f"Audio Present: {bool(audio)} ({audio_len} chars)")
                print(f"Image Present: {bool(image)} ({image_len} chars)")
            else:
                print("Not found.")

    except Exception as e:
        print(f"Error: {e}")

if __name__ == "__main__":
    debug_search()