Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -107,8 +107,9 @@ def set_DRlink(dr_link: str):
|
|
| 107 |
print("DR Link set")
|
| 108 |
#chat_history = []
|
| 109 |
#history = []
|
| 110 |
-
|
| 111 |
-
dr_link_url = 'https://repository.lib.cuhk.edu.hk/en/islandora/object/cuhk%3A'+ dr_link + '/datastream/PDF/'
|
|
|
|
| 112 |
#app.DR_LINK = dr_link
|
| 113 |
hdr = { 'User-Agent' : user_agent }
|
| 114 |
|
|
@@ -250,7 +251,7 @@ def build_qa_chain(collection_name, vector_db, file: str):
|
|
| 250 |
# vincent fix InvalidCollectionException 20250212
|
| 251 |
#collection_name = create_collection_name(list_file_path[0])
|
| 252 |
#collection_name = file.name
|
| 253 |
-
collection_name = "
|
| 254 |
|
| 255 |
vector_db = Chroma.from_documents(
|
| 256 |
documents=chunked_documents,
|
|
@@ -363,7 +364,7 @@ def render_file(file):
|
|
| 363 |
|
| 364 |
def purge_chat_and_render_first(file):
|
| 365 |
print("purge_chat_and_render_first")
|
| 366 |
-
print("file class= "+ str(type(file)))
|
| 367 |
# Purges the previous chat session so that the bot has no concept of previous documents
|
| 368 |
chat_history = []
|
| 369 |
history = []
|
|
|
|
| 107 |
print("DR Link set")
|
| 108 |
#chat_history = []
|
| 109 |
#history = []
|
| 110 |
+
|
| 111 |
+
#dr_link_url = 'https://repository.lib.cuhk.edu.hk/en/islandora/object/cuhk%3A'+ dr_link + '/datastream/PDF/'
|
| 112 |
+
dr_link_url = dr_link_url1 + dr_link + dr_link_url2
|
| 113 |
#app.DR_LINK = dr_link
|
| 114 |
hdr = { 'User-Agent' : user_agent }
|
| 115 |
|
|
|
|
| 251 |
# vincent fix InvalidCollectionException 20250212
|
| 252 |
#collection_name = create_collection_name(list_file_path[0])
|
| 253 |
#collection_name = file.name
|
| 254 |
+
collection_name = "pdf_docs_"+file.name[-10:]
|
| 255 |
|
| 256 |
vector_db = Chroma.from_documents(
|
| 257 |
documents=chunked_documents,
|
|
|
|
| 364 |
|
| 365 |
def purge_chat_and_render_first(file):
|
| 366 |
print("purge_chat_and_render_first")
|
| 367 |
+
#print("file class= "+ str(type(file)))
|
| 368 |
# Purges the previous chat session so that the bot has no concept of previous documents
|
| 369 |
chat_history = []
|
| 370 |
history = []
|