Commit 35d6a54a by wangzhiyang Committed by 胡悦

chore(send_test1.sh): 清理冗余代码并更新测试脚本

修正shebang为更通用的格式,移除DOS换行处理代码,更新使用说明,新增反引号使用提示,移除无用的变量替换逻辑,优化代码缩进与注释
1 parent bc6a112f
#!/bin/bash
#!/usr/bin/env bash
# 模拟用户消息发送到 Agent 服务
# 用法: ./send_test.sh "你的问题"
# 例如: ./send_test.sh "帮我整理上周的会议纪要"
if grep -q $'\r' "$0" 2>/dev/null; then
if command -v mktemp >/dev/null 2>&1; then
_tmp="$(mktemp)"
else
_tmp="/tmp/send_test.$$.sh"
fi
tr -d '\r' < "$0" > "$_tmp" && chmod +x "$_tmp" && exec bash "$_tmp" "$@"
fi
# 用法: ./send_test1.sh "你的问题"
# 例如: ./send_test1.sh "帮我整理上周的会议纪要"
#
# 注意:不要用反引号包 URL(例如 `https://...`),反引号在 bash 中会触发命令替换。
# 如果你一定要保留反引号,请用单引号包住整个参数:bash ./send_test1.sh '... `https://...` ...'
QUERY="${1:-你好,请问你能帮我什么?}"
QUERY="${QUERY//\`/}"
API_URL="${API_URL:-http://localhost:8000/api/v1/chat/completions}"
SESSION_ID="${SESSION_ID:-test_sess_001}"
POSITION_CODE="${POSITION_CODE:-conference_assistant}"
......@@ -136,10 +129,9 @@ echo "POST ${API_URL}"
echo ""
HTTP_CODE=$(printf '%s' "${PAYLOAD}" | curl -s -w "\n%{http_code}" -X POST "${API_URL}" \
-H "Content-Type: application/json; charset=utf-8" \
--data-binary @-)
-H "Content-Type: application/json; charset=utf-8" \
--data-binary @-)
# 分离 body 和 status code
BODY=$(echo "${HTTP_CODE}" | sed '$d')
STATUS=$(echo "${HTTP_CODE}" | tail -n1)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!