TahaFawzyElshrif commited on
Commit
ce212b0
·
1 Parent(s): 9c20148

working on queue, finalization

Browse files
Files changed (1) hide show
  1. Consumer.py +3 -3
Consumer.py CHANGED
@@ -27,7 +27,7 @@ redis_password = os.environ["REDIS_PASSWORD"]
27
 
28
 
29
 
30
- def model_call(request):
31
  # fill with last state
32
  try:
33
  state = json.loads(request['last_state'])
@@ -38,7 +38,7 @@ def model_call(request):
38
  }
39
 
40
  print(f"MODEL CALL WITH STATE {state} and PROMPT {request['prompt']} and MEMORY {request['memory']} and HT_TOKEN {request['ht_token']} and USER_EMAIL {request['user_email']} and USER_NAME {request['user_name']}")
41
- answer = get_response(request['prompt'], request['memory'],request['ht_token'],state,request['user_email'],request['user_name'])
42
 
43
  print(f"ANSWER {answer}")
44
  # drop unserlizable keys
@@ -74,7 +74,7 @@ def callback(ch, method, properties, body):
74
  # simulate processing
75
  token = decrypt_token_from_json(json.loads(recieved_msg['ht_token_encrypted_dumped']))
76
  print(f"TYPE {type(recieved_msg)}, CONTENT {recieved_msg} , TOKEN {token}")
77
- model_call(recieved_msg)
78
 
79
  # (put your logic here)
80
  print(f"CONSUMER {consumer_id}:::: Processing done")
 
27
 
28
 
29
 
30
+ def model_call(request,token):
31
  # fill with last state
32
  try:
33
  state = json.loads(request['last_state'])
 
38
  }
39
 
40
  print(f"MODEL CALL WITH STATE {state} and PROMPT {request['prompt']} and MEMORY {request['memory']} and HT_TOKEN {request['ht_token']} and USER_EMAIL {request['user_email']} and USER_NAME {request['user_name']}")
41
+ answer = get_response(request['prompt'], request['memory'],token,state,request['user_email'],request['user_name'])
42
 
43
  print(f"ANSWER {answer}")
44
  # drop unserlizable keys
 
74
  # simulate processing
75
  token = decrypt_token_from_json(json.loads(recieved_msg['ht_token_encrypted_dumped']))
76
  print(f"TYPE {type(recieved_msg)}, CONTENT {recieved_msg} , TOKEN {token}")
77
+ model_call(recieved_msg,token)
78
 
79
  # (put your logic here)
80
  print(f"CONSUMER {consumer_id}:::: Processing done")