mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-04 08:25:26 +08:00
Merge pull request #206 from CJackHwang/codex/fix-issues-from-pull-request-review
tests: generate JSON request body in capture-raw-stream-sample.sh and use --data-binary
This commit is contained in:
@@ -47,11 +47,23 @@ for _ in $(seq 1 120); do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
REQUEST_BODY="$(python3 - <<'PY' "$MODEL" "$QUESTION"
|
||||
import json,sys
|
||||
model,question=sys.argv[1:3]
|
||||
payload={
|
||||
'model':model,
|
||||
'stream':True,
|
||||
'messages':[{'role':'user','content':question}],
|
||||
}
|
||||
print(json.dumps(payload, ensure_ascii=False))
|
||||
PY
|
||||
)"
|
||||
|
||||
curl -sS http://127.0.0.1:5001/v1/chat/completions \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H "Authorization: Bearer ${API_KEY}" \
|
||||
-d "{\"model\":\"${MODEL}\",\"stream\":true,\"messages\":[{\"role\":\"user\",\"content\":\"${QUESTION}\"}]}" \
|
||||
>"${OUT_DIR}/openai.stream.sse" || true
|
||||
--data-binary "${REQUEST_BODY}" \
|
||||
>"${OUT_DIR}/openai.stream.sse"
|
||||
|
||||
curl -sS http://127.0.0.1:5001/admin/dev/captures \
|
||||
-H "Authorization: Bearer ${ADMIN_KEY}" \
|
||||
|
||||
Reference in New Issue
Block a user