Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -129,8 +129,9 @@ def vector_search(index,index_1, query_embedding, k=3, threshold=0.5):
|
|
129 |
for i in range(k):
|
130 |
if distances[0][i] > 0.4: # 余弦相似度的距离应该是越大越相似
|
131 |
results.append(docs[indices[0][i]])
|
132 |
-
|
133 |
-
|
|
|
134 |
def resume_QA(message, history):
|
135 |
if history is not None:
|
136 |
user_q= [m[0] for m in history ]
|
|
|
129 |
for i in range(k):
|
130 |
if distances[0][i] > 0.4: # 余弦相似度的距离应该是越大越相似
|
131 |
results.append(docs[indices[0][i]])
|
132 |
+
if not results:
|
133 |
+
results.append(docs[indices[0][0]])
|
134 |
+
return results
|
135 |
def resume_QA(message, history):
|
136 |
if history is not None:
|
137 |
user_q= [m[0] for m in history ]
|