Solshine commited on
Commit
e32f6a6
1 Parent(s): e2af929

indented bard's fix

Browse files
Files changed (1) hide show
  1. query.py +18 -18
query.py CHANGED
@@ -88,25 +88,25 @@ class VectaraQuery():
88
  # return 'Sorry, chat turns exceeds plan limit.'
89
  # return 'Sorry, something went wrong in my brain. Please try again later.'
90
 
91
- #from bard, of all places
92
- if res is not None and 'responseSet' in res and len(res['responseSet']) > 0:
93
- first_response = res['responseSet'][0]
94
- if 'summary' in first_response and len(first_response['summary']) > 0:
95
- first_summary = first_response['summary'][0]
96
- if 'chat' in first_summary:
97
- self.conv_id = first_summary['chat']['conversationId']
 
 
 
 
 
 
98
  else:
99
- # Handle the case where 'chat' is None
100
- print("Chat data not found in response summary")
101
- else:
102
- # Handle the case where 'summary' is missing or empty
103
- print("Response summary missing or empty")
104
- else:
105
- # Handle the case where 'responseSet' is missing, empty, or 'res' is None
106
- print("Response data unavailable")
107
-
108
- #end of bard fix for none value error
109
-
110
  pattern = r'\[\d{1,2}\]'
111
  matches = [match.span() for match in re.finditer(pattern, summary)]
112
 
 
88
  # return 'Sorry, chat turns exceeds plan limit.'
89
  # return 'Sorry, something went wrong in my brain. Please try again later.'
90
 
91
+ #from bard, of all places
92
+ if res is not None and 'responseSet' in res and len(res['responseSet']) > 0:
93
+ first_response = res['responseSet'][0]
94
+ if 'summary' in first_response and len(first_response['summary']) > 0:
95
+ first_summary = first_response['summary'][0]
96
+ if 'chat' in first_summary:
97
+ self.conv_id = first_summary['chat']['conversationId']
98
+ else:
99
+ # Handle the case where 'chat' is None
100
+ print("Chat data not found in response summary")
101
+ else:
102
+ # Handle the case where 'summary' is missing or empty
103
+ print("Response summary missing or empty")
104
  else:
105
+ # Handle the case where 'responseSet' is missing, empty, or 'res' is None
106
+ print("Response data unavailable")
107
+
108
+ #end of bard fix for none value error
109
+
 
 
 
 
 
 
110
  pattern = r'\[\d{1,2}\]'
111
  matches = [match.span() for match in re.finditer(pattern, summary)]
112