73 lines
2.4 KiB
Bash
Executable File
73 lines
2.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
echo "Testing v1 warmup endpoint..."
|
|
echo "======================================="
|
|
|
|
# Test v1 warmup endpoint
|
|
curl --request POST \
|
|
--url http://localhost:8001/api/v1/chat/warmup \
|
|
--header 'authorization: Bearer your-api-key-here' \
|
|
--header 'content-type: application/json' \
|
|
--data '{
|
|
"bot_id": "test-bot-001",
|
|
"model": "gpt-4",
|
|
"messages": [{"role": "user", "content": "This message will be ignored"}],
|
|
"dataset_ids": ["project-123"],
|
|
"robot_type": "catalog_agent"
|
|
}'
|
|
|
|
echo -e "\n\nTesting v2 warmup endpoint..."
|
|
echo "======================================="
|
|
|
|
# Test v2 warmup endpoint (using same auth as chat_completions_v2)
|
|
curl --request POST \
|
|
--url http://localhost:8001/api/v2/chat/warmup \
|
|
--header 'authorization: Bearer a21c99620a8ef61d69563afe05ccce89' \
|
|
--header 'content-type: application/json' \
|
|
--data '{
|
|
"bot_id": "63069654-7750-409d-9a58-a0960d899a20",
|
|
"messages": [{"role": "user", "content": "This message will be ignored"}],
|
|
"stream": false,
|
|
"language": "ja",
|
|
"tool_response": true,
|
|
"user_identifier": "test-user"
|
|
}'
|
|
|
|
echo -e "\n\nNow testing actual chat endpoints to see if they use cached agents..."
|
|
echo "==============================================================="
|
|
|
|
echo "Testing v1 chat completions (should be faster after warmup)..."
|
|
curl --request POST \
|
|
--url http://localhost:8001/api/v1/chat/completions \
|
|
--header 'authorization: Bearer your-api-key-here' \
|
|
--header 'content-type: application/json' \
|
|
--data '{
|
|
"bot_id": "test-bot-001",
|
|
"model": "gpt-4",
|
|
"messages": [{"role": "user", "content": "Hello, how are you?"}],
|
|
"dataset_ids": ["project-123"],
|
|
"robot_type": "catalog_agent",
|
|
"stream": false
|
|
}' | jq -r '.choices[0].message.content' | head -c 100
|
|
|
|
echo -e "\n\nTesting v2 chat completions (should be faster after warmup)..."
|
|
curl --request POST \
|
|
--url http://localhost:8001/api/v2/chat/completions \
|
|
--header 'authorization: Bearer a21c99620a8ef61d69563afe05ccce89' \
|
|
--header 'content-type: application/json' \
|
|
--data '{
|
|
"messages": [
|
|
{
|
|
"role": "user",
|
|
"content": "咖啡多少钱一杯"
|
|
}
|
|
],
|
|
"stream": false,
|
|
"model": "whatever",
|
|
"language": "ja",
|
|
"bot_id": "63069654-7750-409d-9a58-a0960d899a20",
|
|
"tool_response": false,
|
|
"user_identifier": "及川"
|
|
}' | jq -r '.choices[0].message.content' | head -c 100
|
|
|
|
echo -e "\n\nDone!" |