Merge pull request #254 from devchat-ai/update_askcode_summary
Updated askcode_summary_index.py for better file indexing
This commit is contained in:
commit
3d0f9a8f85
@ -7,6 +7,7 @@ from chat.ask_codebase.indexing.module_summary import SummaryWrapper
|
|||||||
|
|
||||||
# 为已经分析的文件记录最后修改时间
|
# 为已经分析的文件记录最后修改时间
|
||||||
g_file_last_modified_saved = {}
|
g_file_last_modified_saved = {}
|
||||||
|
g_file_need_index = {}
|
||||||
|
|
||||||
def load_file_last_modified(filePath: str):
|
def load_file_last_modified(filePath: str):
|
||||||
if not os.path.exists(filePath):
|
if not os.path.exists(filePath):
|
||||||
@ -37,6 +38,7 @@ def is_file_modified(filePath: str, supportedFileTypes) -> bool:
|
|||||||
|
|
||||||
for part in relativePath.split(os.sep):
|
for part in relativePath.split(os.sep):
|
||||||
if part.startswith('.'):
|
if part.startswith('.'):
|
||||||
|
print("Not hidden file: ", filePath)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
fileLastModified = g_file_last_modified_saved.get(relativePath, 0)
|
fileLastModified = g_file_last_modified_saved.get(relativePath, 0)
|
||||||
@ -45,19 +47,24 @@ def is_file_modified(filePath: str, supportedFileTypes) -> bool:
|
|||||||
if fileLastModified != fileCurrentModified:
|
if fileLastModified != fileCurrentModified:
|
||||||
g_file_last_modified_saved[relativePath] = fileCurrentModified
|
g_file_last_modified_saved[relativePath] = fileCurrentModified
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def custom_file_filter(file_path: str, supportedFileTypes) -> bool:
|
def custom_file_filter(file_path: str, supportedFileTypes) -> bool:
|
||||||
needIndex = simple_file_filter(file_path)
|
needIndex = False
|
||||||
if not needIndex:
|
file_path = os.path.abspath(file_path)
|
||||||
print("==> ", file_path, needIndex)
|
if file_path in g_file_need_index:
|
||||||
return needIndex
|
return g_file_need_index[file_path]
|
||||||
|
|
||||||
|
# check size of true value in g_file_need_index > 100
|
||||||
|
if sum(g_file_need_index.values()) > 100:
|
||||||
|
return False
|
||||||
|
|
||||||
if os.path.isdir(file_path):
|
if os.path.isdir(file_path):
|
||||||
needIndex = True
|
needIndex = True
|
||||||
else:
|
else:
|
||||||
needIndex = is_file_modified(file_path, supportedFileTypes)
|
needIndex = is_file_modified(file_path, supportedFileTypes)
|
||||||
print("==> ", file_path, needIndex)
|
g_file_need_index[file_path] = needIndex
|
||||||
|
|
||||||
return needIndex
|
return needIndex
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user