Spaces:
Sleeping
Sleeping
Commit
·
586cd83
1
Parent(s):
1869c8c
internal server error resolved
Browse files- __pycache__/main.cpython-310.pyc +0 -0
- components/Database.py +5 -4
- main.py +3 -2
__pycache__/main.cpython-310.pyc
ADDED
|
Binary file (7 kB). View file
|
|
|
components/Database.py
CHANGED
|
@@ -3,9 +3,10 @@ Contain Wrapper Class for ChormaDB client, that can process and store documents
|
|
| 3 |
"""
|
| 4 |
|
| 5 |
# for chromaDB
|
| 6 |
-
__import__(
|
| 7 |
import sys
|
| 8 |
-
|
|
|
|
| 9 |
|
| 10 |
from io import BytesIO
|
| 11 |
from typing import List
|
|
@@ -30,7 +31,7 @@ class AdvancedClient:
|
|
| 30 |
self.exsisting_collections = [
|
| 31 |
collection.name for collection in self.client.list_collections()
|
| 32 |
]
|
| 33 |
-
self.selected_collections = []
|
| 34 |
|
| 35 |
def create_or_get_collection(
|
| 36 |
self,
|
|
@@ -106,7 +107,7 @@ class AdvancedClient:
|
|
| 106 |
message=f"No collection is selected using all the exsisting collections, total collections : {len(self.exsisting_collections)}"
|
| 107 |
)
|
| 108 |
collections = [self.client.get_collection("UNION")]
|
| 109 |
-
self.selected_collections = collections
|
| 110 |
else:
|
| 111 |
collections = [
|
| 112 |
self.client.get_collection(collection_name)
|
|
|
|
| 3 |
"""
|
| 4 |
|
| 5 |
# for chromaDB
|
| 6 |
+
__import__("pysqlite3")
|
| 7 |
import sys
|
| 8 |
+
|
| 9 |
+
sys.modules["sqlite3"] = sys.modules.pop("pysqlite3")
|
| 10 |
|
| 11 |
from io import BytesIO
|
| 12 |
from typing import List
|
|
|
|
| 31 |
self.exsisting_collections = [
|
| 32 |
collection.name for collection in self.client.list_collections()
|
| 33 |
]
|
| 34 |
+
self.selected_collections: List[str] = []
|
| 35 |
|
| 36 |
def create_or_get_collection(
|
| 37 |
self,
|
|
|
|
| 107 |
message=f"No collection is selected using all the exsisting collections, total collections : {len(self.exsisting_collections)}"
|
| 108 |
)
|
| 109 |
collections = [self.client.get_collection("UNION")]
|
| 110 |
+
self.selected_collections = [collection.name for collection in collections]
|
| 111 |
else:
|
| 112 |
collections = [
|
| 113 |
self.client.get_collection(collection_name)
|
main.py
CHANGED
|
@@ -105,8 +105,8 @@ async def clear_inactive_conversations():
|
|
| 105 |
del conversations[conv_id]
|
| 106 |
if conv_id in last_activity:
|
| 107 |
del last_activity[conv_id]
|
| 108 |
-
if conv_id in
|
| 109 |
-
del
|
| 110 |
logger.info(f"Cleared {len(inactive_convos)} inactive conversations")
|
| 111 |
await asyncio.sleep(60) # Check every minute
|
| 112 |
|
|
@@ -197,6 +197,7 @@ async def get_response_streaming(user_query: UserInput):
|
|
| 197 |
except:
|
| 198 |
conversations[conv_id] = []
|
| 199 |
conversation_history = []
|
|
|
|
| 200 |
rephrased_query = llm.HyDE(
|
| 201 |
query=user_query.Query, message_history=conversation_history
|
| 202 |
)
|
|
|
|
| 105 |
del conversations[conv_id]
|
| 106 |
if conv_id in last_activity:
|
| 107 |
del last_activity[conv_id]
|
| 108 |
+
if conv_id in COLLECTIONS:
|
| 109 |
+
del COLLECTIONS[conv_id]
|
| 110 |
logger.info(f"Cleared {len(inactive_convos)} inactive conversations")
|
| 111 |
await asyncio.sleep(60) # Check every minute
|
| 112 |
|
|
|
|
| 197 |
except:
|
| 198 |
conversations[conv_id] = []
|
| 199 |
conversation_history = []
|
| 200 |
+
|
| 201 |
rephrased_query = llm.HyDE(
|
| 202 |
query=user_query.Query, message_history=conversation_history
|
| 203 |
)
|