From c011455dc4fc7cc171bdcacbbd7e9b1ce20d7a2b Mon Sep 17 00:00:00 2001
From: Huu Le <39040748+leehuwuj@users.noreply.github.com>
Date: Thu, 12 Sep 2024 13:51:48 +0700
Subject: [PATCH] fix cannot upload file (#286)

---
 templates/components/services/python/file.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/templates/components/services/python/file.py b/templates/components/services/python/file.py
index 9441db6e..d5267181 100644
--- a/templates/components/services/python/file.py
+++ b/templates/components/services/python/file.py
@@ -3,7 +3,7 @@ import mimetypes
 import os
 from io import BytesIO
 from pathlib import Path
-from typing import Any, List, Tuple
+from typing import List, Optional, Tuple
 
 from app.engine.index import IndexConfig, get_index
 from llama_index.core import VectorStoreIndex
@@ -72,7 +72,12 @@ class PrivateFileService:
         return documents
 
     @staticmethod
-    def process_file(file_name: str, base64_content: str, params: Any) -> List[str]:
+    def process_file(
+        file_name: str, base64_content: str, params: Optional[dict] = None
+    ) -> List[str]:
+        if params is None:
+            params = {}
+
         file_data, extension = PrivateFileService.preprocess_base64_file(base64_content)
 
         # Add the nodes to the index and persist it
-- 
GitLab