27 lines
1.1 KiB
Bash
Executable File
27 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
||
# 让 nanobot 自己去连 AgentHub Gateway:
|
||
# 1) 确认内置 channel 已就位(镜像里是软链,真目录由 compose 挂在 /opt/agenthub/channel)
|
||
# 2) 首次启动时补齐 config.json(模型 + 打开 agenthub channel)
|
||
# 3) 交回镜像的 CMD(nanobot gateway --foreground ...)
|
||
set -e
|
||
|
||
channel_dir=/opt/agenthub/channel/agenthub
|
||
if [ ! -f "${channel_dir}/manifest.py" ]; then
|
||
echo "[entrypoint] 缺少 ${channel_dir}(compose 要把 channel/ 挂到 /opt/agenthub/channel)" >&2
|
||
exit 2
|
||
fi
|
||
# nanobot 只会发现安装树里的 channel 包,这里按它自己的口径确认一次。
|
||
python - <<'PY'
|
||
import nanobot.channels as package
|
||
from nanobot.channels.plugin import has_channel_package
|
||
import os
|
||
roots = list(package.__path__)
|
||
found = [p for p in roots if has_channel_package("agenthub")]
|
||
print("[entrypoint] channels 包路径:{}".format(", ".join(roots)))
|
||
if not found:
|
||
raise SystemExit("[entrypoint] nanobot 没发现 agenthub channel(软链没跟上?)")
|
||
print("[entrypoint] agenthub channel 就位")
|
||
PY
|
||
python /opt/agenthub/seed_config.py
|
||
exec nanobot "$@"
|