{"id":"30886a09-51f0-48d7-9b16-fc01ade23a4b","entityType":"agent","slug":"clawhub-smyx-sunjinhui-smyx-fish-abnormal-swimming-detection-an","name":"Fish Abnormal Swimming Posture (Side-swim / Upside-down) Detection | 鱼类游动姿态异常（侧游/倒立）识别","canonicalUrl":"https://www.xpersona.co/agent/clawhub-smyx-sunjinhui-smyx-fish-abnormal-swimming-detection-an","canonicalPath":"/agent/clawhub-smyx-sunjinhui-smyx-fish-abnormal-swimming-detection-an","generatedAt":"2026-10-10T10:07:28.078Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T04:16:42.195Z","emptyReason":null},"description":"Through fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。","descriptionLabel":"Source description","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.7K downloads reported by the source. Last updated 10/10/2026.","installCommand":"clawhub skill install s17cfv2h26b7hq5w47tgfy23xx83z9x6:smyx-fish-abnormal-swimming-detection-analysis","sourceUrl":"https://clawhub.ai/smyx-sunjinhui/smyx-fish-abnormal-swimming-detection-analysis","homepage":"https://clawhub.ai/smyx-sunjinhui/skills/smyx-fish-abnormal-swimming-detection-analysis","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/smyx-sunjinhui/smyx-fish-abnormal-swimming-detection-analysis","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/smyx-sunjinhui/skills/smyx-fish-abnormal-swimming-detection-analysis","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":65,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Fish Abnormal Swimming Posture (Side-swim / Upside-down) Detection | 鱼类游动姿态异常（侧游/倒立）识别 technical dossier on Xpersona with agent coverage, OPENCLEW support, and "},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-10T04:16:42.195Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T04:16:42.195Z","emptyReason":null},"stars":null,"forks":null,"downloads":1695,"packageName":null,"latestVersion":"1.0.11","tractionLabel":"1.7K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T04:16:42.195Z","emptyReason":null},"lastUpdatedAt":"2026-10-10T04:16:42.195Z","lastCrawledAt":"2026-10-10T04:16:42.195Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-11T04:16:42.195Z","lastVerifiedAt":null,"highlights":[{"version":"1.0.11","createdAt":"2026-09-30T04:32:25.347Z","changelog":"- Removed the file `skill-card.md`. - No functional changes to the skill logic or user-facing features. - Documentation and core functionality remain unchanged.","fileCount":31,"zipByteSize":43155},{"version":"1.0.10","createdAt":"2026-09-26T10:12:26.316Z","changelog":"smyx-fish-abnormal-swimming-detection-analysis v1.0.10 - Updated documentation in SKILL.md with revised versioning and content adjustments. - Updated configuration in skills/smyx_common/scripts/config.yaml. - Removed the file skill-card.md.","fileCount":31,"zipByteSize":43194},{"version":"1.0.9","createdAt":"2026-09-08T03:05:29.617Z","changelog":"- Updated version and metadata in SKILL.md to reflect latest release. - Revised documentation for clarity and structure in SKILL.md. - Removed the redundant skill-card.md file.","fileCount":31,"zipByteSize":43452},{"version":"1.0.8","createdAt":"2026-08-25T04:02:29.234Z","changelog":"- Bumped version to 1.0.11 and updated version metadata in SKILL.md. - Documentation updated: minor edits and adjustments to SKILL.md. - Removed skill-card.md file to streamline documentation.","fileCount":31,"zipByteSize":43374},{"version":"1.0.7","createdAt":"2026-08-19T00:18:28.839Z","changelog":"- Removed the deprecated skill-card.md file. - Updated configuration: skills/smyx_common/scripts/config.yaml was modified. - No changes to core logic or user-facing features.","fileCount":31,"zipByteSize":43351},{"version":"1.0.6","createdAt":"2026-08-11T09:49:50.163Z","changelog":"- Updated documentation in SKILL.md, including new version number. - Removed the redundant skill-card.md file for clarity. - No core logic or functional changes to skill behavior.","fileCount":31,"zipByteSize":43375},{"version":"1.0.5","createdAt":"2026-08-03T05:15:35.475Z","changelog":"- Removed the `skill-card.md` file from the project. - No changes to code or functionality; documentation/pruning update only.","fileCount":31,"zipByteSize":43417},{"version":"1.0.4","createdAt":"2026-07-30T21:38:28.989Z","changelog":"- Updated skill documentation: SKILL.md revised with new version number and expanded content. - Previous documentation (skill-card.md) removed. - No changes to the core functionality or scripts; only documentation files were modified. - Maintains guidelines, usage instructions, and compliance notes, now with revised detail and clarity.","fileCount":31,"zipByteSize":43229}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s17cfv2h26b7hq5w47tgfy23xx83z9x6:smyx-fish-abnormal-swimming-detection-analysis","setupComplexity":"low","setupSteps":["Install using `clawhub skill install s17cfv2h26b7hq5w47tgfy23xx83z9x6:smyx-fish-abnormal-swimming-detection-analysis` in an isolated environment before connecting it to live workloads.","No published capability contract is available yet, so validate auth and request/response behavior manually.","Review the upstream CLAWHUB listing at https://clawhub.ai/smyx-sunjinhui/smyx-fish-abnormal-swimming-detection-analysis before using production credentials."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-fish-abnormal-swimming-detection-an/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-fish-abnormal-swimming-detection-an/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-fish-abnormal-swimming-detection-an/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-fish-abnormal-swimming-detection-an/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-fish-abnormal-swimming-detection-an/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-fish-abnormal-swimming-detection-an/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-10T10:07:28.074Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-fish-abnormal-swimming-detection-an/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-fish-abnormal-swimming-detection-an/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-fish-abnormal-swimming-detection-an/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-fish-abnormal-swimming-detection-an/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T04:16:42.195Z","emptyReason":null},"readme":"Skill: Fish Abnormal Swimming Posture (Side-swim / Upside-down) Detection | 鱼类游动姿态异常（侧游/倒立）识别\n\nOwner: smyx-sunjinhui\n\nSummary: Through fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。\n\nTags: latest:1.0.11\n\nVersion history:\n\nv1.0.11 | 2026-09-30T04:32:25.347Z | auto\n\n- Removed the file `skill-card.md`.\n- No functional changes to the skill logic or user-facing features.\n- Documentation and core functionality remain unchanged.\n\nv1.0.10 | 2026-09-26T10:12:26.316Z | auto\n\nsmyx-fish-abnormal-swimming-detection-analysis v1.0.10\n\n- Updated documentation in SKILL.md with revised versioning and content adjustments.\n- Updated configuration in skills/smyx_common/scripts/config.yaml.\n- Removed the file skill-card.md.\n\nv1.0.9 | 2026-09-08T03:05:29.617Z | auto\n\n- Updated version and metadata in SKILL.md to reflect latest release.\n- Revised documentation for clarity and structure in SKILL.md.\n- Removed the redundant skill-card.md file.\n\nv1.0.8 | 2026-08-25T04:02:29.234Z | auto\n\n- Bumped version to 1.0.11 and updated version metadata in SKILL.md.\n- Documentation updated: minor edits and adjustments to SKILL.md.\n- Removed skill-card.md file to streamline documentation.\n\nv1.0.7 | 2026-08-19T00:18:28.839Z | auto\n\n- Removed the deprecated skill-card.md file.\n- Updated configuration: skills/smyx_common/scripts/config.yaml was modified.\n- No changes to core logic or user-facing features.\n\nv1.0.6 | 2026-08-11T09:49:50.163Z | auto\n\n- Updated documentation in SKILL.md, including new version number.\n- Removed the redundant skill-card.md file for clarity.\n- No core logic or functional changes to skill behavior.\n\nv1.0.5 | 2026-08-03T05:15:35.475Z | auto\n\n- Removed the `skill-card.md` file from the project.\n- No changes to code or functionality; documentation/pruning update only.\n\nv1.0.4 | 2026-07-30T21:38:28.989Z | auto\n\n- Updated skill documentation: SKILL.md revised with new version number and expanded content.\n- Previous documentation (skill-card.md) removed.\n- No changes to the core functionality or scripts; only documentation files were modified.\n- Maintains guidelines, usage instructions, and compliance notes, now with revised detail and clarity.\n\nv1.0.3 | 2026-07-17T08:48:30.112Z | auto\n\n- Removed the file: skill-card.md\n- No changes to functionality or features; documentation updated by file removal only.\n\nv1.0.2 | 2026-07-10T14:03:31.453Z | auto\n\n- Updated version to 1.0.5.\n- SKILL.md was revised with minor content updates and version bump.\n- Obsolete file skill-card.md was removed.\n- Internal scripts in the skills/smyx_common/scripts/util.py file changed (details not specified).\n- No changes to skill features or user-facing workflow.\n\nv1.0.1 | 2026-07-03T22:44:26.104Z | auto\n\nVersion 1.0.1 Changelog\n\n- Updated SKILL.md to a more concise, structured, and user-focused format with clear overview tables, workflows, and constraints.\n- User identity (open-id) handling fully automated and internalized—users are no longer prompted for or required to input any identifier.\n- All history/report queries now strictly enforced to use cloud API calls; reading from local memory or aggregation is forbidden.\n- Obsolete/duplicate files (scripts/api_service.py, skill-card.md) removed.\n- Other updates for clarity and accuracy in documentation and code references.\n- Compatibility and requirements unchanged; core workflow and capability remain consistent.\n\nv1.0.0 | 2026-05-28T03:39:24.488Z | auto\n\nInitial release of abnormal fish swimming posture detection and analysis skill.\n\n- Analyzes aquarium camera video to detect abnormal fish swimming by measuring body axis angle and rotations.\n- Flags and quantifies behaviors such as side-swimming, upside-down, floating/sinking, and rapid rotations for early health issue detection (e.g., swim bladder disorder, poisoning).\n- Provides continuous monitoring with daily health posture reports and multi-level alerting, from mild reminders to urgent interventions.\n- Features fish species-adaptive baselines, structured report outputs, and integration options for smart aquariums.\n- Strong access and data integrity controls, mandating valid open-id for all report queries and analysis actions.\n\nArchive index:\n\nArchive v1.0.11: 31 files, 43155 bytes\n\nFiles: references/api_doc.md (5095b), scripts/__init__.py (85b), scripts/config.py (710b), scripts/config.yaml (3b), scripts/skill.py (598b), scripts/smyx_fish_abnormal_swimming_detection_analysis.py (3645b), skill-card.md (2200b), SKILL.md (15951b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (473b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (166b)\n\nFile v1.0.11:SKILL.md\n\n---\nname: \"smyx-fish-abnormal-swimming-detection-analysis\"\ndescription: \"Through fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。\"\nversion: \"1.0.15\"\nlicense: \"MIT-0\"\n---\n\n# 🐟 Fish Abnormal Swimming Posture (Side-swim / Upside-down) Detection | 鱼类游动姿态异常（侧游/倒立）识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **鱼类游动姿态异常（侧游/倒立）识别** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` |\n\nThrough fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). When the body tilt exceeds a threshold (default > 30°), the head points downward by > 45° (upside-down), or continuous rotation around the body's longitudinal axis occurs, the swimming posture is flagged as abnormal, and the proportion of abnormal duration over total observation time is recorded. This skill helps early detection of swim bladder disorder, neurological diseases, water poisoning and other health issues, prompting aquarists to intervene promptly. Application scenarios: home aquariums, public aquariums, ornamental fish farms. The system monitors continuously and generates a daily swimming-posture health report. Skill features: abnormal swimming posture is a common symptom of swim bladder disorder, poisoning, and infection. AI-based automatic identification and quantification of abnormal-time ratio helps aquarists detect issues early and take measures such as water change or medication, reducing mortality. This skill can be integrated into smart aquariums or aquarium cameras as a practical tool for aquarists.\n\n通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。应用场景：家庭鱼缸、水族馆、观赏鱼养殖场。系统连续监测，生成每日游姿健康报告。技能特点：鱼类游姿异常是鱼鳔失调、中毒、感染等疾病的常见症状。通过 AI 自动识别并量化异常时间占比，可帮助养鱼者及早发现问题，采取换水、用药等措施，降低死亡率。该技能可集成到智能鱼缸或水族摄像头中，成为养鱼爱好者的实用工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族健康监测 AI。你的任务是分析鱼缸固定摄像头的视频，检测鱼类的游动姿态，计算鱼体轴线与水平面的夹角。当夹角 > 30°（侧游）或头部向下 > 45°（倒立）或出现连续轴向旋转（≥ 2 圈/秒）时，判定为异常游姿。统计异常游姿时长占总观察时长的比例（异常占比），并按 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）做综合判定，按 4 级告警策略（Level 1 仅入库 → Level 2 用户 APP 轻提醒 → Level 3 用户 APP 重要告警 + 建议立即检查水质 → Level 4 紧急告警 + 建议换水/隔离/咨询观赏鱼兽医）递进。不同鱼种正常游姿差异极大（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动），必须按鱼种基线判定，禁止使用通用阈值对特殊鱼种盲判。不提供任何鱼类疾病医学诊断，仅输出基于视觉的姿态分析结果、异常占比与建议动作；严禁伪造夸大异常数据，严禁越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于鱼缸固定摄像头（家庭鱼缸 / 水族馆 / 观赏鱼养殖场）视频，识别 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）→ 视频核心 8 项（鱼体轴线夹角 / 头部向下角度 / 轴向旋转事件 / 侧游累计时长 / 倒立累计时长 / 漂浮时长 / 沉底时长 / 游速异常评分）+ 衍生指标 4 项（异常总时长 / 观察总时长 / 异常占比 / 鱼体计数）→ 4 档异常等级（normal / brief / persistent / strong_abnormal）→ **4 级告警策略递进**（仅入库 → 用户 APP 轻提醒 → 用户 APP 重要告警 + 检查水质 → 紧急告警 + 建议换水/隔离/咨询兽医）→ 单日告警上限管控（Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限）→ **每日游姿健康报告**（按 tank_id 生成，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作）\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 鱼体目标检测与跟踪（多鱼场景 ReID 可选） |\n| 2 | 鱼体轴线（头-尾向量）几何重建 |\n| 3 | 轴线与水平面夹角逐帧计算 |\n| 4 | 头部朝向识别（区分侧游 vs 倒立） |\n| 5 | 绕纵轴翻转检测（连续旋转） |\n| 6 | 异常游姿时长统计 |\n| 7 | 异常占比量化 |\n| 8 | 游速异常识别（过慢 / 抽搐式急加速） |\n| 9 | 异常漂浮 / 沉底识别 |\n| 10 | 鱼种自适应基线（普通观赏鱼 / 比目鱼 / 神仙鱼 / 海马 / 锦鲤 / 龙鱼等） |\n| 11 | 夜间灯光关闭时段处理（红外辅助 / 自动暂停） |\n| 12 | 用户 APP 推送 |\n| 13 | 4 级告警递进 |\n| 14 | 单日告警上限 |\n| 15 | 每日游姿健康报告（按 tank_id 输出） |\n| 16 | 连续 ≥ 2 日显著异常 → 紧急提醒 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供鱼缸固定摄像头视频 URL 或文件需要分析时，默认触发本技能进行鱼类游动姿态异常识别 |\n| 🔎 明确分析意图 | 当用户明确提及鱼游姿异常、鱼侧游、鱼倒立、鱼翻肚、鱼鳔失调、鱼缸监测、观赏鱼健康、鱼类异常游动等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看鱼类游姿历史报告、鱼缸游姿监测日志清单、鱼游姿异常事件清单、查询历史鱼游姿记录、显示所有鱼缸游姿报告、显示鱼类游姿健康日志，查询鱼缸异常清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备鱼缸固定摄像头视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行鱼类游动姿态异常识别 | 调用 `-m scripts.smyx_fish_abnormal_swimming_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地鱼缸固定摄像头视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络鱼缸固定摄像头视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，鱼类游姿监测场景默认 `other` | 按需填写 |\n| `--list` | 显示鱼类游姿异常监测历史记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_fish_abnormal_swimming_detection_analysis.py`](scripts/smyx_fish_abnormal_swimming_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov，最大 10MB；摄像头需鱼缸侧面固定，主活动区可见；帧率 ≥ 15 FPS |\n| 🔎 使用提醒 | **4 级告警策略递进**（normal → brief → persistent → strong_abnormal/Level 4），异常占比 > 20% 或多项叠加进入 Level 4 |\n| 🔎 使用提醒 | 单日告警上限：Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限（紧急安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **禁止**对鱼做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病 / 寄生虫感染\"等疾病诊断 |\n| 🔎 使用提醒 | **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定） |\n| 🔎 使用提醒 | **禁止**用于商业广告 / AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**越权代用户调整智能鱼缸的加热 / 换水 / 投喂 / 灯光参数；任何水族设备控制变更必须由用户确认 |\n| 🔎 使用提醒 | **绝对禁止**伪造或夸大异常占比、异常时长等指标；所有数据必须基于真实视频帧统计 |\n| 🔎 使用提醒 | **禁止**使用通用阈值对特殊鱼种盲判（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动等）；必须按鱼种基线判定 |\n| 🔎 使用提醒 | **必须**在部署时录入鱼种清单和自定义阈值覆盖 |\n| 🔎 使用提醒 | **必须**：连续 ≥ 2 日显著异常 → 紧急提醒用户尽快联系**当地观赏鱼兽医**或**水族馆专业人员** |\n| 📜 报告输出 | **必须**：每日游姿健康报告**按 tank_id 输出**，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史游姿监测记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地鱼缸视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input /path/to/aquarium.mp4\n\n# 分析网络鱼缸视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --url https://example.com/aquarium.mp4\n\n# 显示历史游姿监测记录清单（自动触发关键词：查看鱼类游姿历史报告、鱼缸游姿监测日志清单等）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --output result.json\n```\n\nFile v1.0.11:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-fish-abnormal-swimming-detection-analysis\",\n  \"version\": \"1.0.11\",\n  \"publishedAt\": 1790742745347\n}\n\nFile v1.0.11:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放鱼类游动姿态异常（侧游/倒立）识别 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼类游姿异常检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取异常游姿事件 + 异常时长占比\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史游姿监测报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出每日游姿健康报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动提醒（用户 APP 推送 / 智能鱼缸告警灯）\n\n## 场景代码\n\n- `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` - 鱼类游动姿态异常（侧游/倒立）识别\n\n## 输入约束\n\n- 摄像头：鱼缸侧面固定摄像头，能完整覆盖鱼缸主活动区域；建议正对鱼缸长边方向\n- 帧率 ≥ 15 FPS（高速游动鱼类建议 ≥ 25 FPS）；分辨率 ≥ 720p\n- 光照：建议保留鱼缸照明，避免反光过强干扰轴线识别；水浑浊度低\n- 时段：可全天运行（默认 24h），夜间灯光关闭时段可切换红外辅助或自动暂停\n- 多鱼缸场景按摄像头 ID 绑定到注册鱼缸 ID（每个鱼缸独立基线 + 鱼种清单）\n- 多鱼场景按目标跟踪 + ReID 绑定到注册个体（每条鱼独立基线，可选）\n- 用户必须授权部署；公共水族馆需公示告知\n\n## 关键观测信号\n\n### 视频（核心）\n- `fish_count_detected` - 画面内被跟踪鱼数量\n- `body_axis_angle_deg` - 鱼体轴线与水平面夹角（°，正常 ≤ 30°）\n- `head_down_angle_deg` - 头部向下倾斜角度（°，倒立判定阈值 > 45°）\n- `axial_rotation_event_count` - 绕自身纵轴连续翻转事件次数（≥ 2 圈/秒视为旋转事件）\n- `side_swim_duration_sec` - 累计侧游时长（轴角 > 30° 持续时间）\n- `upside_down_duration_sec` - 累计倒立时长（头部向下 > 45° 持续时间）\n- `floating_duration_sec` - 漂浮时长（无主动游动，被动浮于水面或底部）\n- `sinking_duration_sec` - 沉底时长（无主动游动，停留缸底）\n\n### 衍生指标\n- `abnormal_total_duration_sec` - 异常总时长（侧游 ∪ 倒立 ∪ 旋转 ∪ 异常漂浮/沉底）\n- `observation_total_duration_sec` - 观察总时长\n- `abnormal_ratio` - 异常占比 = abnormal_total / observation_total\n- `swim_speed_anomaly_score` - 游速异常评分（0-100，过慢或抽搐式急加速）\n\n## 场景判定\n\n- `fish_swimming_normal` - 游姿正常\n- `fish_side_swim_brief` - 短暂侧游（轴角 > 30° 但累计时长占比 < 5%）\n- `fish_side_swim_persistent` - 持续侧游（异常占比 5%-20%）\n- `fish_upside_down` - 倒立事件（头部向下 > 45°）\n- `fish_axial_rotation` - 轴向旋转（疑似神经系统受损）\n- `fish_floating_or_sinking` - 异常漂浮/沉底（疑似鱼鳔失调）\n- `fish_swimming_strong_abnormal` - 显著异常（异常占比 > 20% 或多项叠加）\n\n## 4 级告警策略递进\n\n- Level 1（brief）：仅入库记录，不告警，纳入每日游姿趋势\n- Level 2（persistent / 5%-20%）：用户 APP 轻提醒\"鱼缸 X 号出现持续侧游，请观察并检查水质\"\n- Level 3（upside_down / axial_rotation / floating_or_sinking / 异常占比 > 20%）：用户 APP 重要告警 + 建议立即检查（水温、pH、氨氮、亚硝酸盐、溶氧、近期投喂量）\n- Level 4（strong_abnormal / 连续 ≥ 2 日 ≥ Level 3）：紧急告警 + 建议立即换水/观察隔离/咨询观赏鱼兽医\n\n## 单日告警上限\n\n- Level 1：不限（仅入库）\n- Level 2 × 6 / Level 3 × 3 / Level 4 不设上限\n\n## 红线约束\n\n- 禁止做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病\"等疾病诊断\n- 禁止长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定）\n- 禁止用于商业广告 / AI 训练；禁第三方共享\n- 禁止越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数；任何水族设备控制变更必须由用户确认\n- 异常占比、异常时长等指标必须基于真实视频帧统计；**禁止伪造或夸大异常数据**\n- 不同鱼种正常游姿差异极大（如比目鱼天然侧卧、神仙鱼立泳、海马垂直游动）→ 必须按鱼种基线判定；**禁止使用通用阈值对特殊鱼种盲判**\n- 鱼种基线需用户在部署时配置（鱼种清单 / 自定义阈值覆盖）\n\n## 每日游姿健康报告字段\n\n- `report_date` - 报告日期\n- `tank_id` - 鱼缸 ID\n- `observation_hours` - 当日观察总时长\n- `species_baseline_loaded` - 是否加载鱼种基线\n- `abnormal_ratio_today` - 当日异常占比\n- `abnormal_ratio_7d_avg` - 近 7 日异常占比均值\n- `abnormal_ratio_trend` - 趋势（rising / flat / falling）\n- `top_abnormal_scenes` - 当日 Top 3 异常场景\n- `recommended_actions` - 建议动作（检查水质 / 隔离 / 联系兽医等）\n\nFile v1.0.11:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.11:scripts/config.yaml\n\n{}\n\nFile v1.0.11:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.11:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.11:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.11:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.11:skill-card.md\n\n## Description:\n\nAnalyzes aquarium footage for unusual fish swimming postures and presents cloud-generated findings, alerts, and report links.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nAquarium keepers and monitoring operators use this skill to submit fish footage, review unusual swimming activity and historical reports, and decide when to inspect tank conditions or seek professional advice. The findings are not a disease diagnosis.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Fish footage or video URLs are sent to LifeEmergence cloud services, potentially exposing sensitive camera content.\n\nMitigation: Use only footage you are authorized to share; check the service's handling and retention terms before submitting sensitive recordings.\n\nRisk: The skill silently creates or reuses an identity and persists tokens in the workspace data directory.\n\nMitigation: Review the skill before installation and restrict access to the workspace data directory and stored credentials.\n\nRisk: Automatic cloud-history retrieval can expose reports associated with the local identity.\n\nMitigation: Limit workspace access to trusted users and review who can request historical reports.\n\n## Reference(s):\n\n- [ClawHub skill release](https://clawhub.ai/smyx-sunjinhui/skills/smyx-fish-abnormal-swimming-detection-analysis)\n- [Fish swimming analysis API documentation](artifact/references/api_doc.md)\n\n## Skill Output:\n\n**Output Type(s):** [Text, JSON, Guidance]\n\n**Output Format:** [Structured analysis text or JSON with findings, suggestions, and report links; historical reports as a list]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Can print results or save them to a file.]\n\n## Skill Version(s):\n\n1.0.11 (source: ClawHub release metadata)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.11:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.11:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.10: 31 files, 43194 bytes\n\nFiles: references/api_doc.md (5095b), scripts/__init__.py (85b), scripts/config.py (710b), scripts/config.yaml (3b), scripts/skill.py (598b), scripts/smyx_fish_abnormal_swimming_detection_analysis.py (3645b), skill-card.md (2273b), SKILL.md (15951b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (473b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (166b)\n\nFile v1.0.10:SKILL.md\n\n---\nname: \"smyx-fish-abnormal-swimming-detection-analysis\"\ndescription: \"Through fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。\"\nversion: \"1.0.15\"\nlicense: \"MIT-0\"\n---\n\n# 🐟 Fish Abnormal Swimming Posture (Side-swim / Upside-down) Detection | 鱼类游动姿态异常（侧游/倒立）识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **鱼类游动姿态异常（侧游/倒立）识别** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` |\n\nThrough fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). When the body tilt exceeds a threshold (default > 30°), the head points downward by > 45° (upside-down), or continuous rotation around the body's longitudinal axis occurs, the swimming posture is flagged as abnormal, and the proportion of abnormal duration over total observation time is recorded. This skill helps early detection of swim bladder disorder, neurological diseases, water poisoning and other health issues, prompting aquarists to intervene promptly. Application scenarios: home aquariums, public aquariums, ornamental fish farms. The system monitors continuously and generates a daily swimming-posture health report. Skill features: abnormal swimming posture is a common symptom of swim bladder disorder, poisoning, and infection. AI-based automatic identification and quantification of abnormal-time ratio helps aquarists detect issues early and take measures such as water change or medication, reducing mortality. This skill can be integrated into smart aquariums or aquarium cameras as a practical tool for aquarists.\n\n通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。应用场景：家庭鱼缸、水族馆、观赏鱼养殖场。系统连续监测，生成每日游姿健康报告。技能特点：鱼类游姿异常是鱼鳔失调、中毒、感染等疾病的常见症状。通过 AI 自动识别并量化异常时间占比，可帮助养鱼者及早发现问题，采取换水、用药等措施，降低死亡率。该技能可集成到智能鱼缸或水族摄像头中，成为养鱼爱好者的实用工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族健康监测 AI。你的任务是分析鱼缸固定摄像头的视频，检测鱼类的游动姿态，计算鱼体轴线与水平面的夹角。当夹角 > 30°（侧游）或头部向下 > 45°（倒立）或出现连续轴向旋转（≥ 2 圈/秒）时，判定为异常游姿。统计异常游姿时长占总观察时长的比例（异常占比），并按 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）做综合判定，按 4 级告警策略（Level 1 仅入库 → Level 2 用户 APP 轻提醒 → Level 3 用户 APP 重要告警 + 建议立即检查水质 → Level 4 紧急告警 + 建议换水/隔离/咨询观赏鱼兽医）递进。不同鱼种正常游姿差异极大（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动），必须按鱼种基线判定，禁止使用通用阈值对特殊鱼种盲判。不提供任何鱼类疾病医学诊断，仅输出基于视觉的姿态分析结果、异常占比与建议动作；严禁伪造夸大异常数据，严禁越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于鱼缸固定摄像头（家庭鱼缸 / 水族馆 / 观赏鱼养殖场）视频，识别 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）→ 视频核心 8 项（鱼体轴线夹角 / 头部向下角度 / 轴向旋转事件 / 侧游累计时长 / 倒立累计时长 / 漂浮时长 / 沉底时长 / 游速异常评分）+ 衍生指标 4 项（异常总时长 / 观察总时长 / 异常占比 / 鱼体计数）→ 4 档异常等级（normal / brief / persistent / strong_abnormal）→ **4 级告警策略递进**（仅入库 → 用户 APP 轻提醒 → 用户 APP 重要告警 + 检查水质 → 紧急告警 + 建议换水/隔离/咨询兽医）→ 单日告警上限管控（Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限）→ **每日游姿健康报告**（按 tank_id 生成，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作）\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 鱼体目标检测与跟踪（多鱼场景 ReID 可选） |\n| 2 | 鱼体轴线（头-尾向量）几何重建 |\n| 3 | 轴线与水平面夹角逐帧计算 |\n| 4 | 头部朝向识别（区分侧游 vs 倒立） |\n| 5 | 绕纵轴翻转检测（连续旋转） |\n| 6 | 异常游姿时长统计 |\n| 7 | 异常占比量化 |\n| 8 | 游速异常识别（过慢 / 抽搐式急加速） |\n| 9 | 异常漂浮 / 沉底识别 |\n| 10 | 鱼种自适应基线（普通观赏鱼 / 比目鱼 / 神仙鱼 / 海马 / 锦鲤 / 龙鱼等） |\n| 11 | 夜间灯光关闭时段处理（红外辅助 / 自动暂停） |\n| 12 | 用户 APP 推送 |\n| 13 | 4 级告警递进 |\n| 14 | 单日告警上限 |\n| 15 | 每日游姿健康报告（按 tank_id 输出） |\n| 16 | 连续 ≥ 2 日显著异常 → 紧急提醒 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供鱼缸固定摄像头视频 URL 或文件需要分析时，默认触发本技能进行鱼类游动姿态异常识别 |\n| 🔎 明确分析意图 | 当用户明确提及鱼游姿异常、鱼侧游、鱼倒立、鱼翻肚、鱼鳔失调、鱼缸监测、观赏鱼健康、鱼类异常游动等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看鱼类游姿历史报告、鱼缸游姿监测日志清单、鱼游姿异常事件清单、查询历史鱼游姿记录、显示所有鱼缸游姿报告、显示鱼类游姿健康日志，查询鱼缸异常清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备鱼缸固定摄像头视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行鱼类游动姿态异常识别 | 调用 `-m scripts.smyx_fish_abnormal_swimming_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地鱼缸固定摄像头视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络鱼缸固定摄像头视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，鱼类游姿监测场景默认 `other` | 按需填写 |\n| `--list` | 显示鱼类游姿异常监测历史记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_fish_abnormal_swimming_detection_analysis.py`](scripts/smyx_fish_abnormal_swimming_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov，最大 10MB；摄像头需鱼缸侧面固定，主活动区可见；帧率 ≥ 15 FPS |\n| 🔎 使用提醒 | **4 级告警策略递进**（normal → brief → persistent → strong_abnormal/Level 4），异常占比 > 20% 或多项叠加进入 Level 4 |\n| 🔎 使用提醒 | 单日告警上限：Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限（紧急安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **禁止**对鱼做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病 / 寄生虫感染\"等疾病诊断 |\n| 🔎 使用提醒 | **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定） |\n| 🔎 使用提醒 | **禁止**用于商业广告 / AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**越权代用户调整智能鱼缸的加热 / 换水 / 投喂 / 灯光参数；任何水族设备控制变更必须由用户确认 |\n| 🔎 使用提醒 | **绝对禁止**伪造或夸大异常占比、异常时长等指标；所有数据必须基于真实视频帧统计 |\n| 🔎 使用提醒 | **禁止**使用通用阈值对特殊鱼种盲判（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动等）；必须按鱼种基线判定 |\n| 🔎 使用提醒 | **必须**在部署时录入鱼种清单和自定义阈值覆盖 |\n| 🔎 使用提醒 | **必须**：连续 ≥ 2 日显著异常 → 紧急提醒用户尽快联系**当地观赏鱼兽医**或**水族馆专业人员** |\n| 📜 报告输出 | **必须**：每日游姿健康报告**按 tank_id 输出**，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史游姿监测记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地鱼缸视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input /path/to/aquarium.mp4\n\n# 分析网络鱼缸视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --url https://example.com/aquarium.mp4\n\n# 显示历史游姿监测记录清单（自动触发关键词：查看鱼类游姿历史报告、鱼缸游姿监测日志清单等）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --output result.json\n```\n\nFile v1.0.10:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-fish-abnormal-swimming-detection-analysis\",\n  \"version\": \"1.0.10\",\n  \"publishedAt\": 1790417546316\n}\n\nFile v1.0.10:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放鱼类游动姿态异常（侧游/倒立）识别 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼类游姿异常检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取异常游姿事件 + 异常时长占比\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史游姿监测报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出每日游姿健康报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动提醒（用户 APP 推送 / 智能鱼缸告警灯）\n\n## 场景代码\n\n- `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` - 鱼类游动姿态异常（侧游/倒立）识别\n\n## 输入约束\n\n- 摄像头：鱼缸侧面固定摄像头，能完整覆盖鱼缸主活动区域；建议正对鱼缸长边方向\n- 帧率 ≥ 15 FPS（高速游动鱼类建议 ≥ 25 FPS）；分辨率 ≥ 720p\n- 光照：建议保留鱼缸照明，避免反光过强干扰轴线识别；水浑浊度低\n- 时段：可全天运行（默认 24h），夜间灯光关闭时段可切换红外辅助或自动暂停\n- 多鱼缸场景按摄像头 ID 绑定到注册鱼缸 ID（每个鱼缸独立基线 + 鱼种清单）\n- 多鱼场景按目标跟踪 + ReID 绑定到注册个体（每条鱼独立基线，可选）\n- 用户必须授权部署；公共水族馆需公示告知\n\n## 关键观测信号\n\n### 视频（核心）\n- `fish_count_detected` - 画面内被跟踪鱼数量\n- `body_axis_angle_deg` - 鱼体轴线与水平面夹角（°，正常 ≤ 30°）\n- `head_down_angle_deg` - 头部向下倾斜角度（°，倒立判定阈值 > 45°）\n- `axial_rotation_event_count` - 绕自身纵轴连续翻转事件次数（≥ 2 圈/秒视为旋转事件）\n- `side_swim_duration_sec` - 累计侧游时长（轴角 > 30° 持续时间）\n- `upside_down_duration_sec` - 累计倒立时长（头部向下 > 45° 持续时间）\n- `floating_duration_sec` - 漂浮时长（无主动游动，被动浮于水面或底部）\n- `sinking_duration_sec` - 沉底时长（无主动游动，停留缸底）\n\n### 衍生指标\n- `abnormal_total_duration_sec` - 异常总时长（侧游 ∪ 倒立 ∪ 旋转 ∪ 异常漂浮/沉底）\n- `observation_total_duration_sec` - 观察总时长\n- `abnormal_ratio` - 异常占比 = abnormal_total / observation_total\n- `swim_speed_anomaly_score` - 游速异常评分（0-100，过慢或抽搐式急加速）\n\n## 场景判定\n\n- `fish_swimming_normal` - 游姿正常\n- `fish_side_swim_brief` - 短暂侧游（轴角 > 30° 但累计时长占比 < 5%）\n- `fish_side_swim_persistent` - 持续侧游（异常占比 5%-20%）\n- `fish_upside_down` - 倒立事件（头部向下 > 45°）\n- `fish_axial_rotation` - 轴向旋转（疑似神经系统受损）\n- `fish_floating_or_sinking` - 异常漂浮/沉底（疑似鱼鳔失调）\n- `fish_swimming_strong_abnormal` - 显著异常（异常占比 > 20% 或多项叠加）\n\n## 4 级告警策略递进\n\n- Level 1（brief）：仅入库记录，不告警，纳入每日游姿趋势\n- Level 2（persistent / 5%-20%）：用户 APP 轻提醒\"鱼缸 X 号出现持续侧游，请观察并检查水质\"\n- Level 3（upside_down / axial_rotation / floating_or_sinking / 异常占比 > 20%）：用户 APP 重要告警 + 建议立即检查（水温、pH、氨氮、亚硝酸盐、溶氧、近期投喂量）\n- Level 4（strong_abnormal / 连续 ≥ 2 日 ≥ Level 3）：紧急告警 + 建议立即换水/观察隔离/咨询观赏鱼兽医\n\n## 单日告警上限\n\n- Level 1：不限（仅入库）\n- Level 2 × 6 / Level 3 × 3 / Level 4 不设上限\n\n## 红线约束\n\n- 禁止做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病\"等疾病诊断\n- 禁止长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定）\n- 禁止用于商业广告 / AI 训练；禁第三方共享\n- 禁止越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数；任何水族设备控制变更必须由用户确认\n- 异常占比、异常时长等指标必须基于真实视频帧统计；**禁止伪造或夸大异常数据**\n- 不同鱼种正常游姿差异极大（如比目鱼天然侧卧、神仙鱼立泳、海马垂直游动）→ 必须按鱼种基线判定；**禁止使用通用阈值对特殊鱼种盲判**\n- 鱼种基线需用户在部署时配置（鱼种清单 / 自定义阈值覆盖）\n\n## 每日游姿健康报告字段\n\n- `report_date` - 报告日期\n- `tank_id` - 鱼缸 ID\n- `observation_hours` - 当日观察总时长\n- `species_baseline_loaded` - 是否加载鱼种基线\n- `abnormal_ratio_today` - 当日异常占比\n- `abnormal_ratio_7d_avg` - 近 7 日异常占比均值\n- `abnormal_ratio_trend` - 趋势（rising / flat / falling）\n- `top_abnormal_scenes` - 当日 Top 3 异常场景\n- `recommended_actions` - 建议动作（检查水质 / 隔离 / 联系兽医等）\n\nFile v1.0.10:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.10:scripts/config.yaml\n\n{}\n\nFile v1.0.10:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.10:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.10:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.10:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.10:skill-card.md\n\n## Description:\n\nAnalyzes aquarium camera videos for unusual fish swimming postures and reports observed anomalies, their duration, and suggested follow-up actions.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nAquarium keepers and operators use fixed-camera footage to review unusual fish swimming behavior, monitor trends, and decide when to inspect water conditions or consult an aquatic animal professional. The observations are not disease diagnoses.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Private aquarium footage or supplied video URLs are sent to an external cloud service.\n\nMitigation: Confirm authorization and review the service's retention and sharing terms before submitting private footage or internal URLs.\n\nRisk: The skill automatically creates or reuses an identity and stores authentication data locally; history queries may expose previous reports.\n\nMitigation: Review account access and local credential storage, and use only an authorized account to query history.\n\nRisk: Posture alerts may be misleading for species with naturally unusual swimming behavior.\n\nMitigation: Configure species-specific baselines and have a person review alerts before taking action; do not treat results as a disease diagnosis.\n\n## Reference(s):\n\n- [Skill release on ClawHub](https://clawhub.ai/smyx-sunjinhui/skills/smyx-fish-abnormal-swimming-detection-analysis)\n- [API interface reference](references/api_doc.md)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, JSON]\n\n**Output Format:** [Structured analysis report or historical-report listing, with report links]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Includes abnormal-posture observations, duration or proportion, alerts, and suggested actions when available.]\n\n## Skill Version(s):\n\n1.0.10 (source: server-resolved ClawHub release)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.10:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.10:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.9: 31 files, 43452 bytes\n\nFiles: references/api_doc.md (5095b), scripts/__init__.py (85b), scripts/config.py (710b), scripts/config.yaml (3b), scripts/skill.py (598b), scripts/smyx_fish_abnormal_swimming_detection_analysis.py (3645b), skill-card.md (2938b), SKILL.md (15951b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (472b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (165b)\n\nFile v1.0.9:SKILL.md\n\n---\nname: \"smyx-fish-abnormal-swimming-detection-analysis\"\ndescription: \"Through fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。\"\nversion: \"1.0.13\"\nlicense: \"MIT-0\"\n---\n\n# 🐟 Fish Abnormal Swimming Posture (Side-swim / Upside-down) Detection | 鱼类游动姿态异常（侧游/倒立）识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **鱼类游动姿态异常（侧游/倒立）识别** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` |\n\nThrough fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). When the body tilt exceeds a threshold (default > 30°), the head points downward by > 45° (upside-down), or continuous rotation around the body's longitudinal axis occurs, the swimming posture is flagged as abnormal, and the proportion of abnormal duration over total observation time is recorded. This skill helps early detection of swim bladder disorder, neurological diseases, water poisoning and other health issues, prompting aquarists to intervene promptly. Application scenarios: home aquariums, public aquariums, ornamental fish farms. The system monitors continuously and generates a daily swimming-posture health report. Skill features: abnormal swimming posture is a common symptom of swim bladder disorder, poisoning, and infection. AI-based automatic identification and quantification of abnormal-time ratio helps aquarists detect issues early and take measures such as water change or medication, reducing mortality. This skill can be integrated into smart aquariums or aquarium cameras as a practical tool for aquarists.\n\n通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。应用场景：家庭鱼缸、水族馆、观赏鱼养殖场。系统连续监测，生成每日游姿健康报告。技能特点：鱼类游姿异常是鱼鳔失调、中毒、感染等疾病的常见症状。通过 AI 自动识别并量化异常时间占比，可帮助养鱼者及早发现问题，采取换水、用药等措施，降低死亡率。该技能可集成到智能鱼缸或水族摄像头中，成为养鱼爱好者的实用工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族健康监测 AI。你的任务是分析鱼缸固定摄像头的视频，检测鱼类的游动姿态，计算鱼体轴线与水平面的夹角。当夹角 > 30°（侧游）或头部向下 > 45°（倒立）或出现连续轴向旋转（≥ 2 圈/秒）时，判定为异常游姿。统计异常游姿时长占总观察时长的比例（异常占比），并按 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）做综合判定，按 4 级告警策略（Level 1 仅入库 → Level 2 用户 APP 轻提醒 → Level 3 用户 APP 重要告警 + 建议立即检查水质 → Level 4 紧急告警 + 建议换水/隔离/咨询观赏鱼兽医）递进。不同鱼种正常游姿差异极大（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动），必须按鱼种基线判定，禁止使用通用阈值对特殊鱼种盲判。不提供任何鱼类疾病医学诊断，仅输出基于视觉的姿态分析结果、异常占比与建议动作；严禁伪造夸大异常数据，严禁越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于鱼缸固定摄像头（家庭鱼缸 / 水族馆 / 观赏鱼养殖场）视频，识别 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）→ 视频核心 8 项（鱼体轴线夹角 / 头部向下角度 / 轴向旋转事件 / 侧游累计时长 / 倒立累计时长 / 漂浮时长 / 沉底时长 / 游速异常评分）+ 衍生指标 4 项（异常总时长 / 观察总时长 / 异常占比 / 鱼体计数）→ 4 档异常等级（normal / brief / persistent / strong_abnormal）→ **4 级告警策略递进**（仅入库 → 用户 APP 轻提醒 → 用户 APP 重要告警 + 检查水质 → 紧急告警 + 建议换水/隔离/咨询兽医）→ 单日告警上限管控（Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限）→ **每日游姿健康报告**（按 tank_id 生成，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作）\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 鱼体目标检测与跟踪（多鱼场景 ReID 可选） |\n| 2 | 鱼体轴线（头-尾向量）几何重建 |\n| 3 | 轴线与水平面夹角逐帧计算 |\n| 4 | 头部朝向识别（区分侧游 vs 倒立） |\n| 5 | 绕纵轴翻转检测（连续旋转） |\n| 6 | 异常游姿时长统计 |\n| 7 | 异常占比量化 |\n| 8 | 游速异常识别（过慢 / 抽搐式急加速） |\n| 9 | 异常漂浮 / 沉底识别 |\n| 10 | 鱼种自适应基线（普通观赏鱼 / 比目鱼 / 神仙鱼 / 海马 / 锦鲤 / 龙鱼等） |\n| 11 | 夜间灯光关闭时段处理（红外辅助 / 自动暂停） |\n| 12 | 用户 APP 推送 |\n| 13 | 4 级告警递进 |\n| 14 | 单日告警上限 |\n| 15 | 每日游姿健康报告（按 tank_id 输出） |\n| 16 | 连续 ≥ 2 日显著异常 → 紧急提醒 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供鱼缸固定摄像头视频 URL 或文件需要分析时，默认触发本技能进行鱼类游动姿态异常识别 |\n| 🔎 明确分析意图 | 当用户明确提及鱼游姿异常、鱼侧游、鱼倒立、鱼翻肚、鱼鳔失调、鱼缸监测、观赏鱼健康、鱼类异常游动等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看鱼类游姿历史报告、鱼缸游姿监测日志清单、鱼游姿异常事件清单、查询历史鱼游姿记录、显示所有鱼缸游姿报告、显示鱼类游姿健康日志，查询鱼缸异常清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备鱼缸固定摄像头视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行鱼类游动姿态异常识别 | 调用 `-m scripts.smyx_fish_abnormal_swimming_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地鱼缸固定摄像头视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络鱼缸固定摄像头视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，鱼类游姿监测场景默认 `other` | 按需填写 |\n| `--list` | 显示鱼类游姿异常监测历史记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_fish_abnormal_swimming_detection_analysis.py`](scripts/smyx_fish_abnormal_swimming_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov，最大 10MB；摄像头需鱼缸侧面固定，主活动区可见；帧率 ≥ 15 FPS |\n| 🔎 使用提醒 | **4 级告警策略递进**（normal → brief → persistent → strong_abnormal/Level 4），异常占比 > 20% 或多项叠加进入 Level 4 |\n| 🔎 使用提醒 | 单日告警上限：Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限（紧急安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **禁止**对鱼做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病 / 寄生虫感染\"等疾病诊断 |\n| 🔎 使用提醒 | **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定） |\n| 🔎 使用提醒 | **禁止**用于商业广告 / AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**越权代用户调整智能鱼缸的加热 / 换水 / 投喂 / 灯光参数；任何水族设备控制变更必须由用户确认 |\n| 🔎 使用提醒 | **绝对禁止**伪造或夸大异常占比、异常时长等指标；所有数据必须基于真实视频帧统计 |\n| 🔎 使用提醒 | **禁止**使用通用阈值对特殊鱼种盲判（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动等）；必须按鱼种基线判定 |\n| 🔎 使用提醒 | **必须**在部署时录入鱼种清单和自定义阈值覆盖 |\n| 🔎 使用提醒 | **必须**：连续 ≥ 2 日显著异常 → 紧急提醒用户尽快联系**当地观赏鱼兽医**或**水族馆专业人员** |\n| 📜 报告输出 | **必须**：每日游姿健康报告**按 tank_id 输出**，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史游姿监测记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地鱼缸视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input /path/to/aquarium.mp4\n\n# 分析网络鱼缸视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --url https://example.com/aquarium.mp4\n\n# 显示历史游姿监测记录清单（自动触发关键词：查看鱼类游姿历史报告、鱼缸游姿监测日志清单等）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --output result.json\n```\n\nFile v1.0.9:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-fish-abnormal-swimming-detection-analysis\",\n  \"version\": \"1.0.9\",\n  \"publishedAt\": 1788836729617\n}\n\nFile v1.0.9:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放鱼类游动姿态异常（侧游/倒立）识别 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼类游姿异常检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取异常游姿事件 + 异常时长占比\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史游姿监测报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出每日游姿健康报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动提醒（用户 APP 推送 / 智能鱼缸告警灯）\n\n## 场景代码\n\n- `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` - 鱼类游动姿态异常（侧游/倒立）识别\n\n## 输入约束\n\n- 摄像头：鱼缸侧面固定摄像头，能完整覆盖鱼缸主活动区域；建议正对鱼缸长边方向\n- 帧率 ≥ 15 FPS（高速游动鱼类建议 ≥ 25 FPS）；分辨率 ≥ 720p\n- 光照：建议保留鱼缸照明，避免反光过强干扰轴线识别；水浑浊度低\n- 时段：可全天运行（默认 24h），夜间灯光关闭时段可切换红外辅助或自动暂停\n- 多鱼缸场景按摄像头 ID 绑定到注册鱼缸 ID（每个鱼缸独立基线 + 鱼种清单）\n- 多鱼场景按目标跟踪 + ReID 绑定到注册个体（每条鱼独立基线，可选）\n- 用户必须授权部署；公共水族馆需公示告知\n\n## 关键观测信号\n\n### 视频（核心）\n- `fish_count_detected` - 画面内被跟踪鱼数量\n- `body_axis_angle_deg` - 鱼体轴线与水平面夹角（°，正常 ≤ 30°）\n- `head_down_angle_deg` - 头部向下倾斜角度（°，倒立判定阈值 > 45°）\n- `axial_rotation_event_count` - 绕自身纵轴连续翻转事件次数（≥ 2 圈/秒视为旋转事件）\n- `side_swim_duration_sec` - 累计侧游时长（轴角 > 30° 持续时间）\n- `upside_down_duration_sec` - 累计倒立时长（头部向下 > 45° 持续时间）\n- `floating_duration_sec` - 漂浮时长（无主动游动，被动浮于水面或底部）\n- `sinking_duration_sec` - 沉底时长（无主动游动，停留缸底）\n\n### 衍生指标\n- `abnormal_total_duration_sec` - 异常总时长（侧游 ∪ 倒立 ∪ 旋转 ∪ 异常漂浮/沉底）\n- `observation_total_duration_sec` - 观察总时长\n- `abnormal_ratio` - 异常占比 = abnormal_total / observation_total\n- `swim_speed_anomaly_score` - 游速异常评分（0-100，过慢或抽搐式急加速）\n\n## 场景判定\n\n- `fish_swimming_normal` - 游姿正常\n- `fish_side_swim_brief` - 短暂侧游（轴角 > 30° 但累计时长占比 < 5%）\n- `fish_side_swim_persistent` - 持续侧游（异常占比 5%-20%）\n- `fish_upside_down` - 倒立事件（头部向下 > 45°）\n- `fish_axial_rotation` - 轴向旋转（疑似神经系统受损）\n- `fish_floating_or_sinking` - 异常漂浮/沉底（疑似鱼鳔失调）\n- `fish_swimming_strong_abnormal` - 显著异常（异常占比 > 20% 或多项叠加）\n\n## 4 级告警策略递进\n\n- Level 1（brief）：仅入库记录，不告警，纳入每日游姿趋势\n- Level 2（persistent / 5%-20%）：用户 APP 轻提醒\"鱼缸 X 号出现持续侧游，请观察并检查水质\"\n- Level 3（upside_down / axial_rotation / floating_or_sinking / 异常占比 > 20%）：用户 APP 重要告警 + 建议立即检查（水温、pH、氨氮、亚硝酸盐、溶氧、近期投喂量）\n- Level 4（strong_abnormal / 连续 ≥ 2 日 ≥ Level 3）：紧急告警 + 建议立即换水/观察隔离/咨询观赏鱼兽医\n\n## 单日告警上限\n\n- Level 1：不限（仅入库）\n- Level 2 × 6 / Level 3 × 3 / Level 4 不设上限\n\n## 红线约束\n\n- 禁止做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病\"等疾病诊断\n- 禁止长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定）\n- 禁止用于商业广告 / AI 训练；禁第三方共享\n- 禁止越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数；任何水族设备控制变更必须由用户确认\n- 异常占比、异常时长等指标必须基于真实视频帧统计；**禁止伪造或夸大异常数据**\n- 不同鱼种正常游姿差异极大（如比目鱼天然侧卧、神仙鱼立泳、海马垂直游动）→ 必须按鱼种基线判定；**禁止使用通用阈值对特殊鱼种盲判**\n- 鱼种基线需用户在部署时配置（鱼种清单 / 自定义阈值覆盖）\n\n## 每日游姿健康报告字段\n\n- `report_date` - 报告日期\n- `tank_id` - 鱼缸 ID\n- `observation_hours` - 当日观察总时长\n- `species_baseline_loaded` - 是否加载鱼种基线\n- `abnormal_ratio_today` - 当日异常占比\n- `abnormal_ratio_7d_avg` - 近 7 日异常占比均值\n- `abnormal_ratio_trend` - 趋势（rising / flat / falling）\n- `top_abnormal_scenes` - 当日 Top 3 异常场景\n- `recommended_actions` - 建议动作（检查水质 / 隔离 / 联系兽医等）\n\nFile v1.0.9:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.9:scripts/config.yaml\n\n{}\n\nFile v1.0.9:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.9:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.9:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.9:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: dev\n\nFile v1.0.9:skill-card.md\n\n## Description:\n\nAnalyzes aquarium camera images or videos to identify abnormal fish swimming postures such as side-swimming, upside-down posture, axial rotation, floating, or sinking, and returns structured monitoring results with suggested follow-up actions.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nAquarium keepers, aquarium operators, and developers use this skill to analyze fixed-camera aquarium media, quantify abnormal swimming duration, review historical monitoring reports, and decide when to inspect water quality or seek specialist help. The skill is a visual posture analysis aid and should not be treated as a veterinary diagnosis.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Aquarium videos, media URLs, report history, identity state, and tokens may be sent to or stored by the publisher's backend.\n\nMitigation: Install only when the publisher and backend are trusted, and treat submitted media and report history as sensitive user data.\n\nRisk: Packaged defaults can use plaintext HTTP development endpoints for service traffic.\n\nMitigation: Review configuration before deployment and replace default endpoints with HTTPS production endpoints.\n\nRisk: The skill can create or reuse a persistent local identity without asking the user.\n\nMitigation: Review local identity/session handling and disclose persistence expectations before operational use.\n\nRisk: Visual posture findings could be mistaken for a disease diagnosis or used to trigger aquarium controls without user approval.\n\nMitigation: Present results as visual monitoring signals only, require user confirmation before equipment changes, and direct urgent cases to qualified aquarium or veterinary specialists.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-fish-abnormal-swimming-detection-analysis)\n- [Publisher profile](https://clawhub.ai/user/smyx-sunjinhui)\n- [API interface document](references/api_doc.md)\n- [Skill demo](https://lifeemergence.com/sample.html)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown or JSON-like structured text with report links and optional saved output files]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Outputs may include abnormal posture classifications, duration ratios, alert levels, suggested actions, and historical report tables.]\n\n## Skill Version(s):\n\n1.0.9 (source: server release metadata; artifact frontmatter lists 1.0.13)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.9:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.9:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.8: 31 files, 43374 bytes\n\nFiles: references/api_doc.md (5095b), scripts/__init__.py (85b), scripts/config.py (710b), scripts/config.yaml (3b), scripts/skill.py (598b), scripts/smyx_fish_abnormal_swimming_detection_analysis.py (3645b), skill-card.md (2774b), SKILL.md (15951b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (472b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (165b)\n\nFile v1.0.8:SKILL.md\n\n---\nname: \"smyx-fish-abnormal-swimming-detection-analysis\"\ndescription: \"Through fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。\"\nversion: \"1.0.11\"\nlicense: \"MIT-0\"\n---\n\n# 🐟 Fish Abnormal Swimming Posture (Side-swim / Upside-down) Detection | 鱼类游动姿态异常（侧游/倒立）识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **鱼类游动姿态异常（侧游/倒立）识别** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` |\n\nThrough fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). When the body tilt exceeds a threshold (default > 30°), the head points downward by > 45° (upside-down), or continuous rotation around the body's longitudinal axis occurs, the swimming posture is flagged as abnormal, and the proportion of abnormal duration over total observation time is recorded. This skill helps early detection of swim bladder disorder, neurological diseases, water poisoning and other health issues, prompting aquarists to intervene promptly. Application scenarios: home aquariums, public aquariums, ornamental fish farms. The system monitors continuously and generates a daily swimming-posture health report. Skill features: abnormal swimming posture is a common symptom of swim bladder disorder, poisoning, and infection. AI-based automatic identification and quantification of abnormal-time ratio helps aquarists detect issues early and take measures such as water change or medication, reducing mortality. This skill can be integrated into smart aquariums or aquarium cameras as a practical tool for aquarists.\n\n通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。应用场景：家庭鱼缸、水族馆、观赏鱼养殖场。系统连续监测，生成每日游姿健康报告。技能特点：鱼类游姿异常是鱼鳔失调、中毒、感染等疾病的常见症状。通过 AI 自动识别并量化异常时间占比，可帮助养鱼者及早发现问题，采取换水、用药等措施，降低死亡率。该技能可集成到智能鱼缸或水族摄像头中，成为养鱼爱好者的实用工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族健康监测 AI。你的任务是分析鱼缸固定摄像头的视频，检测鱼类的游动姿态，计算鱼体轴线与水平面的夹角。当夹角 > 30°（侧游）或头部向下 > 45°（倒立）或出现连续轴向旋转（≥ 2 圈/秒）时，判定为异常游姿。统计异常游姿时长占总观察时长的比例（异常占比），并按 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）做综合判定，按 4 级告警策略（Level 1 仅入库 → Level 2 用户 APP 轻提醒 → Level 3 用户 APP 重要告警 + 建议立即检查水质 → Level 4 紧急告警 + 建议换水/隔离/咨询观赏鱼兽医）递进。不同鱼种正常游姿差异极大（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动），必须按鱼种基线判定，禁止使用通用阈值对特殊鱼种盲判。不提供任何鱼类疾病医学诊断，仅输出基于视觉的姿态分析结果、异常占比与建议动作；严禁伪造夸大异常数据，严禁越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于鱼缸固定摄像头（家庭鱼缸 / 水族馆 / 观赏鱼养殖场）视频，识别 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）→ 视频核心 8 项（鱼体轴线夹角 / 头部向下角度 / 轴向旋转事件 / 侧游累计时长 / 倒立累计时长 / 漂浮时长 / 沉底时长 / 游速异常评分）+ 衍生指标 4 项（异常总时长 / 观察总时长 / 异常占比 / 鱼体计数）→ 4 档异常等级（normal / brief / persistent / strong_abnormal）→ **4 级告警策略递进**（仅入库 → 用户 APP 轻提醒 → 用户 APP 重要告警 + 检查水质 → 紧急告警 + 建议换水/隔离/咨询兽医）→ 单日告警上限管控（Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限）→ **每日游姿健康报告**（按 tank_id 生成，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作）\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 鱼体目标检测与跟踪（多鱼场景 ReID 可选） |\n| 2 | 鱼体轴线（头-尾向量）几何重建 |\n| 3 | 轴线与水平面夹角逐帧计算 |\n| 4 | 头部朝向识别（区分侧游 vs 倒立） |\n| 5 | 绕纵轴翻转检测（连续旋转） |\n| 6 | 异常游姿时长统计 |\n| 7 | 异常占比量化 |\n| 8 | 游速异常识别（过慢 / 抽搐式急加速） |\n| 9 | 异常漂浮 / 沉底识别 |\n| 10 | 鱼种自适应基线（普通观赏鱼 / 比目鱼 / 神仙鱼 / 海马 / 锦鲤 / 龙鱼等） |\n| 11 | 夜间灯光关闭时段处理（红外辅助 / 自动暂停） |\n| 12 | 用户 APP 推送 |\n| 13 | 4 级告警递进 |\n| 14 | 单日告警上限 |\n| 15 | 每日游姿健康报告（按 tank_id 输出） |\n| 16 | 连续 ≥ 2 日显著异常 → 紧急提醒 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供鱼缸固定摄像头视频 URL 或文件需要分析时，默认触发本技能进行鱼类游动姿态异常识别 |\n| 🔎 明确分析意图 | 当用户明确提及鱼游姿异常、鱼侧游、鱼倒立、鱼翻肚、鱼鳔失调、鱼缸监测、观赏鱼健康、鱼类异常游动等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看鱼类游姿历史报告、鱼缸游姿监测日志清单、鱼游姿异常事件清单、查询历史鱼游姿记录、显示所有鱼缸游姿报告、显示鱼类游姿健康日志，查询鱼缸异常清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备鱼缸固定摄像头视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行鱼类游动姿态异常识别 | 调用 `-m scripts.smyx_fish_abnormal_swimming_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地鱼缸固定摄像头视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络鱼缸固定摄像头视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，鱼类游姿监测场景默认 `other` | 按需填写 |\n| `--list` | 显示鱼类游姿异常监测历史记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_fish_abnormal_swimming_detection_analysis.py`](scripts/smyx_fish_abnormal_swimming_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov，最大 10MB；摄像头需鱼缸侧面固定，主活动区可见；帧率 ≥ 15 FPS |\n| 🔎 使用提醒 | **4 级告警策略递进**（normal → brief → persistent → strong_abnormal/Level 4），异常占比 > 20% 或多项叠加进入 Level 4 |\n| 🔎 使用提醒 | 单日告警上限：Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限（紧急安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **禁止**对鱼做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病 / 寄生虫感染\"等疾病诊断 |\n| 🔎 使用提醒 | **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定） |\n| 🔎 使用提醒 | **禁止**用于商业广告 / AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**越权代用户调整智能鱼缸的加热 / 换水 / 投喂 / 灯光参数；任何水族设备控制变更必须由用户确认 |\n| 🔎 使用提醒 | **绝对禁止**伪造或夸大异常占比、异常时长等指标；所有数据必须基于真实视频帧统计 |\n| 🔎 使用提醒 | **禁止**使用通用阈值对特殊鱼种盲判（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动等）；必须按鱼种基线判定 |\n| 🔎 使用提醒 | **必须**在部署时录入鱼种清单和自定义阈值覆盖 |\n| 🔎 使用提醒 | **必须**：连续 ≥ 2 日显著异常 → 紧急提醒用户尽快联系**当地观赏鱼兽医**或**水族馆专业人员** |\n| 📜 报告输出 | **必须**：每日游姿健康报告**按 tank_id 输出**，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史游姿监测记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地鱼缸视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input /path/to/aquarium.mp4\n\n# 分析网络鱼缸视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --url https://example.com/aquarium.mp4\n\n# 显示历史游姿监测记录清单（自动触发关键词：查看鱼类游姿历史报告、鱼缸游姿监测日志清单等）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --output result.json\n```\n\nFile v1.0.8:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-fish-abnormal-swimming-detection-analysis\",\n  \"version\": \"1.0.8\",\n  \"publishedAt\": 1787630549234\n}\n\nFile v1.0.8:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放鱼类游动姿态异常（侧游/倒立）识别 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼类游姿异常检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取异常游姿事件 + 异常时长占比\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史游姿监测报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出每日游姿健康报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动提醒（用户 APP 推送 / 智能鱼缸告警灯）\n\n## 场景代码\n\n- `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` - 鱼类游动姿态异常（侧游/倒立）识别\n\n## 输入约束\n\n- 摄像头：鱼缸侧面固定摄像头，能完整覆盖鱼缸主活动区域；建议正对鱼缸长边方向\n- 帧率 ≥ 15 FPS（高速游动鱼类建议 ≥ 25 FPS）；分辨率 ≥ 720p\n- 光照：建议保留鱼缸照明，避免反光过强干扰轴线识别；水浑浊度低\n- 时段：可全天运行（默认 24h），夜间灯光关闭时段可切换红外辅助或自动暂停\n- 多鱼缸场景按摄像头 ID 绑定到注册鱼缸 ID（每个鱼缸独立基线 + 鱼种清单）\n- 多鱼场景按目标跟踪 + ReID 绑定到注册个体（每条鱼独立基线，可选）\n- 用户必须授权部署；公共水族馆需公示告知\n\n## 关键观测信号\n\n### 视频（核心）\n- `fish_count_detected` - 画面内被跟踪鱼数量\n- `body_axis_angle_deg` - 鱼体轴线与水平面夹角（°，正常 ≤ 30°）\n- `head_down_angle_deg` - 头部向下倾斜角度（°，倒立判定阈值 > 45°）\n- `axial_rotation_event_count` - 绕自身纵轴连续翻转事件次数（≥ 2 圈/秒视为旋转事件）\n- `side_swim_duration_sec` - 累计侧游时长（轴角 > 30° 持续时间）\n- `upside_down_duration_sec` - 累计倒立时长（头部向下 > 45° 持续时间）\n- `floating_duration_sec` - 漂浮时长（无主动游动，被动浮于水面或底部）\n- `sinking_duration_sec` - 沉底时长（无主动游动，停留缸底）\n\n### 衍生指标\n- `abnormal_total_duration_sec` - 异常总时长（侧游 ∪ 倒立 ∪ 旋转 ∪ 异常漂浮/沉底）\n- `observation_total_duration_sec` - 观察总时长\n- `abnormal_ratio` - 异常占比 = abnormal_total / observation_total\n- `swim_speed_anomaly_score` - 游速异常评分（0-100，过慢或抽搐式急加速）\n\n## 场景判定\n\n- `fish_swimming_normal` - 游姿正常\n- `fish_side_swim_brief` - 短暂侧游（轴角 > 30° 但累计时长占比 < 5%）\n- `fish_side_swim_persistent` - 持续侧游（异常占比 5%-20%）\n- `fish_upside_down` - 倒立事件（头部向下 > 45°）\n- `fish_axial_rotation` - 轴向旋转（疑似神经系统受损）\n- `fish_floating_or_sinking` - 异常漂浮/沉底（疑似鱼鳔失调）\n- `fish_swimming_strong_abnormal` - 显著异常（异常占比 > 20% 或多项叠加）\n\n## 4 级告警策略递进\n\n- Level 1（brief）：仅入库记录，不告警，纳入每日游姿趋势\n- Level 2（persistent / 5%-20%）：用户 APP 轻提醒\"鱼缸 X 号出现持续侧游，请观察并检查水质\"\n- Level 3（upside_down / axial_rotation / floating_or_sinking / 异常占比 > 20%）：用户 APP 重要告警 + 建议立即检查（水温、pH、氨氮、亚硝酸盐、溶氧、近期投喂量）\n- Level 4（strong_abnormal / 连续 ≥ 2 日 ≥ Level 3）：紧急告警 + 建议立即换水/观察隔离/咨询观赏鱼兽医\n\n## 单日告警上限\n\n- Level 1：不限（仅入库）\n- Level 2 × 6 / Level 3 × 3 / Level 4 不设上限\n\n## 红线约束\n\n- 禁止做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病\"等疾病诊断\n- 禁止长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定）\n- 禁止用于商业广告 / AI 训练；禁第三方共享\n- 禁止越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数；任何水族设备控制变更必须由用户确认\n- 异常占比、异常时长等指标必须基于真实视频帧统计；**禁止伪造或夸大异常数据**\n- 不同鱼种正常游姿差异极大（如比目鱼天然侧卧、神仙鱼立泳、海马垂直游动）→ 必须按鱼种基线判定；**禁止使用通用阈值对特殊鱼种盲判**\n- 鱼种基线需用户在部署时配置（鱼种清单 / 自定义阈值覆盖）\n\n## 每日游姿健康报告字段\n\n- `report_date` - 报告日期\n- `tank_id` - 鱼缸 ID\n- `observation_hours` - 当日观察总时长\n- `species_baseline_loaded` - 是否加载鱼种基线\n- `abnormal_ratio_today` - 当日异常占比\n- `abnormal_ratio_7d_avg` - 近 7 日异常占比均值\n- `abnormal_ratio_trend` - 趋势（rising / flat / falling）\n- `top_abnormal_scenes` - 当日 Top 3 异常场景\n- `recommended_actions` - 建议动作（检查水质 / 隔离 / 联系兽医等）\n\nFile v1.0.8:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.8:scripts/config.yaml\n\n{}\n\nFile v1.0.8:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.8:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.8:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.8:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: dev\n\nFile v1.0.8:skill-card.md\n\n## Description:\n\nAnalyzes fixed-camera aquarium videos to flag side-swim, upside-down, axial rotation, floating, or sinking posture anomalies and produce structured reports with abnormal-duration ratios and suggested user actions.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nAquarium owners, aquaculture staff, and developers use this skill to analyze fixed-camera aquarium media, quantify abnormal swimming posture duration, review historical reports, and decide when to inspect water conditions or seek professional help.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Aquarium media may be sent to a backend service and associated with an automatically selected identity.\n\nMitigation: Use only with authorized media, review endpoint configuration before deployment, and disclose or obtain consent where aquarium monitoring affects other parties.\n\nRisk: Account tokens may be stored in a local workspace database with limited user control.\n\nMitigation: Inspect local storage behavior, restrict workspace access, and rotate or remove stored tokens when the skill is no longer needed.\n\nRisk: Default private development endpoint configuration may be unsuitable for normal use.\n\nMitigation: Replace or document non-production endpoints before commercial deployment.\n\nRisk: Visual posture analysis can be mistaken for veterinary diagnosis.\n\nMitigation: Treat outputs as posture and duration analysis only; use persistent or severe findings to prompt water-quality checks and qualified aquarium or veterinary consultation.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-fish-abnormal-swimming-detection-analysis)\n- [Fish abnormal swimming API documentation](artifact/references/api_doc.md)\n- [Shared health analysis API documentation](artifact/skills/smyx_analysis/references/api_doc.md)\n- [Skill demo](https://lifeemergence.com/sample.html)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, JSON, Shell commands, Guidance]\n\n**Output Format:** [Markdown and JSON analysis reports with report links and optional shell commands]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May upload aquarium media to a backend API, poll for results, and query cloud report history.]\n\n## Skill Version(s):\n\n1.0.8 (source: server release metadata; artifact frontmatter reports 1.0.11)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.8:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.8:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.7: 31 files, 43351 bytes\n\nFiles: references/api_doc.md (5095b), scripts/__init__.py (85b), scripts/config.py (710b), scripts/config.yaml (3b), scripts/skill.py (598b), scripts/smyx_fish_abnormal_swimming_detection_analysis.py (3645b), skill-card.md (2555b), SKILL.md (15951b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (472b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (165b)\n\nFile v1.0.7:SKILL.md\n\n---\nname: \"smyx-fish-abnormal-swimming-detection-analysis\"\ndescription: \"Through fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。\"\nversion: \"1.0.10\"\nlicense: \"MIT-0\"\n---\n\n# 🐟 Fish Abnormal Swimming Posture (Side-swim / Upside-down) Detection | 鱼类游动姿态异常（侧游/倒立）识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **鱼类游动姿态异常（侧游/倒立）识别** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` |\n\nThrough fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). When the body tilt exceeds a threshold (default > 30°), the head points downward by > 45° (upside-down), or continuous rotation around the body's longitudinal axis occurs, the swimming posture is flagged as abnormal, and the proportion of abnormal duration over total observation time is recorded. This skill helps early detection of swim bladder disorder, neurological diseases, water poisoning and other health issues, prompting aquarists to intervene promptly. Application scenarios: home aquariums, public aquariums, ornamental fish farms. The system monitors continuously and generates a daily swimming-posture health report. Skill features: abnormal swimming posture is a common symptom of swim bladder disorder, poisoning, and infection. AI-based automatic identification and quantification of abnormal-time ratio helps aquarists detect issues early and take measures such as water change or medication, reducing mortality. This skill can be integrated into smart aquariums or aquarium cameras as a practical tool for aquarists.\n\n通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。应用场景：家庭鱼缸、水族馆、观赏鱼养殖场。系统连续监测，生成每日游姿健康报告。技能特点：鱼类游姿异常是鱼鳔失调、中毒、感染等疾病的常见症状。通过 AI 自动识别并量化异常时间占比，可帮助养鱼者及早发现问题，采取换水、用药等措施，降低死亡率。该技能可集成到智能鱼缸或水族摄像头中，成为养鱼爱好者的实用工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族健康监测 AI。你的任务是分析鱼缸固定摄像头的视频，检测鱼类的游动姿态，计算鱼体轴线与水平面的夹角。当夹角 > 30°（侧游）或头部向下 > 45°（倒立）或出现连续轴向旋转（≥ 2 圈/秒）时，判定为异常游姿。统计异常游姿时长占总观察时长的比例（异常占比），并按 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）做综合判定，按 4 级告警策略（Level 1 仅入库 → Level 2 用户 APP 轻提醒 → Level 3 用户 APP 重要告警 + 建议立即检查水质 → Level 4 紧急告警 + 建议换水/隔离/咨询观赏鱼兽医）递进。不同鱼种正常游姿差异极大（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动），必须按鱼种基线判定，禁止使用通用阈值对特殊鱼种盲判。不提供任何鱼类疾病医学诊断，仅输出基于视觉的姿态分析结果、异常占比与建议动作；严禁伪造夸大异常数据，严禁越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于鱼缸固定摄像头（家庭鱼缸 / 水族馆 / 观赏鱼养殖场）视频，识别 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）→ 视频核心 8 项（鱼体轴线夹角 / 头部向下角度 / 轴向旋转事件 / 侧游累计时长 / 倒立累计时长 / 漂浮时长 / 沉底时长 / 游速异常评分）+ 衍生指标 4 项（异常总时长 / 观察总时长 / 异常占比 / 鱼体计数）→ 4 档异常等级（normal / brief / persistent / strong_abnormal）→ **4 级告警策略递进**（仅入库 → 用户 APP 轻提醒 → 用户 APP 重要告警 + 检查水质 → 紧急告警 + 建议换水/隔离/咨询兽医）→ 单日告警上限管控（Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限）→ **每日游姿健康报告**（按 tank_id 生成，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作）\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 鱼体目标检测与跟踪（多鱼场景 ReID 可选） |\n| 2 | 鱼体轴线（头-尾向量）几何重建 |\n| 3 | 轴线与水平面夹角逐帧计算 |\n| 4 | 头部朝向识别（区分侧游 vs 倒立） |\n| 5 | 绕纵轴翻转检测（连续旋转） |\n| 6 | 异常游姿时长统计 |\n| 7 | 异常占比量化 |\n| 8 | 游速异常识别（过慢 / 抽搐式急加速） |\n| 9 | 异常漂浮 / 沉底识别 |\n| 10 | 鱼种自适应基线（普通观赏鱼 / 比目鱼 / 神仙鱼 / 海马 / 锦鲤 / 龙鱼等） |\n| 11 | 夜间灯光关闭时段处理（红外辅助 / 自动暂停） |\n| 12 | 用户 APP 推送 |\n| 13 | 4 级告警递进 |\n| 14 | 单日告警上限 |\n| 15 | 每日游姿健康报告（按 tank_id 输出） |\n| 16 | 连续 ≥ 2 日显著异常 → 紧急提醒 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供鱼缸固定摄像头视频 URL 或文件需要分析时，默认触发本技能进行鱼类游动姿态异常识别 |\n| 🔎 明确分析意图 | 当用户明确提及鱼游姿异常、鱼侧游、鱼倒立、鱼翻肚、鱼鳔失调、鱼缸监测、观赏鱼健康、鱼类异常游动等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看鱼类游姿历史报告、鱼缸游姿监测日志清单、鱼游姿异常事件清单、查询历史鱼游姿记录、显示所有鱼缸游姿报告、显示鱼类游姿健康日志，查询鱼缸异常清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备鱼缸固定摄像头视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行鱼类游动姿态异常识别 | 调用 `-m scripts.smyx_fish_abnormal_swimming_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地鱼缸固定摄像头视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络鱼缸固定摄像头视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，鱼类游姿监测场景默认 `other` | 按需填写 |\n| `--list` | 显示鱼类游姿异常监测历史记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_fish_abnormal_swimming_detection_analysis.py`](scripts/smyx_fish_abnormal_swimming_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov，最大 10MB；摄像头需鱼缸侧面固定，主活动区可见；帧率 ≥ 15 FPS |\n| 🔎 使用提醒 | **4 级告警策略递进**（normal → brief → persistent → strong_abnormal/Level 4），异常占比 > 20% 或多项叠加进入 Level 4 |\n| 🔎 使用提醒 | 单日告警上限：Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限（紧急安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **禁止**对鱼做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病 / 寄生虫感染\"等疾病诊断 |\n| 🔎 使用提醒 | **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定） |\n| 🔎 使用提醒 | **禁止**用于商业广告 / AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**越权代用户调整智能鱼缸的加热 / 换水 / 投喂 / 灯光参数；任何水族设备控制变更必须由用户确认 |\n| 🔎 使用提醒 | **绝对禁止**伪造或夸大异常占比、异常时长等指标；所有数据必须基于真实视频帧统计 |\n| 🔎 使用提醒 | **禁止**使用通用阈值对特殊鱼种盲判（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动等）；必须按鱼种基线判定 |\n| 🔎 使用提醒 | **必须**在部署时录入鱼种清单和自定义阈值覆盖 |\n| 🔎 使用提醒 | **必须**：连续 ≥ 2 日显著异常 → 紧急提醒用户尽快联系**当地观赏鱼兽医**或**水族馆专业人员** |\n| 📜 报告输出 | **必须**：每日游姿健康报告**按 tank_id 输出**，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史游姿监测记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地鱼缸视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input /path/to/aquarium.mp4\n\n# 分析网络鱼缸视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --url https://example.com/aquarium.mp4\n\n# 显示历史游姿监测记录清单（自动触发关键词：查看鱼类游姿历史报告、鱼缸游姿监测日志清单等）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --output result.json\n```\n\nFile v1.0.7:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-fish-abnormal-swimming-detection-analysis\",\n  \"version\": \"1.0.7\",\n  \"publishedAt\": 1787098708839\n}\n\nFile v1.0.7:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放鱼类游动姿态异常（侧游/倒立）识别 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼类游姿异常检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取异常游姿事件 + 异常时长占比\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史游姿监测报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出每日游姿健康报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动提醒（用户 APP 推送 / 智能鱼缸告警灯）\n\n## 场景代码\n\n- `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` - 鱼类游动姿态异常（侧游/倒立）识别\n\n## 输入约束\n\n- 摄像头：鱼缸侧面固定摄像头，能完整覆盖鱼缸主活动区域；建议正对鱼缸长边方向\n- 帧率 ≥ 15 FPS（高速游动鱼类建议 ≥ 25 FPS）；分辨率 ≥ 720p\n- 光照：建议保留鱼缸照明，避免反光过强干扰轴线识别；水浑浊度低\n- 时段：可全天运行（默认 24h），夜间灯光关闭时段可切换红外辅助或自动暂停\n- 多鱼缸场景按摄像头 ID 绑定到注册鱼缸 ID（每个鱼缸独立基线 + 鱼种清单）\n- 多鱼场景按目标跟踪 + ReID 绑定到注册个体（每条鱼独立基线，可选）\n- 用户必须授权部署；公共水族馆需公示告知\n\n## 关键观测信号\n\n### 视频（核心）\n- `fish_count_detected` - 画面内被跟踪鱼数量\n- `body_axis_angle_deg` - 鱼体轴线与水平面夹角（°，正常 ≤ 30°）\n- `head_down_angle_deg` - 头部向下倾斜角度（°，倒立判定阈值 > 45°）\n- `axial_rotation_event_count` - 绕自身纵轴连续翻转事件次数（≥ 2 圈/秒视为旋转事件）\n- `side_swim_duration_sec` - 累计侧游时长（轴角 > 30° 持续时间）\n- `upside_down_duration_sec` - 累计倒立时长（头部向下 > 45° 持续时间）\n- `floating_duration_sec` - 漂浮时长（无主动游动，被动浮于水面或底部）\n- `sinking_duration_sec` - 沉底时长（无主动游动，停留缸底）\n\n### 衍生指标\n- `abnormal_total_duration_sec` - 异常总时长（侧游 ∪ 倒立 ∪ 旋转 ∪ 异常漂浮/沉底）\n- `observation_total_duration_sec` - 观察总时长\n- `abnormal_ratio` - 异常占比 = abnormal_total / observation_total\n- `swim_speed_anomaly_score` - 游速异常评分（0-100，过慢或抽搐式急加速）\n\n## 场景判定\n\n- `fish_swimming_normal` - 游姿正常\n- `fish_side_swim_brief` - 短暂侧游（轴角 > 30° 但累计时长占比 < 5%）\n- `fish_side_swim_persistent` - 持续侧游（异常占比 5%-20%）\n- `fish_upside_down` - 倒立事件（头部向下 > 45°）\n- `fish_axial_rotation` - 轴向旋转（疑似神经系统受损）\n- `fish_floating_or_sinking` - 异常漂浮/沉底（疑似鱼鳔失调）\n- `fish_swimming_strong_abnormal` - 显著异常（异常占比 > 20% 或多项叠加）\n\n## 4 级告警策略递进\n\n- Level 1（brief）：仅入库记录，不告警，纳入每日游姿趋势\n- Level 2（persistent / 5%-20%）：用户 APP 轻提醒\"鱼缸 X 号出现持续侧游，请观察并检查水质\"\n- Level 3（upside_down / axial_rotation / floating_or_sinking / 异常占比 > 20%）：用户 APP 重要告警 + 建议立即检查（水温、pH、氨氮、亚硝酸盐、溶氧、近期投喂量）\n- Level 4（strong_abnormal / 连续 ≥ 2 日 ≥ Level 3）：紧急告警 + 建议立即换水/观察隔离/咨询观赏鱼兽医\n\n## 单日告警上限\n\n- Level 1：不限（仅入库）\n- Level 2 × 6 / Level 3 × 3 / Level 4 不设上限\n\n## 红线约束\n\n- 禁止做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病\"等疾病诊断\n- 禁止长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定）\n- 禁止用于商业广告 / AI 训练；禁第三方共享\n- 禁止越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数；任何水族设备控制变更必须由用户确认\n- 异常占比、异常时长等指标必须基于真实视频帧统计；**禁止伪造或夸大异常数据**\n- 不同鱼种正常游姿差异极大（如比目鱼天然侧卧、神仙鱼立泳、海马垂直游动）→ 必须按鱼种基线判定；**禁止使用通用阈值对特殊鱼种盲判**\n- 鱼种基线需用户在部署时配置（鱼种清单 / 自定义阈值覆盖）\n\n## 每日游姿健康报告字段\n\n- `report_date` - 报告日期\n- `tank_id` - 鱼缸 ID\n- `observation_hours` - 当日观察总时长\n- `species_baseline_loaded` - 是否加载鱼种基线\n- `abnormal_ratio_today` - 当日异常占比\n- `abnormal_ratio_7d_avg` - 近 7 日异常占比均值\n- `abnormal_ratio_trend` - 趋势（rising / flat / falling）\n- `top_abnormal_scenes` - 当日 Top 3 异常场景\n- `recommended_actions` - 建议动作（检查水质 / 隔离 / 联系兽医等）\n\nFile v1.0.7:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.7:scripts/config.yaml\n\n{}\n\nFile v1.0.7:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.7:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.7:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.7:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: dev\n\nFile v1.0.7:skill-card.md\n\n## Description:\n\nAnalyzes aquarium camera images or videos to flag side-swimming, upside-down posture, axial rotation, floating or sinking behavior, and report abnormal-duration ratios for fish health monitoring.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal aquarists, aquarium operators, ornamental fish farms, and smart-aquarium integrators use this skill to analyze fixed-camera fish-tank video or image inputs and review structured posture-health reports. The skill supports visual monitoring and suggested next actions, not veterinary diagnosis.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Aquarium videos, video URLs, and history queries are sent to the publisher's cloud service.\n\nMitigation: Use only with consent for remote processing, disclose cloud submission before deployment, and avoid sending sensitive or unauthorized footage.\n\nRisk: The skill can silently create or reuse a persistent internal identity and store tokens locally.\n\nMitigation: Require explicit opt-in for identity creation and history lookup, document token storage and database location, and provide a way to inspect, reset, or delete local identity state.\n\nRisk: Visual posture analysis may be mistaken for a medical diagnosis or may misclassify species with naturally unusual swimming postures.\n\nMitigation: Present outputs as visual monitoring signals only, configure species-specific baselines and thresholds, and direct users to qualified aquarium or veterinary professionals for health decisions.\n\n## Reference(s):\n\n- [API documentation](artifact/references/api_doc.md)\n- [Skill demo](https://lifeemergence.com/sample.html)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, JSON, Files, Guidance]\n\n**Output Format:** [Markdown text with structured JSON report content and optional saved output file]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Reports can include abnormal posture classifications, observed duration metrics, abnormal-ratio summaries, history listings, and export links.]\n\n## Skill Version(s):\n\n1.0.7 (source: server release evidence; artifact frontmatter says 1.0.10)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.7:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.7:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.6: 31 files, 43375 bytes\n\nFiles: references/api_doc.md (5095b), scripts/__init__.py (85b), scripts/config.py (710b), scripts/config.yaml (3b), scripts/skill.py (598b), scripts/smyx_fish_abnormal_swimming_detection_analysis.py (3645b), skill-card.md (2721b), SKILL.md (15951b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (473b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (165b)\n\nFile v1.0.6:SKILL.md\n\n---\nname: \"smyx-fish-abnormal-swimming-detection-analysis\"\ndescription: \"Through fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。\"\nversion: \"1.0.10\"\nlicense: \"MIT-0\"\n---\n\n# 🐟 Fish Abnormal Swimming Posture (Side-swim / Upside-down) Detection | 鱼类游动姿态异常（侧游/倒立）识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **鱼类游动姿态异常（侧游/倒立）识别** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` |\n\nThrough fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). When the body tilt exceeds a threshold (default > 30°), the head points downward by > 45° (upside-down), or continuous rotation around the body's longitudinal axis occurs, the swimming posture is flagged as abnormal, and the proportion of abnormal duration over total observation time is recorded. This skill helps early detection of swim bladder disorder, neurological diseases, water poisoning and other health issues, prompting aquarists to intervene promptly. Application scenarios: home aquariums, public aquariums, ornamental fish farms. The system monitors continuously and generates a daily swimming-posture health report. Skill features: abnormal swimming posture is a common symptom of swim bladder disorder, poisoning, and infection. AI-based automatic identification and quantification of abnormal-time ratio helps aquarists detect issues early and take measures such as water change or medication, reducing mortality. This skill can be integrated into smart aquariums or aquarium cameras as a practical tool for aquarists.\n\n通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。应用场景：家庭鱼缸、水族馆、观赏鱼养殖场。系统连续监测，生成每日游姿健康报告。技能特点：鱼类游姿异常是鱼鳔失调、中毒、感染等疾病的常见症状。通过 AI 自动识别并量化异常时间占比，可帮助养鱼者及早发现问题，采取换水、用药等措施，降低死亡率。该技能可集成到智能鱼缸或水族摄像头中，成为养鱼爱好者的实用工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族健康监测 AI。你的任务是分析鱼缸固定摄像头的视频，检测鱼类的游动姿态，计算鱼体轴线与水平面的夹角。当夹角 > 30°（侧游）或头部向下 > 45°（倒立）或出现连续轴向旋转（≥ 2 圈/秒）时，判定为异常游姿。统计异常游姿时长占总观察时长的比例（异常占比），并按 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）做综合判定，按 4 级告警策略（Level 1 仅入库 → Level 2 用户 APP 轻提醒 → Level 3 用户 APP 重要告警 + 建议立即检查水质 → Level 4 紧急告警 + 建议换水/隔离/咨询观赏鱼兽医）递进。不同鱼种正常游姿差异极大（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动），必须按鱼种基线判定，禁止使用通用阈值对特殊鱼种盲判。不提供任何鱼类疾病医学诊断，仅输出基于视觉的姿态分析结果、异常占比与建议动作；严禁伪造夸大异常数据，严禁越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于鱼缸固定摄像头（家庭鱼缸 / 水族馆 / 观赏鱼养殖场）视频，识别 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）→ 视频核心 8 项（鱼体轴线夹角 / 头部向下角度 / 轴向旋转事件 / 侧游累计时长 / 倒立累计时长 / 漂浮时长 / 沉底时长 / 游速异常评分）+ 衍生指标 4 项（异常总时长 / 观察总时长 / 异常占比 / 鱼体计数）→ 4 档异常等级（normal / brief / persistent / strong_abnormal）→ **4 级告警策略递进**（仅入库 → 用户 APP 轻提醒 → 用户 APP 重要告警 + 检查水质 → 紧急告警 + 建议换水/隔离/咨询兽医）→ 单日告警上限管控（Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限）→ **每日游姿健康报告**（按 tank_id 生成，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作）\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 鱼体目标检测与跟踪（多鱼场景 ReID 可选） |\n| 2 | 鱼体轴线（头-尾向量）几何重建 |\n| 3 | 轴线与水平面夹角逐帧计算 |\n| 4 | 头部朝向识别（区分侧游 vs 倒立） |\n| 5 | 绕纵轴翻转检测（连续旋转） |\n| 6 | 异常游姿时长统计 |\n| 7 | 异常占比量化 |\n| 8 | 游速异常识别（过慢 / 抽搐式急加速） |\n| 9 | 异常漂浮 / 沉底识别 |\n| 10 | 鱼种自适应基线（普通观赏鱼 / 比目鱼 / 神仙鱼 / 海马 / 锦鲤 / 龙鱼等） |\n| 11 | 夜间灯光关闭时段处理（红外辅助 / 自动暂停） |\n| 12 | 用户 APP 推送 |\n| 13 | 4 级告警递进 |\n| 14 | 单日告警上限 |\n| 15 | 每日游姿健康报告（按 tank_id 输出） |\n| 16 | 连续 ≥ 2 日显著异常 → 紧急提醒 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供鱼缸固定摄像头视频 URL 或文件需要分析时，默认触发本技能进行鱼类游动姿态异常识别 |\n| 🔎 明确分析意图 | 当用户明确提及鱼游姿异常、鱼侧游、鱼倒立、鱼翻肚、鱼鳔失调、鱼缸监测、观赏鱼健康、鱼类异常游动等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看鱼类游姿历史报告、鱼缸游姿监测日志清单、鱼游姿异常事件清单、查询历史鱼游姿记录、显示所有鱼缸游姿报告、显示鱼类游姿健康日志，查询鱼缸异常清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备鱼缸固定摄像头视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行鱼类游动姿态异常识别 | 调用 `-m scripts.smyx_fish_abnormal_swimming_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地鱼缸固定摄像头视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络鱼缸固定摄像头视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，鱼类游姿监测场景默认 `other` | 按需填写 |\n| `--list` | 显示鱼类游姿异常监测历史记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_fish_abnormal_swimming_detection_analysis.py`](scripts/smyx_fish_abnormal_swimming_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov，最大 10MB；摄像头需鱼缸侧面固定，主活动区可见；帧率 ≥ 15 FPS |\n| 🔎 使用提醒 | **4 级告警策略递进**（normal → brief → persistent → strong_abnormal/Level 4），异常占比 > 20% 或多项叠加进入 Level 4 |\n| 🔎 使用提醒 | 单日告警上限：Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限（紧急安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **禁止**对鱼做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病 / 寄生虫感染\"等疾病诊断 |\n| 🔎 使用提醒 | **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定） |\n| 🔎 使用提醒 | **禁止**用于商业广告 / AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**越权代用户调整智能鱼缸的加热 / 换水 / 投喂 / 灯光参数；任何水族设备控制变更必须由用户确认 |\n| 🔎 使用提醒 | **绝对禁止**伪造或夸大异常占比、异常时长等指标；所有数据必须基于真实视频帧统计 |\n| 🔎 使用提醒 | **禁止**使用通用阈值对特殊鱼种盲判（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动等）；必须按鱼种基线判定 |\n| 🔎 使用提醒 | **必须**在部署时录入鱼种清单和自定义阈值覆盖 |\n| 🔎 使用提醒 | **必须**：连续 ≥ 2 日显著异常 → 紧急提醒用户尽快联系**当地观赏鱼兽医**或**水族馆专业人员** |\n| 📜 报告输出 | **必须**：每日游姿健康报告**按 tank_id 输出**，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史游姿监测记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地鱼缸视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input /path/to/aquarium.mp4\n\n# 分析网络鱼缸视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --url https://example.com/aquarium.mp4\n\n# 显示历史游姿监测记录清单（自动触发关键词：查看鱼类游姿历史报告、鱼缸游姿监测日志清单等）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --output result.json\n```\n\nFile v1.0.6:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-fish-abnormal-swimming-detection-analysis\",\n  \"version\": \"1.0.6\",\n  \"publishedAt\": 1786441790163\n}\n\nFile v1.0.6:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放鱼类游动姿态异常（侧游/倒立）识别 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼类游姿异常检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取异常游姿事件 + 异常时长占比\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史游姿监测报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出每日游姿健康报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动提醒（用户 APP 推送 / 智能鱼缸告警灯）\n\n## 场景代码\n\n- `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` - 鱼类游动姿态异常（侧游/倒立）识别\n\n## 输入约束\n\n- 摄像头：鱼缸侧面固定摄像头，能完整覆盖鱼缸主活动区域；建议正对鱼缸长边方向\n- 帧率 ≥ 15 FPS（高速游动鱼类建议 ≥ 25 FPS）；分辨率 ≥ 720p\n- 光照：建议保留鱼缸照明，避免反光过强干扰轴线识别；水浑浊度低\n- 时段：可全天运行（默认 24h），夜间灯光关闭时段可切换红外辅助或自动暂停\n- 多鱼缸场景按摄像头 ID 绑定到注册鱼缸 ID（每个鱼缸独立基线 + 鱼种清单）\n- 多鱼场景按目标跟踪 + ReID 绑定到注册个体（每条鱼独立基线，可选）\n- 用户必须授权部署；公共水族馆需公示告知\n\n## 关键观测信号\n\n### 视频（核心）\n- `fish_count_detected` - 画面内被跟踪鱼数量\n- `body_axis_angle_deg` - 鱼体轴线与水平面夹角（°，正常 ≤ 30°）\n- `head_down_angle_deg` - 头部向下倾斜角度（°，倒立判定阈值 > 45°）\n- `axial_rotation_event_count` - 绕自身纵轴连续翻转事件次数（≥ 2 圈/秒视为旋转事件）\n- `side_swim_duration_sec` - 累计侧游时长（轴角 > 30° 持续时间）\n- `upside_down_duration_sec` - 累计倒立时长（头部向下 > 45° 持续时间）\n- `floating_duration_sec` - 漂浮时长（无主动游动，被动浮于水面或底部）\n- `sinking_duration_sec` - 沉底时长（无主动游动，停留缸底）\n\n### 衍生指标\n- `abnormal_total_duration_sec` - 异常总时长（侧游 ∪ 倒立 ∪ 旋转 ∪ 异常漂浮/沉底）\n- `observation_total_duration_sec` - 观察总时长\n- `abnormal_ratio` - 异常占比 = abnormal_total / observation_total\n- `swim_speed_anomaly_score` - 游速异常评分（0-100，过慢或抽搐式急加速）\n\n## 场景判定\n\n- `fish_swimming_normal` - 游姿正常\n- `fish_side_swim_brief` - 短暂侧游（轴角 > 30° 但累计时长占比 < 5%）\n- `fish_side_swim_persistent` - 持续侧游（异常占比 5%-20%）\n- `fish_upside_down` - 倒立事件（头部向下 > 45°）\n- `fish_axial_rotation` - 轴向旋转（疑似神经系统受损）\n- `fish_floating_or_sinking` - 异常漂浮/沉底（疑似鱼鳔失调）\n- `fish_swimming_strong_abnormal` - 显著异常（异常占比 > 20% 或多项叠加）\n\n## 4 级告警策略递进\n\n- Level 1（brief）：仅入库记录，不告警，纳入每日游姿趋势\n- Level 2（persistent / 5%-20%）：用户 APP 轻提醒\"鱼缸 X 号出现持续侧游，请观察并检查水质\"\n- Level 3（upside_down / axial_rotation / floating_or_sinking / 异常占比 > 20%）：用户 APP 重要告警 + 建议立即检查（水温、pH、氨氮、亚硝酸盐、溶氧、近期投喂量）\n- Level 4（strong_abnormal / 连续 ≥ 2 日 ≥ Level 3）：紧急告警 + 建议立即换水/观察隔离/咨询观赏鱼兽医\n\n## 单日告警上限\n\n- Level 1：不限（仅入库）\n- Level 2 × 6 / Level 3 × 3 / Level 4 不设上限\n\n## 红线约束\n\n- 禁止做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病\"等疾病诊断\n- 禁止长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定）\n- 禁止用于商业广告 / AI 训练；禁第三方共享\n- 禁止越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数；任何水族设备控制变更必须由用户确认\n- 异常占比、异常时长等指标必须基于真实视频帧统计；**禁止伪造或夸大异常数据**\n- 不同鱼种正常游姿差异极大（如比目鱼天然侧卧、神仙鱼立泳、海马垂直游动）→ 必须按鱼种基线判定；**禁止使用通用阈值对特殊鱼种盲判**\n- 鱼种基线需用户在部署时配置（鱼种清单 / 自定义阈值覆盖）\n\n## 每日游姿健康报告字段\n\n- `report_date` - 报告日期\n- `tank_id` - 鱼缸 ID\n- `observation_hours` - 当日观察总时长\n- `species_baseline_loaded` - 是否加载鱼种基线\n- `abnormal_ratio_today` - 当日异常占比\n- `abnormal_ratio_7d_avg` - 近 7 日异常占比均值\n- `abnormal_ratio_trend` - 趋势（rising / flat / falling）\n- `top_abnormal_scenes` - 当日 Top 3 异常场景\n- `recommended_actions` - 建议动作（检查水质 / 隔离 / 联系兽医等）\n\nFile v1.0.6:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.6:scripts/config.yaml\n\n{}\n\nFile v1.0.6:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.6:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.6:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.6:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.6:skill-card.md\n\n## Description:\n\nAnalyzes aquarium videos or video URLs to identify abnormal fish swimming posture such as side-swimming, upside-down posture, axial rotation, floating, or sinking, and reports abnormal-duration ratios.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal users, aquarium operators, and developers use this skill to analyze fixed-camera aquarium media for visual posture anomalies and generate structured monitoring results, report links, and suggested follow-up actions. It is intended to support observation and escalation, not to diagnose fish disease.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill sends aquarium media or video URLs to a configured external service for analysis.\n\nMitigation: Use only media that the user is authorized to submit, confirm the configured service endpoint is acceptable, and avoid submitting sensitive or unnecessary footage.\n\nRisk: The skill may silently create or reuse an internal account identity and store service tokens locally.\n\nMitigation: Protect the workspace data directory, restrict access to stored state, and review or delete local account and token data when the skill is no longer used.\n\nRisk: Visual posture results can be mistaken for a veterinary diagnosis.\n\nMitigation: Treat outputs as observation support only, configure species-specific baselines, and have significant or repeated abnormalities reviewed by a qualified aquarium professional or veterinarian.\n\n## Reference(s):\n\n- [ClawHub Skill Page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-fish-abnormal-swimming-detection-analysis)\n- [Publisher Profile](https://clawhub.ai/user/smyx-sunjinhui)\n- [Fish Abnormal Swimming API Documentation](artifact/references/api_doc.md)\n- [Shared Analysis API Documentation](artifact/skills/smyx_analysis/references/api_doc.md)\n- [Skill Demo](https://lifeemergence.com/sample.html)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown and JSON-like structured analysis output with report links.]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May write an optional result file when an output path is provided.]\n\n## Skill Version(s):\n\n1.0.6 (source: server release metadata; artifact frontmatter states 1.0.10)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.6:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.6:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.5: 31 files, 43417 bytes\n\nFiles: references/api_doc.md (5095b), scripts/__init__.py (85b), scripts/config.py (710b), scripts/config.yaml (3b), scripts/skill.py (598b), scripts/smyx_fish_abnormal_swimming_detection_analysis.py (3645b), skill-card.md (2967b), SKILL.md (15950b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (473b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (165b)\n\nFile v1.0.5:SKILL.md\n\n---\nname: \"smyx-fish-abnormal-swimming-detection-analysis\"\ndescription: \"Through fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。\"\nversion: \"1.0.8\"\nlicense: \"MIT-0\"\n---\n\n# 🐟 Fish Abnormal Swimming Posture (Side-swim / Upside-down) Detection | 鱼类游动姿态异常（侧游/倒立）识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **鱼类游动姿态异常（侧游/倒立）识别** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` |\n\nThrough fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). When the body tilt exceeds a threshold (default > 30°), the head points downward by > 45° (upside-down), or continuous rotation around the body's longitudinal axis occurs, the swimming posture is flagged as abnormal, and the proportion of abnormal duration over total observation time is recorded. This skill helps early detection of swim bladder disorder, neurological diseases, water poisoning and other health issues, prompting aquarists to intervene promptly. Application scenarios: home aquariums, public aquariums, ornamental fish farms. The system monitors continuously and generates a daily swimming-posture health report. Skill features: abnormal swimming posture is a common symptom of swim bladder disorder, poisoning, and infection. AI-based automatic identification and quantification of abnormal-time ratio helps aquarists detect issues early and take measures such as water change or medication, reducing mortality. This skill can be integrated into smart aquariums or aquarium cameras as a practical tool for aquarists.\n\n通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。应用场景：家庭鱼缸、水族馆、观赏鱼养殖场。系统连续监测，生成每日游姿健康报告。技能特点：鱼类游姿异常是鱼鳔失调、中毒、感染等疾病的常见症状。通过 AI 自动识别并量化异常时间占比，可帮助养鱼者及早发现问题，采取换水、用药等措施，降低死亡率。该技能可集成到智能鱼缸或水族摄像头中，成为养鱼爱好者的实用工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族健康监测 AI。你的任务是分析鱼缸固定摄像头的视频，检测鱼类的游动姿态，计算鱼体轴线与水平面的夹角。当夹角 > 30°（侧游）或头部向下 > 45°（倒立）或出现连续轴向旋转（≥ 2 圈/秒）时，判定为异常游姿。统计异常游姿时长占总观察时长的比例（异常占比），并按 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）做综合判定，按 4 级告警策略（Level 1 仅入库 → Level 2 用户 APP 轻提醒 → Level 3 用户 APP 重要告警 + 建议立即检查水质 → Level 4 紧急告警 + 建议换水/隔离/咨询观赏鱼兽医）递进。不同鱼种正常游姿差异极大（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动），必须按鱼种基线判定，禁止使用通用阈值对特殊鱼种盲判。不提供任何鱼类疾病医学诊断，仅输出基于视觉的姿态分析结果、异常占比与建议动作；严禁伪造夸大异常数据，严禁越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于鱼缸固定摄像头（家庭鱼缸 / 水族馆 / 观赏鱼养殖场）视频，识别 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）→ 视频核心 8 项（鱼体轴线夹角 / 头部向下角度 / 轴向旋转事件 / 侧游累计时长 / 倒立累计时长 / 漂浮时长 / 沉底时长 / 游速异常评分）+ 衍生指标 4 项（异常总时长 / 观察总时长 / 异常占比 / 鱼体计数）→ 4 档异常等级（normal / brief / persistent / strong_abnormal）→ **4 级告警策略递进**（仅入库 → 用户 APP 轻提醒 → 用户 APP 重要告警 + 检查水质 → 紧急告警 + 建议换水/隔离/咨询兽医）→ 单日告警上限管控（Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限）→ **每日游姿健康报告**（按 tank_id 生成，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作）\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 鱼体目标检测与跟踪（多鱼场景 ReID 可选） |\n| 2 | 鱼体轴线（头-尾向量）几何重建 |\n| 3 | 轴线与水平面夹角逐帧计算 |\n| 4 | 头部朝向识别（区分侧游 vs 倒立） |\n| 5 | 绕纵轴翻转检测（连续旋转） |\n| 6 | 异常游姿时长统计 |\n| 7 | 异常占比量化 |\n| 8 | 游速异常识别（过慢 / 抽搐式急加速） |\n| 9 | 异常漂浮 / 沉底识别 |\n| 10 | 鱼种自适应基线（普通观赏鱼 / 比目鱼 / 神仙鱼 / 海马 / 锦鲤 / 龙鱼等） |\n| 11 | 夜间灯光关闭时段处理（红外辅助 / 自动暂停） |\n| 12 | 用户 APP 推送 |\n| 13 | 4 级告警递进 |\n| 14 | 单日告警上限 |\n| 15 | 每日游姿健康报告（按 tank_id 输出） |\n| 16 | 连续 ≥ 2 日显著异常 → 紧急提醒 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供鱼缸固定摄像头视频 URL 或文件需要分析时，默认触发本技能进行鱼类游动姿态异常识别 |\n| 🔎 明确分析意图 | 当用户明确提及鱼游姿异常、鱼侧游、鱼倒立、鱼翻肚、鱼鳔失调、鱼缸监测、观赏鱼健康、鱼类异常游动等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看鱼类游姿历史报告、鱼缸游姿监测日志清单、鱼游姿异常事件清单、查询历史鱼游姿记录、显示所有鱼缸游姿报告、显示鱼类游姿健康日志，查询鱼缸异常清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备鱼缸固定摄像头视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行鱼类游动姿态异常识别 | 调用 `-m scripts.smyx_fish_abnormal_swimming_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地鱼缸固定摄像头视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络鱼缸固定摄像头视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，鱼类游姿监测场景默认 `other` | 按需填写 |\n| `--list` | 显示鱼类游姿异常监测历史记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_fish_abnormal_swimming_detection_analysis.py`](scripts/smyx_fish_abnormal_swimming_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov，最大 10MB；摄像头需鱼缸侧面固定，主活动区可见；帧率 ≥ 15 FPS |\n| 🔎 使用提醒 | **4 级告警策略递进**（normal → brief → persistent → strong_abnormal/Level 4），异常占比 > 20% 或多项叠加进入 Level 4 |\n| 🔎 使用提醒 | 单日告警上限：Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限（紧急安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **禁止**对鱼做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病 / 寄生虫感染\"等疾病诊断 |\n| 🔎 使用提醒 | **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定） |\n| 🔎 使用提醒 | **禁止**用于商业广告 / AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**越权代用户调整智能鱼缸的加热 / 换水 / 投喂 / 灯光参数；任何水族设备控制变更必须由用户确认 |\n| 🔎 使用提醒 | **绝对禁止**伪造或夸大异常占比、异常时长等指标；所有数据必须基于真实视频帧统计 |\n| 🔎 使用提醒 | **禁止**使用通用阈值对特殊鱼种盲判（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动等）；必须按鱼种基线判定 |\n| 🔎 使用提醒 | **必须**在部署时录入鱼种清单和自定义阈值覆盖 |\n| 🔎 使用提醒 | **必须**：连续 ≥ 2 日显著异常 → 紧急提醒用户尽快联系**当地观赏鱼兽医**或**水族馆专业人员** |\n| 📜 报告输出 | **必须**：每日游姿健康报告**按 tank_id 输出**，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史游姿监测记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地鱼缸视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input /path/to/aquarium.mp4\n\n# 分析网络鱼缸视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --url https://example.com/aquarium.mp4\n\n# 显示历史游姿监测记录清单（自动触发关键词：查看鱼类游姿历史报告、鱼缸游姿监测日志清单等）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --output result.json\n```\n\nFile v1.0.5:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-fish-abnormal-swimming-detection-analysis\",\n  \"version\": \"1.0.5\",\n  \"publishedAt\": 1785734135475\n}\n\nFile v1.0.5:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放鱼类游动姿态异常（侧游/倒立）识别 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼类游姿异常检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取异常游姿事件 + 异常时长占比\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史游姿监测报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出每日游姿健康报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动提醒（用户 APP 推送 / 智能鱼缸告警灯）\n\n## 场景代码\n\n- `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` - 鱼类游动姿态异常（侧游/倒立）识别\n\n## 输入约束\n\n- 摄像头：鱼缸侧面固定摄像头，能完整覆盖鱼缸主活动区域；建议正对鱼缸长边方向\n- 帧率 ≥ 15 FPS（高速游动鱼类建议 ≥ 25 FPS）；分辨率 ≥ 720p\n- 光照：建议保留鱼缸照明，避免反光过强干扰轴线识别；水浑浊度低\n- 时段：可全天运行（默认 24h），夜间灯光关闭时段可切换红外辅助或自动暂停\n- 多鱼缸场景按摄像头 ID 绑定到注册鱼缸 ID（每个鱼缸独立基线 + 鱼种清单）\n- 多鱼场景按目标跟踪 + ReID 绑定到注册个体（每条鱼独立基线，可选）\n- 用户必须授权部署；公共水族馆需公示告知\n\n## 关键观测信号\n\n### 视频（核心）\n- `fish_count_detected` - 画面内被跟踪鱼数量\n- `body_axis_angle_deg` - 鱼体轴线与水平面夹角（°，正常 ≤ 30°）\n- `head_down_angle_deg` - 头部向下倾斜角度（°，倒立判定阈值 > 45°）\n- `axial_rotation_event_count` - 绕自身纵轴连续翻转事件次数（≥ 2 圈/秒视为旋转事件）\n- `side_swim_duration_sec` - 累计侧游时长（轴角 > 30° 持续时间）\n- `upside_down_duration_sec` - 累计倒立时长（头部向下 > 45° 持续时间）\n- `floating_duration_sec` - 漂浮时长（无主动游动，被动浮于水面或底部）\n- `sinking_duration_sec` - 沉底时长（无主动游动，停留缸底）\n\n### 衍生指标\n- `abnormal_total_duration_sec` - 异常总时长（侧游 ∪ 倒立 ∪ 旋转 ∪ 异常漂浮/沉底）\n- `observation_total_duration_sec` - 观察总时长\n- `abnormal_ratio` - 异常占比 = abnormal_total / observation_total\n- `swim_speed_anomaly_score` - 游速异常评分（0-100，过慢或抽搐式急加速）\n\n## 场景判定\n\n- `fish_swimming_normal` - 游姿正常\n- `fish_side_swim_brief` - 短暂侧游（轴角 > 30° 但累计时长占比 < 5%）\n- `fish_side_swim_persistent` - 持续侧游（异常占比 5%-20%）\n- `fish_upside_down` - 倒立事件（头部向下 > 45°）\n- `fish_axial_rotation` - 轴向旋转（疑似神经系统受损）\n- `fish_floating_or_sinking` - 异常漂浮/沉底（疑似鱼鳔失调）\n- `fish_swimming_strong_abnormal` - 显著异常（异常占比 > 20% 或多项叠加）\n\n## 4 级告警策略递进\n\n- Level 1（brief）：仅入库记录，不告警，纳入每日游姿趋势\n- Level 2（persistent / 5%-20%）：用户 APP 轻提醒\"鱼缸 X 号出现持续侧游，请观察并检查水质\"\n- Level 3（upside_down / axial_rotation / floating_or_sinking / 异常占比 > 20%）：用户 APP 重要告警 + 建议立即检查（水温、pH、氨氮、亚硝酸盐、溶氧、近期投喂量）\n- Level 4（strong_abnormal / 连续 ≥ 2 日 ≥ Level 3）：紧急告警 + 建议立即换水/观察隔离/咨询观赏鱼兽医\n\n## 单日告警上限\n\n- Level 1：不限（仅入库）\n- Level 2 × 6 / Level 3 × 3 / Level 4 不设上限\n\n## 红线约束\n\n- 禁止做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病\"等疾病诊断\n- 禁止长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定）\n- 禁止用于商业广告 / AI 训练；禁第三方共享\n- 禁止越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数；任何水族设备控制变更必须由用户确认\n- 异常占比、异常时长等指标必须基于真实视频帧统计；**禁止伪造或夸大异常数据**\n- 不同鱼种正常游姿差异极大（如比目鱼天然侧卧、神仙鱼立泳、海马垂直游动）→ 必须按鱼种基线判定；**禁止使用通用阈值对特殊鱼种盲判**\n- 鱼种基线需用户在部署时配置（鱼种清单 / 自定义阈值覆盖）\n\n## 每日游姿健康报告字段\n\n- `report_date` - 报告日期\n- `tank_id` - 鱼缸 ID\n- `observation_hours` - 当日观察总时长\n- `species_baseline_loaded` - 是否加载鱼种基线\n- `abnormal_ratio_today` - 当日异常占比\n- `abnormal_ratio_7d_avg` - 近 7 日异常占比均值\n- `abnormal_ratio_trend` - 趋势（rising / flat / falling）\n- `top_abnormal_scenes` - 当日 Top 3 异常场景\n- `recommended_actions` - 建议动作（检查水质 / 隔离 / 联系兽医等）\n\nFile v1.0.5:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.5:scripts/config.yaml\n\n{}\n\nFile v1.0.5:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.5:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.5:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.5:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.5:skill-card.md\n\n## Description: <br>\nAnalyzes aquarium images, videos, or media URLs to identify abnormal fish swimming postures such as side-swimming, upside-down posture, axial rotation, floating, or sinking and return structured monitoring results. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nExternal aquarists, aquarium operators, and developers use this skill to submit aquarium camera footage for visual posture-abnormality analysis, abnormal-duration ratios, alert levels, recommended actions, and history or report lookup. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill sends aquarium media or media URLs and an automatically resolved identity to the publisher's cloud service. <br>\nMitigation: Use only with appropriate consent and review the deployment's network destinations, data handling, and retention before enabling the skill. <br>\nRisk: The skill can create local workspace data that may include account tokens or identity state. <br>\nMitigation: Run it in a constrained workspace, limit access to local data files, and review token retention or cleanup procedures. <br>\nRisk: History-report queries may retrieve cloud-stored analysis records associated with the resolved identity. <br>\nMitigation: Constrain when history lookup is triggered and verify that returned records are appropriate for the current user or workspace. <br>\nRisk: Visual posture analysis can be mistaken for a veterinary diagnosis. <br>\nMitigation: Treat results as monitoring signals only and require expert or veterinary review before acting on possible disease or water-quality concerns. <br>\n\n\n## Reference(s): <br>\n- [Fish abnormal swimming API documentation](artifact/references/api_doc.md) <br>\n- [Shared analysis API documentation](artifact/skills/smyx_analysis/references/api_doc.md) <br>\n- [ClawHub skill page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-fish-abnormal-swimming-detection-analysis) <br>\n- [Skill demo](https://lifeemergence.com/sample.html) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, json, shell commands, files, guidance] <br>\n**Output Format:** [Markdown text with structured JSON analysis results, report links, and optional saved output files] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May include cloud report export links and history-list results when report lookup is requested.] <br>\n\n## Skill Version(s): <br>\n1.0.5 (source: server release metadata; artifact frontmatter says 1.0.8) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nFile v1.0.5:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.5:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.4: 31 files, 43229 bytes\n\nFiles: references/api_doc.md (5095b), scripts/__init__.py (85b), scripts/config.py (710b), scripts/config.yaml (3b), scripts/skill.py (598b), scripts/smyx_fish_abnormal_swimming_detection_analysis.py (3645b), skill-card.md (2444b), SKILL.md (15950b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (473b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (165b)\n\nFile v1.0.4:SKILL.md\n\n---\nname: \"smyx-fish-abnormal-swimming-detection-analysis\"\ndescription: \"Through fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。\"\nversion: \"1.0.8\"\nlicense: \"MIT-0\"\n---\n\n# 🐟 Fish Abnormal Swimming Posture (Side-swim / Upside-down) Detection | 鱼类游动姿态异常（侧游/倒立）识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **鱼类游动姿态异常（侧游/倒立）识别** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` |\n\nThrough fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). When the body tilt exceeds a threshold (default > 30°), the head points downward by > 45° (upside-down), or continuous rotation around the body's longitudinal axis occurs, the swimming posture is flagged as abnormal, and the proportion of abnormal duration over total observation time is recorded. This skill helps early detection of swim bladder disorder, neurological diseases, water poisoning and other health issues, prompting aquarists to intervene promptly. Application scenarios: home aquariums, public aquariums, ornamental fish farms. The system monitors continuously and generates a daily swimming-posture health report. Skill features: abnormal swimming posture is a common symptom of swim bladder disorder, poisoning, and infection. AI-based automatic identification and quantification of abnormal-time ratio helps aquarists detect issues early and take measures such as water change or medication, reducing mortality. This skill can be integrated into smart aquariums or aquarium cameras as a practical tool for aquarists.\n\n通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。应用场景：家庭鱼缸、水族馆、观赏鱼养殖场。系统连续监测，生成每日游姿健康报告。技能特点：鱼类游姿异常是鱼鳔失调、中毒、感染等疾病的常见症状。通过 AI 自动识别并量化异常时间占比，可帮助养鱼者及早发现问题，采取换水、用药等措施，降低死亡率。该技能可集成到智能鱼缸或水族摄像头中，成为养鱼爱好者的实用工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族健康监测 AI。你的任务是分析鱼缸固定摄像头的视频，检测鱼类的游动姿态，计算鱼体轴线与水平面的夹角。当夹角 > 30°（侧游）或头部向下 > 45°（倒立）或出现连续轴向旋转（≥ 2 圈/秒）时，判定为异常游姿。统计异常游姿时长占总观察时长的比例（异常占比），并按 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）做综合判定，按 4 级告警策略（Level 1 仅入库 → Level 2 用户 APP 轻提醒 → Level 3 用户 APP 重要告警 + 建议立即检查水质 → Level 4 紧急告警 + 建议换水/隔离/咨询观赏鱼兽医）递进。不同鱼种正常游姿差异极大（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动），必须按鱼种基线判定，禁止使用通用阈值对特殊鱼种盲判。不提供任何鱼类疾病医学诊断，仅输出基于视觉的姿态分析结果、异常占比与建议动作；严禁伪造夸大异常数据，严禁越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于鱼缸固定摄像头（家庭鱼缸 / 水族馆 / 观赏鱼养殖场）视频，识别 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）→ 视频核心 8 项（鱼体轴线夹角 / 头部向下角度 / 轴向旋转事件 / 侧游累计时长 / 倒立累计时长 / 漂浮时长 / 沉底时长 / 游速异常评分）+ 衍生指标 4 项（异常总时长 / 观察总时长 / 异常占比 / 鱼体计数）→ 4 档异常等级（normal / brief / persistent / strong_abnormal）→ **4 级告警策略递进**（仅入库 → 用户 APP 轻提醒 → 用户 APP 重要告警 + 检查水质 → 紧急告警 + 建议换水/隔离/咨询兽医）→ 单日告警上限管控（Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限）→ **每日游姿健康报告**（按 tank_id 生成，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作）\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 鱼体目标检测与跟踪（多鱼场景 ReID 可选） |\n| 2 | 鱼体轴线（头-尾向量）几何重建 |\n| 3 | 轴线与水平面夹角逐帧计算 |\n| 4 | 头部朝向识别（区分侧游 vs 倒立） |\n| 5 | 绕纵轴翻转检测（连续旋转） |\n| 6 | 异常游姿时长统计 |\n| 7 | 异常占比量化 |\n| 8 | 游速异常识别（过慢 / 抽搐式急加速） |\n| 9 | 异常漂浮 / 沉底识别 |\n| 10 | 鱼种自适应基线（普通观赏鱼 / 比目鱼 / 神仙鱼 / 海马 / 锦鲤 / 龙鱼等） |\n| 11 | 夜间灯光关闭时段处理（红外辅助 / 自动暂停） |\n| 12 | 用户 APP 推送 |\n| 13 | 4 级告警递进 |\n| 14 | 单日告警上限 |\n| 15 | 每日游姿健康报告（按 tank_id 输出） |\n| 16 | 连续 ≥ 2 日显著异常 → 紧急提醒 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供鱼缸固定摄像头视频 URL 或文件需要分析时，默认触发本技能进行鱼类游动姿态异常识别 |\n| 🔎 明确分析意图 | 当用户明确提及鱼游姿异常、鱼侧游、鱼倒立、鱼翻肚、鱼鳔失调、鱼缸监测、观赏鱼健康、鱼类异常游动等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看鱼类游姿历史报告、鱼缸游姿监测日志清单、鱼游姿异常事件清单、查询历史鱼游姿记录、显示所有鱼缸游姿报告、显示鱼类游姿健康日志，查询鱼缸异常清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备鱼缸固定摄像头视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行鱼类游动姿态异常识别 | 调用 `-m scripts.smyx_fish_abnormal_swimming_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地鱼缸固定摄像头视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络鱼缸固定摄像头视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，鱼类游姿监测场景默认 `other` | 按需填写 |\n| `--list` | 显示鱼类游姿异常监测历史记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_fish_abnormal_swimming_detection_analysis.py`](scripts/smyx_fish_abnormal_swimming_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov，最大 10MB；摄像头需鱼缸侧面固定，主活动区可见；帧率 ≥ 15 FPS |\n| 🔎 使用提醒 | **4 级告警策略递进**（normal → brief → persistent → strong_abnormal/Level 4），异常占比 > 20% 或多项叠加进入 Level 4 |\n| 🔎 使用提醒 | 单日告警上限：Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限（紧急安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **禁止**对鱼做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病 / 寄生虫感染\"等疾病诊断 |\n| 🔎 使用提醒 | **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定） |\n| 🔎 使用提醒 | **禁止**用于商业广告 / AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**越权代用户调整智能鱼缸的加热 / 换水 / 投喂 / 灯光参数；任何水族设备控制变更必须由用户确认 |\n| 🔎 使用提醒 | **绝对禁止**伪造或夸大异常占比、异常时长等指标；所有数据必须基于真实视频帧统计 |\n| 🔎 使用提醒 | **禁止**使用通用阈值对特殊鱼种盲判（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动等）；必须按鱼种基线判定 |\n| 🔎 使用提醒 | **必须**在部署时录入鱼种清单和自定义阈值覆盖 |\n| 🔎 使用提醒 | **必须**：连续 ≥ 2 日显著异常 → 紧急提醒用户尽快联系**当地观赏鱼兽医**或**水族馆专业人员** |\n| 📜 报告输出 | **必须**：每日游姿健康报告**按 tank_id 输出**，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史游姿监测记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地鱼缸视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input /path/to/aquarium.mp4\n\n# 分析网络鱼缸视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --url https://example.com/aquarium.mp4\n\n# 显示历史游姿监测记录清单（自动触发关键词：查看鱼类游姿历史报告、鱼缸游姿监测日志清单等）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --output result.json\n```\n\nFile v1.0.4:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-fish-abnormal-swimming-detection-analysis\",\n  \"version\": \"1.0.4\",\n  \"publishedAt\": 1785447508989\n}\n\nFile v1.0.4:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放鱼类游动姿态异常（侧游/倒立）识别 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼类游姿异常检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取异常游姿事件 + 异常时长占比\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史游姿监测报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出每日游姿健康报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动提醒（用户 APP 推送 / 智能鱼缸告警灯）\n\n## 场景代码\n\n- `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` - 鱼类游动姿态异常（侧游/倒立）识别\n\n## 输入约束\n\n- 摄像头：鱼缸侧面固定摄像头，能完整覆盖鱼缸主活动区域；建议正对鱼缸长边方向\n- 帧率 ≥ 15 FPS（高速游动鱼类建议 ≥ 25 FPS）；分辨率 ≥ 720p\n- 光照：建议保留鱼缸照明，避免反光过强干扰轴线识别；水浑浊度低\n- 时段：可全天运行（默认 24h），夜间灯光关闭时段可切换红外辅助或自动暂停\n- 多鱼缸场景按摄像头 ID 绑定到注册鱼缸 ID（每个鱼缸独立基线 + 鱼种清单）\n- 多鱼场景按目标跟踪 + ReID 绑定到注册个体（每条鱼独立基线，可选）\n- 用户必须授权部署；公共水族馆需公示告知\n\n## 关键观测信号\n\n### 视频（核心）\n- `fish_count_detected` - 画面内被跟踪鱼数量\n- `body_axis_angle_deg` - 鱼体轴线与水平面夹角（°，正常 ≤ 30°）\n- `head_down_angle_deg` - 头部向下倾斜角度（°，倒立判定阈值 > 45°）\n- `axial_rotation_event_count` - 绕自身纵轴连续翻转事件次数（≥ 2 圈/秒视为旋转事件）\n- `side_swim_duration_sec` - 累计侧游时长（轴角 > 30° 持续时间）\n- `upside_down_duration_sec` - 累计倒立时长（头部向下 > 45° 持续时间）\n- `floating_duration_sec` - 漂浮时长（无主动游动，被动浮于水面或底部）\n- `sinking_duration_sec` - 沉底时长（无主动游动，停留缸底）\n\n### 衍生指标\n- `abnormal_total_duration_sec` - 异常总时长（侧游 ∪ 倒立 ∪ 旋转 ∪ 异常漂浮/沉底）\n- `observation_total_duration_sec` - 观察总时长\n- `abnormal_ratio` - 异常占比 = abnormal_total / observation_total\n- `swim_speed_anomaly_score` - 游速异常评分（0-100，过慢或抽搐式急加速）\n\n## 场景判定\n\n- `fish_swimming_normal` - 游姿正常\n- `fish_side_swim_brief` - 短暂侧游（轴角 > 30° 但累计时长占比 < 5%）\n- `fish_side_swim_persistent` - 持续侧游（异常占比 5%-20%）\n- `fish_upside_down` - 倒立事件（头部向下 > 45°）\n- `fish_axial_rotation` - 轴向旋转（疑似神经系统受损）\n- `fish_floating_or_sinking` - 异常漂浮/沉底（疑似鱼鳔失调）\n- `fish_swimming_strong_abnormal` - 显著异常（异常占比 > 20% 或多项叠加）\n\n## 4 级告警策略递进\n\n- Level 1（brief）：仅入库记录，不告警，纳入每日游姿趋势\n- Level 2（persistent / 5%-20%）：用户 APP 轻提醒\"鱼缸 X 号出现持续侧游，请观察并检查水质\"\n- Level 3（upside_down / axial_rotation / floating_or_sinking / 异常占比 > 20%）：用户 APP 重要告警 + 建议立即检查（水温、pH、氨氮、亚硝酸盐、溶氧、近期投喂量）\n- Level 4（strong_abnormal / 连续 ≥ 2 日 ≥ Level 3）：紧急告警 + 建议立即换水/观察隔离/咨询观赏鱼兽医\n\n## 单日告警上限\n\n- Level 1：不限（仅入库）\n- Level 2 × 6 / Level 3 × 3 / Level 4 不设上限\n\n## 红线约束\n\n- 禁止做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病\"等疾病诊断\n- 禁止长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定）\n- 禁止用于商业广告 / AI 训练；禁第三方共享\n- 禁止越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数；任何水族设备控制变更必须由用户确认\n- 异常占比、异常时长等指标必须基于真实视频帧统计；**禁止伪造或夸大异常数据**\n- 不同鱼种正常游姿差异极大（如比目鱼天然侧卧、神仙鱼立泳、海马垂直游动）→ 必须按鱼种基线判定；**禁止使用通用阈值对特殊鱼种盲判**\n- 鱼种基线需用户在部署时配置（鱼种清单 / 自定义阈值覆盖）\n\n## 每日游姿健康报告字段\n\n- `report_date` - 报告日期\n- `tank_id` - 鱼缸 ID\n- `observation_hours` - 当日观察总时长\n- `species_baseline_loaded` - 是否加载鱼种基线\n- `abnormal_ratio_today` - 当日异常占比\n- `abnormal_ratio_7d_avg` - 近 7 日异常占比均值\n- `abnormal_ratio_trend` - 趋势（rising / flat / falling）\n- `top_abnormal_scenes` - 当日 Top 3 异常场景\n- `recommended_actions` - 建议动作（检查水质 / 隔离 / 联系兽医等）\n\nFile v1.0.4:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.4:scripts/config.yaml\n\n{}\n\nFile v1.0.4:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.4:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.4:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.4:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.4:skill-card.md\n\n## Description: <br>\nAnalyzes aquarium camera images or videos to flag visual fish swimming-posture abnormalities such as side-swimming, upside-down posture, axial rotation, floating, or sinking, and reports abnormal-duration ratios. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nAquarium keepers, aquarium operators, and agents use this skill to analyze fixed-camera fish media, produce structured posture-monitoring reports, and review historical cloud reports. The output is visual posture analysis and suggested next actions, not a veterinary diagnosis. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Aquarium media or media URLs may be sent to the configured cloud service. <br>\nMitigation: Use the skill only when the service's retention and account controls are acceptable, and avoid sensitive or private camera footage. <br>\nRisk: The skill can silently create or reuse an internal identity, store tokens locally, and fetch prior cloud history. <br>\nMitigation: Install and run it in a contained workspace, review account behavior before deployment, and limit use to authorized users and media. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-fish-abnormal-swimming-detection-analysis) <br>\n- [Skill demo](https://lifeemergence.com/sample.html) <br>\n- [API documentation](artifact/references/api_doc.md) <br>\n- [Shared analysis API documentation](artifact/skills/smyx_analysis/references/api_doc.md) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, JSON, shell commands, configuration] <br>\n**Output Format:** [Markdown and JSON analysis reports with report links] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May write an optional output file when requested; historical report queries return structured cloud report records.] <br>\n\n## Skill Version(s): <br>\n1.0.4 (source: server release metadata; artifact frontmatter reports 1.0.8) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nFile v1.0.4:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.4:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.3: 31 files, 43379 bytes\n\nFiles: references/api_doc.md (5095b), scripts/__init__.py (85b), scripts/config.py (710b), scripts/config.yaml (3b), scripts/skill.py (598b), scripts/smyx_fish_abnormal_swimming_detection_analysis.py (3645b), skill-card.md (2838b), SKILL.md (15950b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (473b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (165b)\n\nFile v1.0.3:SKILL.md\n\n---\nname: \"smyx-fish-abnormal-swimming-detection-analysis\"\ndescription: \"Through fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。\"\nversion: \"1.0.5\"\nlicense: \"MIT-0\"\n---\n\n# 🐟 Fish Abnormal Swimming Posture (Side-swim / Upside-down) Detection | 鱼类游动姿态异常（侧游/倒立）识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **鱼类游动姿态异常（侧游/倒立）识别** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` |\n\nThrough fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). When the body tilt exceeds a threshold (default > 30°), the head points downward by > 45° (upside-down), or continuous rotation around the body's longitudinal axis occurs, the swimming posture is flagged as abnormal, and the proportion of abnormal duration over total observation time is recorded. This skill helps early detection of swim bladder disorder, neurological diseases, water poisoning and other health issues, prompting aquarists to intervene promptly. Application scenarios: home aquariums, public aquariums, ornamental fish farms. The system monitors continuously and generates a daily swimming-posture health report. Skill features: abnormal swimming posture is a common symptom of swim bladder disorder, poisoning, and infection. AI-based automatic identification and quantification of abnormal-time ratio helps aquarists detect issues early and take measures such as water change or medication, reducing mortality. This skill can be integrated into smart aquariums or aquarium cameras as a practical tool for aquarists.\n\n通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。应用场景：家庭鱼缸、水族馆、观赏鱼养殖场。系统连续监测，生成每日游姿健康报告。技能特点：鱼类游姿异常是鱼鳔失调、中毒、感染等疾病的常见症状。通过 AI 自动识别并量化异常时间占比，可帮助养鱼者及早发现问题，采取换水、用药等措施，降低死亡率。该技能可集成到智能鱼缸或水族摄像头中，成为养鱼爱好者的实用工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族健康监测 AI。你的任务是分析鱼缸固定摄像头的视频，检测鱼类的游动姿态，计算鱼体轴线与水平面的夹角。当夹角 > 30°（侧游）或头部向下 > 45°（倒立）或出现连续轴向旋转（≥ 2 圈/秒）时，判定为异常游姿。统计异常游姿时长占总观察时长的比例（异常占比），并按 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）做综合判定，按 4 级告警策略（Level 1 仅入库 → Level 2 用户 APP 轻提醒 → Level 3 用户 APP 重要告警 + 建议立即检查水质 → Level 4 紧急告警 + 建议换水/隔离/咨询观赏鱼兽医）递进。不同鱼种正常游姿差异极大（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动），必须按鱼种基线判定，禁止使用通用阈值对特殊鱼种盲判。不提供任何鱼类疾病医学诊断，仅输出基于视觉的姿态分析结果、异常占比与建议动作；严禁伪造夸大异常数据，严禁越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于鱼缸固定摄像头（家庭鱼缸 / 水族馆 / 观赏鱼养殖场）视频，识别 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）→ 视频核心 8 项（鱼体轴线夹角 / 头部向下角度 / 轴向旋转事件 / 侧游累计时长 / 倒立累计时长 / 漂浮时长 / 沉底时长 / 游速异常评分）+ 衍生指标 4 项（异常总时长 / 观察总时长 / 异常占比 / 鱼体计数）→ 4 档异常等级（normal / brief / persistent / strong_abnormal）→ **4 级告警策略递进**（仅入库 → 用户 APP 轻提醒 → 用户 APP 重要告警 + 检查水质 → 紧急告警 + 建议换水/隔离/咨询兽医）→ 单日告警上限管控（Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限）→ **每日游姿健康报告**（按 tank_id 生成，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作）\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 鱼体目标检测与跟踪（多鱼场景 ReID 可选） |\n| 2 | 鱼体轴线（头-尾向量）几何重建 |\n| 3 | 轴线与水平面夹角逐帧计算 |\n| 4 | 头部朝向识别（区分侧游 vs 倒立） |\n| 5 | 绕纵轴翻转检测（连续旋转） |\n| 6 | 异常游姿时长统计 |\n| 7 | 异常占比量化 |\n| 8 | 游速异常识别（过慢 / 抽搐式急加速） |\n| 9 | 异常漂浮 / 沉底识别 |\n| 10 | 鱼种自适应基线（普通观赏鱼 / 比目鱼 / 神仙鱼 / 海马 / 锦鲤 / 龙鱼等） |\n| 11 | 夜间灯光关闭时段处理（红外辅助 / 自动暂停） |\n| 12 | 用户 APP 推送 |\n| 13 | 4 级告警递进 |\n| 14 | 单日告警上限 |\n| 15 | 每日游姿健康报告（按 tank_id 输出） |\n| 16 | 连续 ≥ 2 日显著异常 → 紧急提醒 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供鱼缸固定摄像头视频 URL 或文件需要分析时，默认触发本技能进行鱼类游动姿态异常识别 |\n| 🔎 明确分析意图 | 当用户明确提及鱼游姿异常、鱼侧游、鱼倒立、鱼翻肚、鱼鳔失调、鱼缸监测、观赏鱼健康、鱼类异常游动等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看鱼类游姿历史报告、鱼缸游姿监测日志清单、鱼游姿异常事件清单、查询历史鱼游姿记录、显示所有鱼缸游姿报告、显示鱼类游姿健康日志，查询鱼缸异常清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备鱼缸固定摄像头视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行鱼类游动姿态异常识别 | 调用 `-m scripts.smyx_fish_abnormal_swimming_detection_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地鱼缸固定摄像头视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络鱼缸固定摄像头视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，鱼类游姿监测场景默认 `other` | 按需填写 |\n| `--list` | 显示鱼类游姿异常监测历史记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_fish_abnormal_swimming_detection_analysis.py`](scripts/smyx_fish_abnormal_swimming_detection_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov，最大 10MB；摄像头需鱼缸侧面固定，主活动区可见；帧率 ≥ 15 FPS |\n| 🔎 使用提醒 | **4 级告警策略递进**（normal → brief → persistent → strong_abnormal/Level 4），异常占比 > 20% 或多项叠加进入 Level 4 |\n| 🔎 使用提醒 | 单日告警上限：Level 1 不限 / Level 2 × 6 / Level 3 × 3 / Level 4 不设上限（紧急安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **禁止**对鱼做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病 / 寄生虫感染\"等疾病诊断 |\n| 🔎 使用提醒 | **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定） |\n| 🔎 使用提醒 | **禁止**用于商业广告 / AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**越权代用户调整智能鱼缸的加热 / 换水 / 投喂 / 灯光参数；任何水族设备控制变更必须由用户确认 |\n| 🔎 使用提醒 | **绝对禁止**伪造或夸大异常占比、异常时长等指标；所有数据必须基于真实视频帧统计 |\n| 🔎 使用提醒 | **禁止**使用通用阈值对特殊鱼种盲判（比目鱼天然侧卧、神仙鱼立泳、海马垂直游动等）；必须按鱼种基线判定 |\n| 🔎 使用提醒 | **必须**在部署时录入鱼种清单和自定义阈值覆盖 |\n| 🔎 使用提醒 | **必须**：连续 ≥ 2 日显著异常 → 紧急提醒用户尽快联系**当地观赏鱼兽医**或**水族馆专业人员** |\n| 📜 报告输出 | **必须**：每日游姿健康报告**按 tank_id 输出**，含异常占比 + 近 7 日趋势 + Top 3 异常场景 + 建议动作 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史游姿监测记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地鱼缸视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input /path/to/aquarium.mp4\n\n# 分析网络鱼缸视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --url https://example.com/aquarium.mp4\n\n# 显示历史游姿监测记录清单（自动触发关键词：查看鱼类游姿历史报告、鱼缸游姿监测日志清单等）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --output result.json\n```\n\nFile v1.0.3:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-fish-abnormal-swimming-detection-analysis\",\n  \"version\": \"1.0.3\",\n  \"publishedAt\": 1784278110112\n}\n\nFile v1.0.3:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放鱼类游动姿态异常（侧游/倒立）识别 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼类游姿异常检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取异常游姿事件 + 异常时长占比\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史游姿监测报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出每日游姿健康报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动提醒（用户 APP 推送 / 智能鱼缸告警灯）\n\n## 场景代码\n\n- `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` - 鱼类游动姿态异常（侧游/倒立）识别\n\n## 输入约束\n\n- 摄像头：鱼缸侧面固定摄像头，能完整覆盖鱼缸主活动区域；建议正对鱼缸长边方向\n- 帧率 ≥ 15 FPS（高速游动鱼类建议 ≥ 25 FPS）；分辨率 ≥ 720p\n- 光照：建议保留鱼缸照明，避免反光过强干扰轴线识别；水浑浊度低\n- 时段：可全天运行（默认 24h），夜间灯光关闭时段可切换红外辅助或自动暂停\n- 多鱼缸场景按摄像头 ID 绑定到注册鱼缸 ID（每个鱼缸独立基线 + 鱼种清单）\n- 多鱼场景按目标跟踪 + ReID 绑定到注册个体（每条鱼独立基线，可选）\n- 用户必须授权部署；公共水族馆需公示告知\n\n## 关键观测信号\n\n### 视频（核心）\n- `fish_count_detected` - 画面内被跟踪鱼数量\n- `body_axis_angle_deg` - 鱼体轴线与水平面夹角（°，正常 ≤ 30°）\n- `head_down_angle_deg` - 头部向下倾斜角度（°，倒立判定阈值 > 45°）\n- `axial_rotation_event_count` - 绕自身纵轴连续翻转事件次数（≥ 2 圈/秒视为旋转事件）\n- `side_swim_duration_sec` - 累计侧游时长（轴角 > 30° 持续时间）\n- `upside_down_duration_sec` - 累计倒立时长（头部向下 > 45° 持续时间）\n- `floating_duration_sec` - 漂浮时长（无主动游动，被动浮于水面或底部）\n- `sinking_duration_sec` - 沉底时长（无主动游动，停留缸底）\n\n### 衍生指标\n- `abnormal_total_duration_sec` - 异常总时长（侧游 ∪ 倒立 ∪ 旋转 ∪ 异常漂浮/沉底）\n- `observation_total_duration_sec` - 观察总时长\n- `abnormal_ratio` - 异常占比 = abnormal_total / observation_total\n- `swim_speed_anomaly_score` - 游速异常评分（0-100，过慢或抽搐式急加速）\n\n## 场景判定\n\n- `fish_swimming_normal` - 游姿正常\n- `fish_side_swim_brief` - 短暂侧游（轴角 > 30° 但累计时长占比 < 5%）\n- `fish_side_swim_persistent` - 持续侧游（异常占比 5%-20%）\n- `fish_upside_down` - 倒立事件（头部向下 > 45°）\n- `fish_axial_rotation` - 轴向旋转（疑似神经系统受损）\n- `fish_floating_or_sinking` - 异常漂浮/沉底（疑似鱼鳔失调）\n- `fish_swimming_strong_abnormal` - 显著异常（异常占比 > 20% 或多项叠加）\n\n## 4 级告警策略递进\n\n- Level 1（brief）：仅入库记录，不告警，纳入每日游姿趋势\n- Level 2（persistent / 5%-20%）：用户 APP 轻提醒\"鱼缸 X 号出现持续侧游，请观察并检查水质\"\n- Level 3（upside_down / axial_rotation / floating_or_sinking / 异常占比 > 20%）：用户 APP 重要告警 + 建议立即检查（水温、pH、氨氮、亚硝酸盐、溶氧、近期投喂量）\n- Level 4（strong_abnormal / 连续 ≥ 2 日 ≥ Level 3）：紧急告警 + 建议立即换水/观察隔离/咨询观赏鱼兽医\n\n## 单日告警上限\n\n- Level 1：不限（仅入库）\n- Level 2 × 6 / Level 3 × 3 / Level 4 不设上限\n\n## 红线约束\n\n- 禁止做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病\"等疾病诊断\n- 禁止长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定）\n- 禁止用于商业广告 / AI 训练；禁第三方共享\n- 禁止越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数；任何水族设备控制变更必须由用户确认\n- 异常占比、异常时长等指标必须基于真实视频帧统计；**禁止伪造或夸大异常数据**\n- 不同鱼种正常游姿差异极大（如比目鱼天然侧卧、神仙鱼立泳、海马垂直游动）→ 必须按鱼种基线判定；**禁止使用通用阈值对特殊鱼种盲判**\n- 鱼种基线需用户在部署时配置（鱼种清单 / 自定义阈值覆盖）\n\n## 每日游姿健康报告字段\n\n- `report_date` - 报告日期\n- `tank_id` - 鱼缸 ID\n- `observation_hours` - 当日观察总时长\n- `species_baseline_loaded` - 是否加载鱼种基线\n- `abnormal_ratio_today` - 当日异常占比\n- `abnormal_ratio_7d_avg` - 近 7 日异常占比均值\n- `abnormal_ratio_trend` - 趋势（rising / flat / falling）\n- `top_abnormal_scenes` - 当日 Top 3 异常场景\n- `recommended_actions` - 建议动作（检查水质 / 隔离 / 联系兽医等）\n\nFile v1.0.3:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.3:scripts/config.yaml\n\n{}\n\nFile v1.0.3:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.3:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.3:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.3:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.3:skill-card.md\n\n## Description: <br>\nAnalyzes fixed-camera aquarium images or videos to identify abnormal fish swimming posture, quantify abnormal-duration ratios, and produce struct...","readmeExcerpt":"Skill: Fish Abnormal Swimming Posture (Side-swim / Upside-down) Detection | 鱼类游动姿态异常（侧游/倒立）识别 Owner: smyx-sunjinhui Summary: Through fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"python -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list"},{"language":"text","snippet":"requests>=2.28.0"},{"language":"bash","snippet":"# 分析本地鱼缸视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input /path/to/aquarium.mp4\n\n# 分析网络鱼缸视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --url https://example.com/aquarium.mp4\n\n# 显示历史游姿监测记录清单（自动触发关键词：查看鱼类游姿历史报告、鱼缸游姿监测日志清单等）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --output result.json"},{"language":"bash","snippet":"python -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list"},{"language":"text","snippet":"requests>=2.28.0"},{"language":"bash","snippet":"# 分析本地鱼缸视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input /path/to/aquarium.mp4\n\n# 分析网络鱼缸视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --url https://example.com/aquarium.mp4\n\n# 显示历史游姿监测记录清单（自动触发关键词：查看鱼类游姿历史报告、鱼缸游姿监测日志清单等）\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_abnormal_swimming_detection_analysis --input aq.mp4 --output result.json"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: \"smyx-fish-abnormal-swimming-detection-analysis\"\ndescription: \"Through fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。\"\nversion: \"1.0.15\"\nlicense: \"MIT-0\"\n---\n\n# 🐟 Fish Abnormal Swimming Posture (Side-swim / Upside-down) Detection | 鱼类游动姿态异常（侧游/倒立）识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **鱼类游动姿态异常（侧游/倒立）识别** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` |\n\nThrough fixed cameras on aquariums, the system analyzes fish swimming videos and computes the angle between the fish body axis and the horizontal plane (normal fish bodies stay nearly horizontal). When the body tilt exceeds a threshold (default > 30°), the head points downward by > 45° (upside-down), or continuous rotation around the body's longitudinal axis occurs, the swimming posture is flagged as abnormal, and the proportion of abnormal duration over total observation time is recorded. This skill helps early detection of swim bladder disorder, neurological diseases, water poisoning and other health issues, prompting aquarists to intervene promptly. Application scenarios: home aquariums, public aquariums, ornamental fish farms. The system monitors continuously and generates a daily swimming-posture health report. Skill features: abnormal swimming posture is a common symptom of swim bladder disorder, poisoning, and infection. AI-based automatic identification and quantification of abnormal-time ratio helps aquarists detect issues early and take measures such as water change or medication, reducing mortality. This skill can be integrated into smart aquariums or aquarium cameras as a practical tool for aquarists.\n\n通过鱼缸固定摄像头，分析鱼类的游动视频，检测鱼体轴线与水平面的夹角（正常鱼体基本保持水平），当鱼体倾斜角度超过阈值（默认 > 30°）或出现倒立（头部向下 > 45°）、旋转（绕自身纵轴连续翻转）等异常游姿时，标记为异常，并记录异常时长占观察总时长的比例。该技能有助于早期发现鱼鳔失调、神经系统疾病或水质中毒等健康问题，提醒养鱼爱好者及时干预。应用场景：家庭鱼缸、水族馆、观赏鱼养殖场。系统连续监测，生成每日游姿健康报告。技能特点：鱼类游姿异常是鱼鳔失调、中毒、感染等疾病的常见症状。通过 AI 自动识别并量化异常时间占比，可帮助养鱼者及早发现问题，采取换水、用药等措施，降低死亡率。该技能可集成到智能鱼缸或水族摄像头中，成为养鱼爱好者的实用工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族健康监测 AI。你的任务是分析鱼缸固定摄像头的视频，检测鱼类的游动姿态，计算鱼体轴线与水平面的夹角。当夹角 > 30°（侧游）或头部向下 > 45°（倒立）或出现连续轴向旋转（≥ 2 圈/秒）时，判定为异常游姿。统计异常游姿时长占总观察时长的比例（异常占比），并按 7 类场景（fish_swimming_normal / side_swim_brief / side_swim_persistent / upside_down / axial_rotation / floating_or_sinking / strong_abnormal）做综合判定，按 4 级告警策略（Level 1 仅入库 → Level 2 用户 APP 轻提醒 → Level 3 用户 APP 重要告"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-fish-abnormal-swimming-detection-analysis\",\n  \"version\": \"1.0.11\",\n  \"publishedAt\": 1790742745347\n}"},{"path":"references/api_doc.md","content":"# API 接口文档\n\n此处用于存放鱼类游动姿态异常（侧游/倒立）识别 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼类游姿异常检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取异常游姿事件 + 异常时长占比\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史游姿监测报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出每日游姿健康报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动提醒（用户 APP 推送 / 智能鱼缸告警灯）\n\n## 场景代码\n\n- `SMYX_FISH_ABNORMAL_SWIMMING_DETECTION_ANALYSIS` - 鱼类游动姿态异常（侧游/倒立）识别\n\n## 输入约束\n\n- 摄像头：鱼缸侧面固定摄像头，能完整覆盖鱼缸主活动区域；建议正对鱼缸长边方向\n- 帧率 ≥ 15 FPS（高速游动鱼类建议 ≥ 25 FPS）；分辨率 ≥ 720p\n- 光照：建议保留鱼缸照明，避免反光过强干扰轴线识别；水浑浊度低\n- 时段：可全天运行（默认 24h），夜间灯光关闭时段可切换红外辅助或自动暂停\n- 多鱼缸场景按摄像头 ID 绑定到注册鱼缸 ID（每个鱼缸独立基线 + 鱼种清单）\n- 多鱼场景按目标跟踪 + ReID 绑定到注册个体（每条鱼独立基线，可选）\n- 用户必须授权部署；公共水族馆需公示告知\n\n## 关键观测信号\n\n### 视频（核心）\n- `fish_count_detected` - 画面内被跟踪鱼数量\n- `body_axis_angle_deg` - 鱼体轴线与水平面夹角（°，正常 ≤ 30°）\n- `head_down_angle_deg` - 头部向下倾斜角度（°，倒立判定阈值 > 45°）\n- `axial_rotation_event_count` - 绕自身纵轴连续翻转事件次数（≥ 2 圈/秒视为旋转事件）\n- `side_swim_duration_sec` - 累计侧游时长（轴角 > 30° 持续时间）\n- `upside_down_duration_sec` - 累计倒立时长（头部向下 > 45° 持续时间）\n- `floating_duration_sec` - 漂浮时长（无主动游动，被动浮于水面或底部）\n- `sinking_duration_sec` - 沉底时长（无主动游动，停留缸底）\n\n### 衍生指标\n- `abnormal_total_duration_sec` - 异常总时长（侧游 ∪ 倒立 ∪ 旋转 ∪ 异常漂浮/沉底）\n- `observation_total_duration_sec` - 观察总时长\n- `abnormal_ratio` - 异常占比 = abnormal_total / observation_total\n- `swim_speed_anomaly_score` - 游速异常评分（0-100，过慢或抽搐式急加速）\n\n## 场景判定\n\n- `fish_swimming_normal` - 游姿正常\n- `fish_side_swim_brief` - 短暂侧游（轴角 > 30° 但累计时长占比 < 5%）\n- `fish_side_swim_persistent` - 持续侧游（异常占比 5%-20%）\n- `fish_upside_down` - 倒立事件（头部向下 > 45°）\n- `fish_axial_rotation` - 轴向旋转（疑似神经系统受损）\n- `fish_floating_or_sinking` - 异常漂浮/沉底（疑似鱼鳔失调）\n- `fish_swimming_strong_abnormal` - 显著异常（异常占比 > 20% 或多项叠加）\n\n## 4 级告警策略递进\n\n- Level 1（brief）：仅入库记录，不告警，纳入每日游姿趋势\n- Level 2（persistent / 5%-20%）：用户 APP 轻提醒\"鱼缸 X 号出现持续侧游，请观察并检查水质\"\n- Level 3（upside_down / axial_rotation / floating_or_sinking / 异常占比 > 20%）：用户 APP 重要告警 + 建议立即检查（水温、pH、氨氮、亚硝酸盐、溶氧、近期投喂量）\n- Level 4（strong_abnormal / 连续 ≥ 2 日 ≥ Level 3）：紧急告警 + 建议立即换水/观察隔离/咨询观赏鱼兽医\n\n## 单日告警上限\n\n- Level 1：不限（仅入库）\n- Level 2 × 6 / Level 3 × 3 / Level 4 不设上限\n\n## 红线约束\n\n- 禁止做\"鱼鳔病 / 神经系统疾病 / 重金属中毒 / 立鳞病\"等疾病诊断\n- 禁止长期存储完整鱼缸视频（≤ 7 天，仅入库异常事件片段；公共水族馆按管理规定）\n- 禁止用于商业广告 / AI 训练；禁第三方共享\n- 禁止越权代用户调整智能鱼缸的加热/换水/投喂/灯光参数；任何水族设备控制变更必须由用户确认\n- 异常占比、异常时长等指标必须基于真实视频帧统计；**禁止伪造或夸大异常数据**\n- 不同鱼种正常游姿差异极大（如比目鱼天然侧卧、神仙鱼立泳、海马垂直游动）→ 必须按鱼种基线判定；**禁止使用通用阈值对特殊鱼种盲判**\n- 鱼种基线需用户在部署时配置（鱼种清单 / 自定义阈值覆盖）\n\n## 每日游姿健康报告字段\n\n- `report_date` - 报告日期\n- `tank_id` - 鱼缸 ID\n- `observation_hours` - 当日观察总时长\n- `species_baseline_loaded` - 是否加载鱼种基线\n- `abnormal_ratio_today` - 当日异常占比\n- `abnormal_ratio_7d_avg` - 近 7 日异常占比均值\n- `abnormal_ratio_trend` - 趋势（rising / flat / falling）\n- `top_abnormal_scenes` - 当日 Top 3 异常场景\n- `recommended_actions` - 建议动作（检查水质 / 隔离 / 联系兽医等）"},{"path":"skills/smyx_analysis/references/api_doc.md","content":"# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |"},{"path":"scripts/config.yaml","content":"{}"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":null,"editorialQuality":{"score":100,"threshold":65,"status":"thin","wordCount":1185,"uniquenessScore":42,"reasons":["uniqueness-below-45"]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-10T04:16:42.195Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-10T04:16:42.195Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-10T10:07:28.078Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}