Skip to content

Commit 650dfe8

Browse files
committed
Add doc
1 parent 345e472 commit 650dfe8

File tree

3 files changed

+79
-2
lines changed

3 files changed

+79
-2
lines changed

README.md

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,79 @@
66
77
[![CI](https://github.com/emacs-openai/chatgpt/actions/workflows/test.yml/badge.svg)](https://github.com/emacs-openai/chatgpt/actions/workflows/test.yml)
88

9+
This Emacs Code extension allows you to use the official OpenAI API to generate
10+
code or natural language responses from OpenAI's [ChatGPT](https://openai.com/blog/chatgpt)
11+
to your questions, right within the editor.
12+
13+
*P.S. This plugin focuses on experience with making conversations with ChatGPT!*
14+
15+
<p align="center">
16+
<img alt="explain" src="./etc/demo.gif"/>
17+
</p>
18+
19+
## 💾 Installation
20+
21+
#### package.el
22+
23+
This package is available from [JCS-ELPA](https://jcs-emacs.github.io/jcs-elpa/).
24+
Install from these repositories then you should be good to go!
25+
26+
Normally, you don't need to add `(require 'chatgpt)` to your configuration since
27+
most `'chatgpt` commands are autoload and can be called without loading the module!
28+
29+
#### use-package
30+
31+
If you are using [use-package](https://www.emacswiki.org/emacs/UsePackage),
32+
add the following to your `init.el` file:
33+
34+
```elisp
35+
(use-package 'chatgpt :ensure t)
36+
```
37+
38+
or with `straight.el`:
39+
40+
```elisp
41+
(use-package 'chatgpt
42+
:straight ('chatgpt :type git :host github :repo "emacs-openai/'chatgpt"))
43+
```
44+
45+
#### Manual installation
46+
47+
Copy all `.el` files in this repository to `~/.emacs.d/lisp` and add the following:
48+
49+
```elisp
50+
(add-to-list 'load-path "~/.emacs.d/lisp/")
51+
(require 'chatgpt)
52+
```
53+
54+
## 🔑 Obtaining API key
55+
56+
To use this extension, you will need an API key from OpenAI. To obtain one,
57+
follow these steps:
58+
59+
1. Go to [OpenAI's website](https://beta.openai.com/account/api-keys). If you
60+
don't have an account, you will need to create one or sign up using your Google
61+
or Microsoft account.
62+
2. Click on the `Create new secret key` button.
63+
3. Copy the key and paste into the 'API Key' field under the 'openai' custom group settings.
64+
65+
When you create a new account, you receive $18 in free credits for the API which
66+
you must use in the first 90 days. You can see pricing information
67+
[here](https://openai.com/api/pricing/). 1000 tokens are about 700 words, and
68+
you can see the token count for each request at the end of the response in the
69+
sidebar.
70+
971
## 🔨 Usage
1072

11-
WIP
73+
To start this package:
74+
75+
```
76+
M-x chatgpt
77+
```
78+
79+
You will then be asked to insert your response; in this window, you press
80+
<kbd>return</kbd> to send the message, and <kbd>Shift</kbd>+<kbd>return</kbd>
81+
to insert a newline like a normal browser!
1282

1383
## 📝 Customization
1484

@@ -18,6 +88,8 @@ WIP
1888
- `chatgpt-max-tokens` - The maximum number of tokens to generate in the completion.
1989
- `chatgpt-temperature` - What sampling temperature to use.
2090
- `chatgpt-input-method` - Method to receive input.
91+
- `chatgpt-spinner-type` - Type of the spinner.
92+
- `chatgpt-display-tokens-info` - Non-nil we display tokens information for each request.
2193

2294
## 🔗 References
2395

chatgpt.el

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
:group 'openai)
8080

8181
(defcustom chatgpt-display-tokens-info t
82-
"Non-nil we display tokens infomration for each request."
82+
"Non-nil we display tokens information for each request."
8383
:type 'boolean
8484
:group 'chatgpt)
8585

@@ -130,6 +130,11 @@
130130
"Face added to codemetrics display."
131131
:group 'chatgpt)
132132

133+
;;
134+
;;; Externals
135+
136+
(declare-function shr-string-pixel-width "ext:shr.el")
137+
133138
;;
134139
;;; Util
135140

etc/demo.gif

600 KB
Loading

0 commit comments

Comments
 (0)