安装deepseekharness
安装deepseekharness,需要安装node,然后才能安装 deepseekharness.
1.安装node 参考安装node
2. 安装deepseekharness,在命令行中运行,不管是 macos linux还是windows
npx @deepseek-ai/dsh web
它默认会启动 web 界面,然后根据web提示操作即可。
3. 启动shell,因为是直接安装web 没有 dsh 命令服务,我新建了一个shell,用于启动和关闭。 如果windows,自行将其转换为bat脚本。
#!/bin/bash
PORT=3080
LOG_FILE="$HOME/.dsh.log"
case "$1" in
start)
# 检查是否已经运行
if lsof -iTCP:$PORT -sTCP:LISTEN >/dev/null 2>&1; then
echo "DeepSeek Harness 已经运行: http://127.0.0.1:$PORT"
exit 0
fi
# 确认 npx 存在
NPX=$(command -v npx)
if [ -z "$NPX" ]; then
echo "错误: 找不到 npx"
exit 1
fi
echo "正在启动 DeepSeek Harness..."
nohup "$NPX" @deepseek-ai/dsh web --no-open \
> "$LOG_FILE" 2>&1 &
# 等待服务启动
for i in {1..20}; do
if lsof -iTCP:$PORT -sTCP:LISTEN >/dev/null 2>&1; then
echo "DeepSeek Harness 启动成功"
echo "地址: http://127.0.0.1:$PORT"
echo "日志: $LOG_FILE"
exit 0
fi
sleep 0.5
done
echo "启动失败,请查看日志:"
echo "$LOG_FILE"
exit 1
;;
stop)
PIDS=$(lsof -tiTCP:$PORT -sTCP:LISTEN)
if [ -z "$PIDS" ]; then
echo "DeepSeek Harness 未运行"
exit 0
fi
echo "正在关闭 DeepSeek Harness..."
echo "$PIDS" | xargs kill 2>/dev/null
# 等待退出
for i in {1..10}; do
if ! lsof -iTCP:$PORT -sTCP:LISTEN >/dev/null 2>&1; then
echo "DeepSeek Harness 已关闭"
exit 0
fi
sleep 0.5
done
# 还没退出,强制关闭
echo "正常关闭超时,强制关闭..."
PIDS=$(lsof -tiTCP:$PORT -sTCP:LISTEN)
if [ -n "$PIDS" ]; then
echo "$PIDS" | xargs kill -9 2>/dev/null
fi
echo "DeepSeek Harness 已关闭"
;;
restart)
"$0" stop
sleep 1
"$0" start
;;
status)
if lsof -iTCP:$PORT -sTCP:LISTEN >/dev/null 2>&1; then
echo "DeepSeek Harness: 运行中"
echo "地址: http://127.0.0.1:$PORT"
echo "日志: $LOG_FILE"
else
echo "DeepSeek Harness: 未运行"
fi
;;
*)
echo "用法:"
echo " $0 start 启动"
echo " $0 stop 关闭"
echo " $0 restart 重启"
echo " $0 status 查看状态"
exit 1
;;
esac