Files
admin c67cec3feb docs: 新增 references/gpu-selection.md 选机速查
按卡选活的对照表:什么活该用哪台机、哪个端点。

覆盖高频踩坑点:
- H3 的 I2V 看卡不看端口:30113(22GB) 塞 first_frame 必 OOM,要首帧锁图用 A14B,
  要台词口型用 30121(64GB)
- 30113 一卡一实例 + 4Gi 内存墙,图/视频/A14B 只能串行;连续出图 30 张会崩
- H3 视频固定配方:20 步 / res_multistep+simple / cfg1.0 / 无 LoRA
- 两端出图量化档方向相反(30113=int8_convrot, 30121=w4a8),搞反静默出纯色图
- 30121 禁调 /api/free;queue/history 是内存态,实例重启任务静默全丢
- 附 30 秒开工自检(端点/队列/权重三查)

install.sh 完整性清单同步;SKILL.md 五条铁律处加引用。
2026-11-19 19:02:40 +08:00

112 lines
4.0 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# ai-manju 安装 / 体检:把技能接入各 agent 的 skills 目录
# ./install.sh 建软链(已正确则跳过;遇到实体目录不覆盖)
# ./install.sh --check 只读体检,不改任何文件
set -uo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
NAME="ai-manju"
CHECK=0
[ "${1:-}" = "--check" ] && CHECK=1
echo "技能源:$HERE"
echo
# 1) 完整性
ok=1
for f in SKILL.md scripts/manju.py scripts/submit_i2v.py scripts/submit_t2i.py \
scripts/submit_h3_native.py scripts/queue_h3_native.py scripts/fetch_h3_native.py \
scripts/fetch_t2i.py scripts/render_native.py scripts/align_subtitles.py \
scripts/cleanup_comfyui.py scripts/selftest_cleanup.py scripts/render.py \
assets/config.template.json assets/shot.schema.json \
assets/comfyui-manju-cleanup/__init__.py references/pitfalls.md references/models.md \
references/native-av.md references/gpu-selection.md; do
if [ ! -f "$HERE/$f" ]; then echo "✗ 缺少 $f"; ok=0; fi
done
[ "$ok" = 1 ] && echo "✓ 技能包完整"
[ "$ok" = 0 ] && exit 1
# 2) 依赖(只提示不强制:setup/validate/manifest 不需要这些)
python3 -V 2>/dev/null || echo "⚠ 未找到 python3(脚本必需)"
if python3 -c 'import imageio_ffmpeg' 2>/dev/null; then
echo "✓ imageio-ffmpeg(渲染/审片)"
else
echo "⚠ 缺 imageio-ffmpeg:pip install --user imageio-ffmpeg(不要 brew 装)"
fi
if python3 -c 'import edge_tts' 2>/dev/null; then
echo "✓ edge-tts(配音)"
else
echo "⚠ 缺 edge-tts:pip install --user edge-tts(仅配音阶段需要)"
fi
echo
# 3) 软链。技能包在 ~/.agents/skills/ 下时用相对软链,便于整体搬迁;否则用绝对路径
realpath_of() { python3 -c "import os,sys;print(os.path.realpath(sys.argv[1]))" "$1" 2>/dev/null; }
STD="$HOME/.agents/skills/$NAME"
if [ "$(realpath_of "$HERE")" = "$(realpath_of "$STD")" ]; then
TARGET="../../.agents/skills/$NAME"
echo "链接方式:相对软链(遵循单一真相源 ~/.agents/skills/)"
else
TARGET="$HERE"
echo "链接方式:绝对软链(技能包不在 ~/.agents/skills/ 下)"
fi
echo
rc=0
found=0
# --check 追加:语法 / JSON / 清理链路自检(只读,不写技能包)
if [ "$CHECK" = 1 ]; then
if python3 - "$HERE" <<'PY'
import ast, json, pathlib, sys
root = pathlib.Path(sys.argv[1])
for p in sorted(root.rglob("*.py")):
ast.parse(p.read_text(encoding="utf-8"), filename=str(p))
for p in sorted(root.rglob("*.json")):
json.loads(p.read_text(encoding="utf-8"))
PY
then
echo "✓ Python 语法 / JSON 全部合法"
else
echo "✗ 存在语法错误或非法 JSON"
rc=1
fi
if python3 "$HERE/scripts/selftest_cleanup.py" >/dev/null 2>&1; then
echo "✓ 清理链路自检通过(扩展 + 归属 + 顺序 + 复核)"
else
echo "✗ 清理链路自检失败,手动跑:python3 scripts/selftest_cleanup.py"
rc=1
fi
fi
for d in "$HOME/.claude/skills" "$HOME/.workbuddy/skills" "$HOME/.qwenworkcn/skills"; do
[ -d "$d" ] || continue
found=1
link="$d/$NAME"
if [ -L "$link" ]; then
if [ "$(realpath_of "$link")" = "$(realpath_of "$HERE")" ]; then
echo "✓ 已就位 $link -> $(readlink "$link")"
else
echo "⚠ 指向他处 $link -> $(readlink "$link")(未改动,请手动处理)"
fi
elif [ -e "$link" ]; then
echo "✗ 冲突:$link 是实体,未覆盖;请备份后删除再运行"
rc=1
elif [ "$CHECK" = 1 ]; then
echo "+ 待建立 $link -> $TARGET"
else
mkdir -p "$d"
ln -s "$TARGET" "$link"
echo "+ 已建立 $link -> $TARGET"
fi
done
[ "$found" = 0 ] && echo "⚠ 未发现任何 agent 的 skills 目录;请手动把本技能目录放入对应位置"
echo
if [ "$CHECK" = 1 ]; then
echo "(--check 只读体检完成,未改动任何文件)"
else
echo "安装完成。新开一个 agent 会话即可被识别;也可用 triagent-sync --skills-agents 同步。"
fi
exit "$rc"