Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu
commited on
Commit
•
1931100
1
Parent(s):
dbe4a3e
bugfix: 修复了重试和新建对话时可能会出错的问题
Browse files- modules/models/base_model.py +4 -1
- modules/models/midjourney.py +2 -2
- modules/models/models.py +1 -1
modules/models/base_model.py
CHANGED
@@ -520,7 +520,7 @@ class BaseLLMModel:
|
|
520 |
reply_language="中文",
|
521 |
):
|
522 |
logging.debug("重试中……")
|
523 |
-
if len(self.history) >
|
524 |
inputs = self.history[-2]["content"]
|
525 |
del self.history[-2:]
|
526 |
if len(self.all_token_counts) > 0:
|
@@ -530,6 +530,9 @@ class BaseLLMModel:
|
|
530 |
if '<div class="user-message">' in inputs:
|
531 |
inputs = inputs.split('<div class="user-message">')[1]
|
532 |
inputs = inputs.split("</div>")[0]
|
|
|
|
|
|
|
533 |
else:
|
534 |
yield chatbot, f"{STANDARD_ERROR_MSG}上下文是空的"
|
535 |
return
|
|
|
520 |
reply_language="中文",
|
521 |
):
|
522 |
logging.debug("重试中……")
|
523 |
+
if len(self.history) > 1:
|
524 |
inputs = self.history[-2]["content"]
|
525 |
del self.history[-2:]
|
526 |
if len(self.all_token_counts) > 0:
|
|
|
530 |
if '<div class="user-message">' in inputs:
|
531 |
inputs = inputs.split('<div class="user-message">')[1]
|
532 |
inputs = inputs.split("</div>")[0]
|
533 |
+
elif len(self.history) == 1:
|
534 |
+
inputs = self.history[-1]["content"]
|
535 |
+
del self.history[-1]
|
536 |
else:
|
537 |
yield chatbot, f"{STANDARD_ERROR_MSG}上下文是空的"
|
538 |
return
|
modules/models/midjourney.py
CHANGED
@@ -221,7 +221,7 @@ class Midjourney_Client(XMChat):
|
|
221 |
def reset(self):
|
222 |
self.image_bytes = None
|
223 |
self.image_path = None
|
224 |
-
return
|
225 |
|
226 |
def get_answer_at_once(self):
|
227 |
content = self.history[-1]['content']
|
@@ -367,7 +367,7 @@ UPSCALE - 确认后放大图片,第一个数值为需要放大的图片(1~4
|
|
367 |
请使用SD进行UPSCALE
|
368 |
VARIATION - 图片变体,第一个数值为需要放大的图片(1~4),第二参数为任务ID
|
369 |
/mj VARIATION::1::123456789
|
370 |
-
|
371 |
【绘图参数】
|
372 |
所有命令默认会带上参数--v 5.2
|
373 |
其他参数参照 https://docs.midjourney.com/docs/parameter-list
|
|
|
221 |
def reset(self):
|
222 |
self.image_bytes = None
|
223 |
self.image_path = None
|
224 |
+
return super().reset()
|
225 |
|
226 |
def get_answer_at_once(self):
|
227 |
content = self.history[-1]['content']
|
|
|
367 |
请使用SD进行UPSCALE
|
368 |
VARIATION - 图片变体,第一个数值为需要放大的图片(1~4),第二参数为任务ID
|
369 |
/mj VARIATION::1::123456789
|
370 |
+
|
371 |
【绘图参数】
|
372 |
所有命令默认会带上参数--v 5.2
|
373 |
其他参数参照 https://docs.midjourney.com/docs/parameter-list
|
modules/models/models.py
CHANGED
@@ -474,7 +474,7 @@ class XMChat(BaseLLMModel):
|
|
474 |
def reset(self):
|
475 |
self.session_id = str(uuid.uuid4())
|
476 |
self.last_conv_id = None
|
477 |
-
return
|
478 |
|
479 |
def image_to_base64(self, image_path):
|
480 |
# 打开并加载图片
|
|
|
474 |
def reset(self):
|
475 |
self.session_id = str(uuid.uuid4())
|
476 |
self.last_conv_id = None
|
477 |
+
return super().reset()
|
478 |
|
479 |
def image_to_base64(self, image_path):
|
480 |
# 打开并加载图片
|