JohnSmith9982 commited on
Commit
3881481
1 Parent(s): 79483b7

Upload 31 files

Browse files
Files changed (1) hide show
  1. modules/base_model.py +7 -4
modules/base_model.py CHANGED
@@ -373,13 +373,16 @@ class BaseLLMModel:
373
  reply_language="中文",
374
  ):
375
  logging.debug("重试中……")
376
- if len(self.history) == 0:
 
 
 
 
 
 
377
  yield chatbot, f"{STANDARD_ERROR_MSG}上下文是空的"
378
  return
379
 
380
- inputs = self.history[-2]["content"]
381
- del self.history[-2:]
382
- self.all_token_counts.pop()
383
  iter = self.predict(
384
  inputs,
385
  chatbot,
 
373
  reply_language="中文",
374
  ):
375
  logging.debug("重试中……")
376
+ if len(self.history) > 0:
377
+ inputs = self.history[-2]["content"]
378
+ del self.history[-2:]
379
+ self.all_token_counts.pop()
380
+ elif len(chatbot) > 0:
381
+ inputs = chatbot[-1][0]
382
+ else:
383
  yield chatbot, f"{STANDARD_ERROR_MSG}上下文是空的"
384
  return
385
 
 
 
 
386
  iter = self.predict(
387
  inputs,
388
  chatbot,