Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinlic committed Mar 28, 2024
2 parents 3bb2a93 + 83d30a7 commit ca3c114
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/api/consts/exceptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, '图像生成失败']
}
3 changes: 3 additions & 0 deletions src/api/controllers/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ca3c114

Please sign in to comment.