File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -221,11 +221,25 @@ def query_agent(sock):
221221 assert 'data' in data
222222 query = data ['data' ]
223223 status .clear_report ()
224- response = agent .invoke ({'input' : query }, config = callbacks or {})
224+ response = agent .invoke (
225+ {'input' : query },
226+ config = callbacks or {}
227+ )
225228 ai_response = response ['output' ]
226- formatted_output = {'type' : 'message' , 'data' : f'{ ai_response } ' }
229+ formatted_output = {
230+ 'type' : 'message' ,
231+ 'data' : (
232+ f'{ ai_response } '
233+ )
234+ }
227235 sock .send (json .dumps (formatted_output ))
228236 except json .JSONDecodeError :
229- sock .send (json .dumps ({'type' : 'error' , 'data' : 'Invalid JSON format' }))
237+ sock .send (json .dumps ({
238+ 'type' : 'error' ,
239+ 'data' : 'Invalid JSON format'
240+ }))
230241 except Exception as e :
231- sock .send (json .dumps ({'type' : 'error' , 'data' : f'Error: { str (e )} ' }))
242+ sock .send (json .dumps ({
243+ 'type' : 'error' ,
244+ 'data' : f'Error: { str (e )} '
245+ }))
Original file line number Diff line number Diff line change @@ -40,6 +40,11 @@ def run_all_attacks(
4040 results = suite .run ()
4141 return {"success" : True , "results" : results }
4242 else :
43- return {"success" : False , "error" : "JSON is invalid. No attacks run." }
43+ return {
44+ "success" : False ,
45+ "error" : (
46+ "JSON is invalid. No attacks run."
47+ )
48+ }
4449 except Exception as e :
4550 return {"success" : False , "error" : f"Failed to run attacks: { str (e )} " }
You can’t perform that action at this time.
0 commit comments