fix: 模型对话异常,模型编辑时状态未改正
This commit is contained in:
parent
1db2eebc36
commit
5f7a99f957
@ -162,9 +162,9 @@ class ChatMessageSerializer(serializers.Serializer):
|
|||||||
model = QuerySet(Model).filter(id=model.id).first()
|
model = QuerySet(Model).filter(id=model.id).first()
|
||||||
if model is None:
|
if model is None:
|
||||||
raise AppApiException(500, "模型不存在")
|
raise AppApiException(500, "模型不存在")
|
||||||
if model == Status.ERROR:
|
if model.status == Status.ERROR:
|
||||||
raise AppApiException(500, "当前模型不可用")
|
raise AppApiException(500, "当前模型不可用")
|
||||||
if model == Status.DOWNLOAD:
|
if model.status == Status.DOWNLOAD:
|
||||||
raise AppApiException(500, "模型正在下载中,请稍后再发起对话")
|
raise AppApiException(500, "模型正在下载中,请稍后再发起对话")
|
||||||
return chat_info
|
return chat_info
|
||||||
|
|
||||||
|
|||||||
@ -241,6 +241,7 @@ class ModelSerializer(serializers.Serializer):
|
|||||||
model.status = Status.DOWNLOAD
|
model.status = Status.DOWNLOAD
|
||||||
else:
|
else:
|
||||||
raise e
|
raise e
|
||||||
|
model.status = Status.SUCCESS
|
||||||
update_keys = ['credential', 'name', 'model_type', 'model_name']
|
update_keys = ['credential', 'name', 'model_type', 'model_name']
|
||||||
for update_key in update_keys:
|
for update_key in update_keys:
|
||||||
if update_key in instance and instance.get(update_key) is not None:
|
if update_key in instance and instance.get(update_key) is not None:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user