{"record":{"id":"d9a60452d97d9485","repo":"iflytek/astron-agent","slug":"9022-resp","errorCode":"9022","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":226,"sourceCode":"        payload_resource_list = []\n        if context_list:\n            for ctx in context_list:\n                if ctx.resource_list:\n                    payload_resource_list.append(\n                        res.dict() for res in ctx.resource_list  # type: ignore[attr-defined]\n                    )\n                payload_context_list.append(ctx.dict())\n\n        if payload_context_list:\n            payload[\"context_list\"] = payload_context_list\n        if payload_resource_list:\n            payload[\"resource_list\"] = payload_resource_list\n\n        resp = await self._post(\n            \"/audit/v3/aichat/input\", payload, span, chat_app_id, uid\n        )\n        if resp.get(\"data\", {}).get(\"action\") != ActionEnum.NONE:\n            raise AuditServiceException(*c9022)(f\"审核结果异常: {resp}\")\n\n    async def output_text(\n        self,\n        stage: Stage,\n        content: str,\n        pindex: int,\n        span: Span,\n        is_pending: Literal[0, 1],\n        is_stage_end: Literal[0, 1],\n        is_end: Literal[0, 1],\n        chat_sid: str,\n        chat_app_id: str = \"\",\n        uid: str = \"\",\n        **kwargs: Any,\n    ) -> None:\n        payload = {\n            \"intention\": \"dialog\",\n            \"stage\": stage.value,","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/common/audit_system/audit_api/iflytek/ifly_audit_api.py#L208-L244","documentation":"After a successful input-text audit call (`/audit/v3/aichat/input`), the client expects `data.action` to equal `ActionEnum.NONE` (content passed moderation). Any other action (block/review/pass-with-modification) raises `AuditServiceException(*c9022)` with '审核结果异常: {resp}'.","triggerScenarios":"`input_text` gets a response where `resp[\"data\"][\"action\"] != ActionEnum.NONE`, i.e., the audited user input was flagged by content moderation.","commonSituations":"End users submitting sensitive/prohibited text to a chat agent; over-strict moderation policy on the audit platform; audit category configuration changed vendor-side.","solutions":["Inspect `resp` in the exception to see which category triggered and adjust the user prompt.","Review moderation category sensitivity settings on the audit platform if false positives occur.","Handle the audit-block path gracefully in the calling chat flow (return a policy message instead of a raw 500).","Confirm chat_app_id is mapped to the intended moderation policy."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"def 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.input_text(...)\nexcept AuditServiceException as e:\n    # resp payload shows flagged category; respond with a moderation notice\n    return ModerationBlockedResponse(detail=str(e))","preventionTips":["Treat non-NONE audit actions as an expected product path, not a crash: branch on action first.","Tune moderation category thresholds to reduce false positives.","Log flagged category data to refine prompts and guardrails.","Educate users with a clear content-policy message when blocked."],"tags":["audit","content-moderation","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"}