This commit is contained in:
Vinlic 2024-03-28 18:43:53 +08:00
commit ca3c1142ac
3 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "qwen-free-api",
"version": "0.0.6",
"version": "0.0.7",
"description": "Qwen Free API Server",
"type": "module",
"main": "dist/index.js",

View File

@ -6,5 +6,6 @@ export default {
API_FILE_URL_INVALID: [-2003, '远程文件URL非法'],
API_FILE_EXECEEDS_SIZE: [-2004, '远程文件超出大小'],
API_CHAT_STREAM_PUSHING: [-2005, '已有对话流正在输出'],
API_CONTENT_FILTERED: [-2006, '内容由于合规问题已被阻止生成']
API_CONTENT_FILTERED: [-2006, '内容由于合规问题已被阻止生成'],
API_IMAGE_GENERATION_FAILED: [-2007, '图像生成失败']
}

View File

@ -260,6 +260,9 @@ async function generateImages(
// 异步移除会话,如果消息不合规,此操作可能会抛出数据库错误异常,请忽略
removeConversation(convId, ticket).catch((err) => console.error(err));
if(imageUrls.length == 0)
throw new APIException(EX.API_IMAGE_GENERATION_FAILED);
return imageUrls;
})().catch((err) => {
if (retryCount < MAX_RETRY_COUNT) {