From 911c1b9f5f74cf89952ac1c70b8d8d2dbae6fdc6 Mon Sep 17 00:00:00 2001 From: Zheng Kai Date: Mon, 21 Aug 2023 10:49:03 +0800 Subject: [PATCH] up --- misc/docker/Makefile | 3 ++- misc/docker/install.sh | 2 +- misc/test/chat.sh | 13 +++++++------ misc/test/completion.sh | 17 +++++++++-------- misc/test/models-list.sh | 5 +++-- misc/test/moderations.sh | 8 ++++---- 6 files changed, 26 insertions(+), 22 deletions(-) diff --git a/misc/docker/Makefile b/misc/docker/Makefile index 969b505..75362f7 100644 --- a/misc/docker/Makefile +++ b/misc/docker/Makefile @@ -32,8 +32,9 @@ rachel: build scp docker-orca.tar $(RACHEL_HOST):/tmp scp install.sh $(RACHEL_HOST):/tmp scp ../../server/build/env.sh $(RACHEL_HOST):/tmp + ssh $(RACHEL_HOST) "sed -i '/ES/d' /tmp/env.sh" ssh $(RACHEL_HOST) "chmod +x /tmp/install.sh && /tmp/install.sh && rm /tmp/install.sh" - ssh $(RACHEL_HOST) "rm /tmp/env.sh" + # ssh $(RACHEL_HOST) "rm /tmp/env.sh" nginx: scp ../nginx/prod.conf lamia:/etc/nginx/vhost.d/600-orca diff --git a/misc/docker/install.sh b/misc/docker/install.sh index 7800bab..dd3ab32 100644 --- a/misc/docker/install.sh +++ b/misc/docker/install.sh @@ -2,7 +2,7 @@ TARGET="Lamia" -if [ "$HOSTNAME" != "$TARGET" ]; then +if [ "$HOSTNAME" != "$TARGET" ] && [ "$HOSTNAME" != "Rachel" ]; then >&2 echo only run in server "$TARGET" exit 1 fi diff --git a/misc/test/chat.sh b/misc/test/chat.sh index 10999b2..aaeb580 100755 --- a/misc/test/chat.sh +++ b/misc/test/chat.sh @@ -3,9 +3,10 @@ BASE="${OPENAI_API_BASE:-https://api.openai.com/v1}" curl -v "${BASE}/chat/completions" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer ${OPENAI_API_KEY}" \ - -d '{ - "model": "gpt-3.5-turbo", - "messages": [{"role": "user", "content": "Hello!"}] - }' + -w "Total time: %{time_total} seconds\n" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer ${OPENAI_API_KEY}" \ + -d '{ + "model": "gpt-3.5-turbo", + "messages": [{"role": "user", "content": "Hello!"}] +}' diff --git a/misc/test/completion.sh b/misc/test/completion.sh index ea89d4c..8dd3ed0 100755 --- a/misc/test/completion.sh +++ b/misc/test/completion.sh @@ -2,11 +2,12 @@ BASE="${OPENAI_API_BASE:-https://api.openai.com/v1}" curl "${BASE}/completions" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer ${OPENAI_API_KEY}" \ - -d '{ - "model": "text-davinci-003", - "prompt": "Say this is a test", - "max_tokens": 7, - "temperature": 0 - }' + -w "Total time: %{time_total} seconds\n" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer ${OPENAI_API_KEY}" \ + -d '{ + "model": "text-davinci-003", + "prompt": "Say this is a test", + "max_tokens": 7, + "temperature": 0 +}' diff --git a/misc/test/models-list.sh b/misc/test/models-list.sh index 0b96858..dc0c66a 100755 --- a/misc/test/models-list.sh +++ b/misc/test/models-list.sh @@ -2,5 +2,6 @@ OPENAI_API_KEY="sk-rhjeVT1fkcuarBKnQR6ST$(cat ~/.config/openai)" -curl https://api.openai.com/v1/models \ - -H "Authorization: Bearer ${OPENAI_API_KEY}" +curl -s https://api.openai.com/v1/models \ + -H "Authorization: Bearer ${OPENAI_API_KEY}" \ + | jq . - diff --git a/misc/test/moderations.sh b/misc/test/moderations.sh index 76633e8..df70423 100755 --- a/misc/test/moderations.sh +++ b/misc/test/moderations.sh @@ -3,7 +3,7 @@ BASE="${OPENAI_API_BASE:-https://api.openai.com/v1}" curl -v "${BASE}/moderations" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer ${OPENAI_API_KEY}" \ - -d '{"input": "你媽逼啊"}' \ - | jq . - + -w "Total time: %{time_total} seconds\n" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer ${OPENAI_API_KEY}" \ + -d '{"input": "你媽逼啊"}'