{"record":{"id":"b31c20ec1947c66b","repo":"binary-husky/gpt_academic","slug":"error-b31c20","errorCode":null,"errorMessage":"由于提问含不合规内容被过滤。","messagePattern":"由于提问含不合规内容被过滤。","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"request_llms/bridge_chatgpt.py","lineNumber":219,"sourceCode":"\n        if (not has_content) and has_role: continue\n        if (not has_content) and (not has_role): continue # raise RuntimeError(\"发现不标准的第三方接口：\"+delta)\n        if has_content: # has_role = True/False\n            result += delta[\"content\"]\n            if not console_silence: print(delta[\"content\"], end='')\n            if observe_window is not None:\n                # 观测窗，把已经获取的数据显示出去\n                if len(observe_window) >= 1:\n                    observe_window[0] += delta[\"content\"]\n                # 看门狗，如果超过期限没有喂狗，则终止\n                if len(observe_window) >= 2:\n                    if (time.time()-observe_window[1]) > watch_dog_patience:\n                        raise RuntimeError(\"用户取消了程序。\")\n        else: raise RuntimeError(\"意外Json结构：\"+delta)\n\n    finish_reason = json_data.get('finish_reason', None) if json_data else None\n    if finish_reason == 'content_filter':\n        raise RuntimeError(\"由于提问含不合规内容被过滤。\")\n    if finish_reason == 'length':\n        raise ConnectionAbortedError(\"正常结束，但显示Token不足，导致输出不完整，请削减单次输入的文本量。\")\n\n    return result\n\n\ndef predict(inputs:str, llm_kwargs:dict, plugin_kwargs:dict, chatbot:ChatBotWithCookies,\n            history:list=[], system_prompt:str='', stream:bool=True, additional_fn:str=None):\n    \"\"\"\n    发送至chatGPT，流式获取输出。\n    用于基础的对话功能。\n    inputs 是本次问询的输入\n    top_p, temperature是chatGPT的内部调优参数\n    history 是之前的对话列表（注意无论是inputs还是history，内容太长了都会触发token数量溢出的错误）\n    chatbot 为WebUI中显示的对话列表，修改它，然后yield出去，可以直接修改对话界面内容\n    additional_fn代表点击的哪个按钮，按钮见functional.py\n    \"\"\"\n    from request_llms.bridge_all import model_info","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/binary-husky/gpt_academic/blob/d6bde0fa54373309bd05823a49bda8da019d2c77/request_llms/bridge_chatgpt.py#L201-L237","documentation":"RuntimeError raised after the stream completes when the final chunk's finish_reason equals 'content_filter'. OpenAI/Azure moderation flagged the prompt or generated content as policy-violating and terminated the response early. The bridge inspects finish_reason on the last json_data once the delta loop ends, so this is a post-stream check, not a transport failure.","triggerScenarios":"Prompts containing violence, sexual, self-harm, or other policy-flagged content (even in quoted/academic material); safety systems tripping on innocent medical/legal/security research text; Azure deployments with stricter default content filters; occasionally triggered by accumulated history rather than the latest message.","commonSituations":"Security-research or forensic prompts quoting malicious code; medical questions phrased clinically that the filter misreads; users on Azure OpenAI where content_filter aborts generation mid-answer; long chats where earlier messages slowly raise the risk score.","solutions":["Rephrase the question to remove policy-sensitive wording; split sensitive material into smaller neutral chunks.","Start a new conversation — filter scores accumulate over history, and a fresh chat often passes.","On Azure, request an adjusted content filter configuration for your subscription/deployment via the Azure OpenAI access form.","If the input is legitimately sensitive (research), route through a model/endpoint without the same filter or summarize the material before sending."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    reply = predict_no_ui_long_connection(...)\nexcept RuntimeError as e:\n    if '不合规内容被过滤' in str(e):\n        reply = retry_with_rephrased_prompt(neutralize(inputs))  # or reset history\n    else:\n        raise","preventionTips":["Keep prompts free of policy-sensitive wording; quote sensitive material in small neutral chunks.","Reset the conversation periodically — filter scores accumulate across history.","On Azure, apply for custom content-filter levels per deployment.","Treat content_filter finish as terminal for that prompt; don't blind-retry the identical text."],"tags":["openai","azure","content-filter","moderation","policy"],"backgroundTag":null,"analyzedSha":"d6bde0fa54373309bd05823a49bda8da019d2c77","analyzedAt":"2026-08-14T22:48:35.038Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}