{"record":{"id":"300faa8a35800539","repo":"iflytek/astron-agent","slug":"9023-resp","errorCode":"9023","errorMessage":"审核结果异常: {resp}","messagePattern":"审核结果异常: (.+?)","errorType":"error_code","errorClass":"AuditServiceException","httpStatus":null,"severity":"warning","filePath":"core/common/audit_system/audit_api/iflytek/ifly_audit_api.py","lineNumber":256,"sourceCode":"        chat_app_id: str = \"\",\n        uid: str = \"\",\n        **kwargs: Any,\n    ) -> None:\n        payload = {\n            \"intention\": \"dialog\",\n            \"stage\": stage.value,\n            \"content\": content,\n            \"pindex\": pindex,\n            \"is_pending\": is_pending,\n            \"is_stage_end\": is_stage_end,\n            \"is_end\": is_end,\n            \"chat_sid\": chat_sid,\n        }\n        resp = await self._post(\n            \"/audit/v3/aichat/output\", payload, span, chat_app_id, uid\n        )\n        if resp.get(\"data\", {}).get(\"action\") != ActionEnum.NONE:\n            raise AuditServiceException(*c9023)(f\"审核结果异常: {resp}\")\n\n    async def input_media(self, text: str, **kwargs: Any) -> None:\n        \"\"\"\n        大模型内容安全场景中，对用户输入的文本、图片、视频、文档等进行过滤、检测和识别，并根据安全策略进行相应的处理和响应。\n        :param text:\n        :param kwargs:\n        :return:\n        \"\"\"\n        # path = f\"/audit/v3/aichat/inputMedia\"\n\n        raise NotImplementedError(\"IFlyAuditAPI.input_media is not implemented yet\")\n\n    async def output_media(self, text: str, **kwargs: Any) -> None:\n        \"\"\"\n        大模型内容安全场景中，对大模型输出的图片、视频、音频等进行过滤、检测和识别，并根据安全策略进行相应的处理和响应。\n        :param text:\n        :param kwargs:\n        :return:","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/common/audit_system/audit_api/iflytek/ifly_audit_api.py#L238-L274","documentation":"Same contract as the input audit: after POSTing model output to `/audit/v3/aichat/output`, `output_text` requires `data.action == ActionEnum.NONE`; otherwise it raises `AuditServiceException(*c9023)` ('审核结果异常: {resp}').","triggerScenarios":"`output_text` receives an audit response whose `data.action` is not NONE, meaning the LLM's answer was flagged/blocked by output moderation.","commonSituations":"Model outputs containing sensitive content; RAG content pulling in flagged text; vendor policy updates newly flagging previously allowed output.","solutions":["Read the exception's `resp` payload to identify the flagged category and span of text.","Add guardrails/system prompts to steer the model away from flagged content.","Adjust moderation policy thresholds on the audit platform for false positives.","Return a user-friendly moderation message in the chat flow instead of surfacing the raw exception."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"def output_audit_passed(resp: dict) -> bool:\n    from common.audit_system.audit_api.iflytek.ifly_audit_api import ActionEnum\n    return resp.get(\"data\", {}).get(\"action\") == ActionEnum.NONE","tryCatchPattern":"try:\n    await audit_api.output_text(...)\nexcept AuditServiceException as e:\n    logger.info(\"model output blocked by moderation: %s\", e)\n    yield fallback_safe_message()","preventionTips":["Add system-prompt guardrails so outputs are less likely to be flagged.","Audit RAG-retrieved content before it reaches the model output stage.","Branch on the audit action instead of letting it surface as an exception.","Review vendor policy updates that change what gets flagged."],"tags":["audit","content-moderation","llm-output","api"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}