Fix linting
This commit is contained in:
@@ -13,18 +13,6 @@ from fastapi import (
|
|||||||
from typing import Dict
|
from typing import Dict
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
# Global progress tracker
|
|
||||||
scan_progress: Dict = {
|
|
||||||
"is_scanning": False,
|
|
||||||
"current_file": "",
|
|
||||||
"indexed_count": 0,
|
|
||||||
"total_files": 0,
|
|
||||||
"progress": 0,
|
|
||||||
}
|
|
||||||
|
|
||||||
# Lock for thread-safe operations
|
|
||||||
progress_lock = threading.Lock()
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@@ -34,7 +22,7 @@ import logging
|
|||||||
import argparse
|
import argparse
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
from typing import List, Dict, Any, Optional, Union
|
from typing import List, Any, Optional, Union
|
||||||
from lightrag import LightRAG, QueryParam
|
from lightrag import LightRAG, QueryParam
|
||||||
from lightrag.api import __api_version__
|
from lightrag.api import __api_version__
|
||||||
|
|
||||||
@@ -57,8 +45,21 @@ import pipmaster as pm
|
|||||||
|
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
# Load environment variables
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
|
# Global progress tracker
|
||||||
|
scan_progress: Dict = {
|
||||||
|
"is_scanning": False,
|
||||||
|
"current_file": "",
|
||||||
|
"indexed_count": 0,
|
||||||
|
"total_files": 0,
|
||||||
|
"progress": 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
# Lock for thread-safe operations
|
||||||
|
progress_lock = threading.Lock()
|
||||||
|
|
||||||
|
|
||||||
def estimate_tokens(text: str) -> int:
|
def estimate_tokens(text: str) -> int:
|
||||||
"""Estimate the number of tokens in text
|
"""Estimate the number of tokens in text
|
||||||
|
@@ -463,7 +463,7 @@ def quantize_embedding(embedding: Union[np.ndarray, list], bits=8) -> tuple:
|
|||||||
# Convert list to numpy array if needed
|
# Convert list to numpy array if needed
|
||||||
if isinstance(embedding, list):
|
if isinstance(embedding, list):
|
||||||
embedding = np.array(embedding)
|
embedding = np.array(embedding)
|
||||||
|
|
||||||
# Calculate min/max values for reconstruction
|
# Calculate min/max values for reconstruction
|
||||||
min_val = embedding.min()
|
min_val = embedding.min()
|
||||||
max_val = embedding.max()
|
max_val = embedding.max()
|
||||||
|
Reference in New Issue
Block a user