Sourcery AI commited on
Commit
c07be57
1 Parent(s): 9ca54c4

'Refactored by Sourcery'

Browse files
Files changed (1) hide show
  1. server/backend.py +8 -13
server/backend.py CHANGED
@@ -128,14 +128,11 @@ def fetch_search_results(query):
128
  'limit': 3,
129
  })
130
 
131
- results = []
132
  snippets = ""
133
  for index, result in enumerate(search.json()):
134
  snippet = f'[{index + 1}] "{result["snippet"]}" URL:{result["link"]}.'
135
  snippets += snippet
136
- results.append({'role': 'system', 'content': snippets})
137
-
138
- return results
139
 
140
 
141
  def generate_stream(response, jailbreak):
@@ -205,12 +202,10 @@ def getJailbreak(jailbreak):
205
  :param jailbreak: Jailbreak instruction string
206
  :return: Jailbreak instructions if provided, otherwise None
207
  """
208
- if jailbreak != "default":
209
- special_instructions[jailbreak][0]['content'] += special_instructions['two_responses_instruction']
210
- if jailbreak in special_instructions:
211
- special_instructions[jailbreak]
212
- return special_instructions[jailbreak]
213
- else:
214
- return None
215
- else:
216
- return None
 
128
  'limit': 3,
129
  })
130
 
 
131
  snippets = ""
132
  for index, result in enumerate(search.json()):
133
  snippet = f'[{index + 1}] "{result["snippet"]}" URL:{result["link"]}.'
134
  snippets += snippet
135
+ return [{'role': 'system', 'content': snippets}]
 
 
136
 
137
 
138
  def generate_stream(response, jailbreak):
 
202
  :param jailbreak: Jailbreak instruction string
203
  :return: Jailbreak instructions if provided, otherwise None
204
  """
205
+ if jailbreak == "default":
206
+ return None
207
+ special_instructions[jailbreak][0]['content'] += special_instructions['two_responses_instruction']
208
+ if jailbreak not in special_instructions:
209
+ return None
210
+ special_instructions[jailbreak]
211
+ return special_instructions[jailbreak]