DiamondYin commited on
Commit
6eb8c22
1 Parent(s): ba55863

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -98,10 +98,12 @@ def get_response(history, audio_input):
98
  LOGGER.info("\ndocument_response: %s", answer)
99
  print('\ndocument_response:', answer)
100
 
101
- conv_history_tokens = num_tokens_from_messages(conversation)
 
102
  while (conv_history_tokens + max_response_tokens >= token_limit):
103
  del MESSAGES[1]
104
- conv_history_tokens = num_tokens_from_messages(conversation)
 
105
 
106
  for trigger in GENERAL_RSPONSE_TRIGGERS:
107
  if trigger in answer:
 
98
  LOGGER.info("\ndocument_response: %s", answer)
99
  print('\ndocument_response:', answer)
100
 
101
+ conv_history_tokens = num_tokens_from_messages(MESSAGES)
102
+ print("conv_history_tokens: ", conv_history_tokens)
103
  while (conv_history_tokens + max_response_tokens >= token_limit):
104
  del MESSAGES[1]
105
+ conv_history_tokens = num_tokens_from_messages(MESSAGES)
106
+ print("conv_history_tokens_ajust: ", conv_history_tokens)
107
 
108
  for trigger in GENERAL_RSPONSE_TRIGGERS:
109
  if trigger in answer: