alexkueck commited on
Commit
ec58244
1 Parent(s): cf84b0f

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +24 -0
utils.py CHANGED
@@ -835,6 +835,7 @@ def download_link(doc):
835
  #################################################
836
  #File Liste beim Tab für File-Upload schön darstellen
837
  #################################################
 
838
  def display_files():
839
  files = os.listdir(DOCS_DIR_PDF)
840
  files_table = "<table style='width:100%; border-collapse: collapse;'>"
@@ -858,6 +859,29 @@ def display_files():
858
  files_table += f"<td><b>{download_link(file)}</b></td></tr>"
859
  files_table += "</table>"
860
  return files_table
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
861
 
862
 
863
  # gefundene relevante Dokumente auflisten (links)
 
835
  #################################################
836
  #File Liste beim Tab für File-Upload schön darstellen
837
  #################################################
838
+ """
839
  def display_files():
840
  files = os.listdir(DOCS_DIR_PDF)
841
  files_table = "<table style='width:100%; border-collapse: collapse;'>"
 
859
  files_table += f"<td><b>{download_link(file)}</b></td></tr>"
860
  files_table += "</table>"
861
  return files_table
862
+ """
863
+
864
+ def display_files():
865
+ files_table = "<table style='width:100%; border-collapse: collapse;'>"
866
+
867
+ # PDF-Dateien
868
+ files_table += "<tr style='background-color: #930BBA; color: white; font-weight: bold; font-size: larger;'><th>Dateiname - PDF-Ordner</th></tr>"
869
+ pdf_files = [f for f in list_repo_files(repo_id=STORAGE_REPO_ID, repo_type="space", token=hf_token) if f.endswith('.pdf') and f.startswith("chroma/kkg/pdf/")]
870
+ for i, file in enumerate(pdf_files):
871
+ row_color = "#4f4f4f" if i % 2 == 0 else "#3a3a3a"
872
+ files_table += f"<tr style='background-color: {row_color}; border-bottom: 1px solid #ddd;'>"
873
+ files_table += f"<td><b>{file.split('/')[-1]}</b></td></tr>"
874
+
875
+ # Word-Dateien
876
+ files_table += "<tr style='background-color: #930BBA; color: white; font-weight: bold; font-size: larger;'><th>Dateiname - Word-Ordner</th></tr>"
877
+ word_files = [f for f in list_repo_files(repo_id=STORAGE_REPO_ID, repo_type="space", token=hf_token) if f.endswith('.docx') and f.startswith("chroma/kkg/word/")]
878
+ for i, file in enumerate(word_files):
879
+ row_color = "#4f4f4f" if i % 2 == 0 else "#3a3a3a"
880
+ files_table += f"<tr style='background-color: {row_color}; border-bottom: 1px solid #ddd;'>"
881
+ files_table += f"<td><b>{file.split('/')[-1]}</b></td></tr>"
882
+
883
+ files_table += "</table>"
884
+ return files_table
885
 
886
 
887
  # gefundene relevante Dokumente auflisten (links)