Kevin Hu commited on
Commit
ccbf14d
·
1 Parent(s): c020852

Fix preview issue in file manager. (#3846)

Browse files

### What problem does this PR solve?

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Files changed (2) hide show
  1. api/apps/file_app.py +7 -2
  2. rag/llm/rerank_model.py +0 -1
api/apps/file_app.py CHANGED
@@ -329,8 +329,13 @@ def get(file_id):
329
  e, file = FileService.get_by_id(file_id)
330
  if not e:
331
  return get_data_error_result(message="Document not found!")
332
- b, n = File2DocumentService.get_storage_address(file_id=file_id)
333
- response = flask.make_response(STORAGE_IMPL.get(b, n))
 
 
 
 
 
334
  ext = re.search(r"\.([^.]+)$", file.name)
335
  if ext:
336
  if file.type == FileType.VISUAL.value:
 
329
  e, file = FileService.get_by_id(file_id)
330
  if not e:
331
  return get_data_error_result(message="Document not found!")
332
+
333
+ blob = STORAGE_IMPL.get(file.parent_id, file.location)
334
+ if not blob:
335
+ b, n = File2DocumentService.get_storage_address(file_id=file_id)
336
+ blob = STORAGE_IMPL.get(b, n)
337
+
338
+ response = flask.make_response(blob)
339
  ext = re.search(r"\.([^.]+)$", file.name)
340
  if ext:
341
  if file.type == FileType.VISUAL.value:
rag/llm/rerank_model.py CHANGED
@@ -126,7 +126,6 @@ class YoudaoRerank(DefaultRerank):
126
  with YoudaoRerank._model_lock:
127
  if not YoudaoRerank._model:
128
  try:
129
- logging.info("LOADING BCE...")
130
  YoudaoRerank._model = RerankerModel(model_name_or_path=os.path.join(
131
  get_home_cache_dir(),
132
  re.sub(r"^[a-zA-Z0-9]+/", "", model_name)))
 
126
  with YoudaoRerank._model_lock:
127
  if not YoudaoRerank._model:
128
  try:
 
129
  YoudaoRerank._model = RerankerModel(model_name_or_path=os.path.join(
130
  get_home_cache_dir(),
131
  re.sub(r"^[a-zA-Z0-9]+/", "", model_name)))