Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -105,12 +105,15 @@ async def chat(query,history,sources,reports,subtype,year):
|
|
| 105 |
|
| 106 |
##------------------------decide which collection to fetch------------------------------
|
| 107 |
if len(reports) == 0:
|
|
|
|
| 108 |
vectorstore = vectorstores[sources]
|
| 109 |
else:
|
|
|
|
| 110 |
vectorstore = vectorstores["allreports"]
|
| 111 |
|
| 112 |
###-------------------------------------Construct Filter------------------------------------
|
| 113 |
if len(reports) == 0:
|
|
|
|
| 114 |
filter=rest.Filter(
|
| 115 |
must=[
|
| 116 |
rest.FieldCondition(
|
|
@@ -122,6 +125,7 @@ async def chat(query,history,sources,reports,subtype,year):
|
|
| 122 |
match=rest.MatchAny(any=year)
|
| 123 |
)])
|
| 124 |
else:
|
|
|
|
| 125 |
filter=rest.Filter(
|
| 126 |
must=[
|
| 127 |
rest.FieldCondition(
|
|
|
|
| 105 |
|
| 106 |
##------------------------decide which collection to fetch------------------------------
|
| 107 |
if len(reports) == 0:
|
| 108 |
+
print("selecting source:", sources)
|
| 109 |
vectorstore = vectorstores[sources]
|
| 110 |
else:
|
| 111 |
+
print("selecting source:","allreports")
|
| 112 |
vectorstore = vectorstores["allreports"]
|
| 113 |
|
| 114 |
###-------------------------------------Construct Filter------------------------------------
|
| 115 |
if len(reports) == 0:
|
| 116 |
+
print("defining filter for source")
|
| 117 |
filter=rest.Filter(
|
| 118 |
must=[
|
| 119 |
rest.FieldCondition(
|
|
|
|
| 125 |
match=rest.MatchAny(any=year)
|
| 126 |
)])
|
| 127 |
else:
|
| 128 |
+
print("defining filter for allreports")
|
| 129 |
filter=rest.Filter(
|
| 130 |
must=[
|
| 131 |
rest.FieldCondition(
|