From 6dbca2cd9caa5dd19a71cf03cf13bddb31e6da75 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Fri, 24 Mar 2023 10:07:17 +0800 Subject: Update --- bin/gpt/gpt | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'bin/gpt') diff --git a/bin/gpt/gpt b/bin/gpt/gpt index 34f7635..d33e382 100755 --- a/bin/gpt/gpt +++ b/bin/gpt/gpt @@ -4,6 +4,7 @@ # - Use suggested block to wrap data: # https://help.openai.com/en/articles/6654000-best-practices-for-prompt-engineering-with-openai-api # - Cowork with https://github.com/openai/chatgpt-retrieval-plugin +# - History for prompt # Necessary commands stacks=( curl jq ) @@ -229,20 +230,18 @@ EOF # API call # Save original response into cache file # And only print content of message - response="$( - curl https://api.openai.com/$ROUTE \ - --silent \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $OPENAI_API_KEY" \ - -d "$body" | \ - jq . | tee -a "$cache" | \ - jq -r .choices[0].message.content - )" + curl https://api.openai.com/$ROUTE \ + --silent \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d "$body" | \ + jq . | tee -a "$cache" | \ + jq -r .choices[0].message.content echo -e "${response}\n\n======\n" # Append newest message into session assistant_message="$(cat <