gehnew commited on
Commit
19d2d4b
1 Parent(s): 77e4f34

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
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
- print('\n'.join(results))
133
- return results if results else None
 
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 ]