aymanemalih commited on
Commit
3716093
1 Parent(s): f6f07d4

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -6
main.py CHANGED
@@ -369,7 +369,7 @@ def perform_search_and_get_results_histroy_filter(collection_name, query, refere
369
  if paragraph_number:
370
  filters.append(models.FieldCondition(key="paragraph", match=models.MatchValue(value=paragraph_number+'a')))
371
  if characters:
372
- filters.append(models.FieldCondition(key="characters", match=models.MatchValue(value=characters+'a')))
373
  # Perform the search
374
  history_results = client.search(
375
  collection_name=collection_name,
@@ -399,11 +399,11 @@ def history():
399
  prompt = "\n".join([f"{msg['role']}: {msg['content']}" for msg in messages])
400
  search_results = perform_search_and_get_results('history', prompt)
401
  for result in search_results:
402
- history_answers = result.payload['reponse'].splite(',')
403
- for item in history_answers:
404
- result = perform_search_and_get_results_histroy_filter('paragraph2', query, item, 3)
405
- for res in result:
406
- if res.score > 0.85:
407
  finale_result.extend(res)
408
  return jsonify({'result_history': finale_result})
409
  else:
 
369
  if paragraph_number:
370
  filters.append(models.FieldCondition(key="paragraph", match=models.MatchValue(value=paragraph_number+'a')))
371
  if characters:
372
+ filters.append(models.FieldCondition(key="aligna", match=models.MatchValue(value=characters+'a')))
373
  # Perform the search
374
  history_results = client.search(
375
  collection_name=collection_name,
 
399
  prompt = "\n".join([f"{msg['role']}: {msg['content']}" for msg in messages])
400
  search_results = perform_search_and_get_results('history', prompt)
401
  for result in search_results:
402
+ if result.score > 0.80:
403
+ history_answers = result.payload['reponse'].splite(',')
404
+ for item in history_answers:
405
+ result = perform_search_and_get_results_histroy_filter('paragraph2', query, item, 3)
406
+ for res in result:
407
  finale_result.extend(res)
408
  return jsonify({'result_history': finale_result})
409
  else: