From a67f736a3680446141f2cf38ebf7b4558bd10715 Mon Sep 17 00:00:00 2001 From: spammenotinoz Date: Fri, 10 Nov 2023 10:51:07 +1100 Subject: [PATCH] Update chat.py --- backend/api/routers/chat.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/backend/api/routers/chat.py b/backend/api/routers/chat.py index 2c0a2a58..a8b9334b 100644 --- a/backend/api/routers/chat.py +++ b/backend/api/routers/chat.py @@ -208,12 +208,15 @@ async def check_limits(user: UserReadAdmin, ask_request: AskRequest): # 判断是否允许使用附件 if ask_request.openai_web_attachments and len(ask_request.openai_web_attachments) > 0: - if (ask_request.model == OpenaiWebChatModels.gpt_4 or \ - ask_request.model == OpenaiWebChatModels.gpt_4_code_interpreter) and \ - config.openai_web.enable_uploading_attachments is True: - # Allow attachments - else: - raise WebsocketInvalidAskException("errors.attachmentsNotAllowed") + if (ask_request.model == OpenaiWebChatModels.gpt_4 or \ + ask_request.model == OpenaiWebChatModels.gpt_4_code_interpreter) and \ + config.openai_web.enable_uploading_attachments is True: + # Allow attachments + else: + raise WebsocketInvalidAskException("errors.attachmentsNotAllowed") + + if plugin_id in _plugins_manifests_map: + return _plugins_manifests_map[plugin_id] def check_message(msg: str): # 检查消息中的敏感信息