Skip to content

Commit

Permalink
fix(readme): some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
waylaidwanderer committed Feb 6, 2023
1 parent 188565a commit 6f89900
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ console.log(response3.response); // Les chats sont les meilleurs animaux de comp
### API Server

<h4 id="api-server-setup">Setup</h4>

You can install the package using
```bash
npm i -g @waylaidwanderer/chatgpt-api
Expand Down Expand Up @@ -176,7 +177,7 @@ To start a conversation with ChatGPT, send a POST request to the server's `/conv
}
```
The server will return a JSON object containing ChatGPT's response:
```JSON
```JS
// HTTP/1.1 200 OK
{
"response": "I'm doing well, thank you! How are you?",
Expand All @@ -188,14 +189,14 @@ The server will return a JSON object containing ChatGPT's response:
If the request is unsuccessful, the server will return a JSON object with an error message.

If the request object is missing a required property (e.g. `message`):
```JSON
```JS
// HTTP/1.1 400 Bad Request
{
"error": "The message parameter is required."
}
```
If there was an error sending the message to ChatGPT:
```JSON
```JS
// HTTP/1.1 503 Service Unavailable
{
"error": "There was an error communicating with ChatGPT."
Expand Down Expand Up @@ -227,7 +228,7 @@ Successful output:
{ data: ' today', event: '', id: '', retry: undefined }
{ data: '?', event: '', id: '', retry: undefined }
{ data: '[DONE]', event: '', id: '', retry: undefined }
Hello! How can I help you today?
// Hello! How can I help you today?
```

Error output:
Expand Down

0 comments on commit 6f89900

Please sign in to comment.