-
Notifications
You must be signed in to change notification settings - Fork 6
/
package.yml
247 lines (219 loc) · 7.17 KB
/
package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
## Espanso specifications
global_vars:
- name: "SCRIPT_PATH"
type: "echo"
params:
echo: "\"$CONFIG/match/packages/openai/openai_chatgpt.py\""
- name: "PYTHON_ENV"
type: "shell"
params:
cmd: "echo ~/.virtualenvs/openai/bin/python3"
matches:
## Utility triggers
- trigger: ";test-setup"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: "{{PYTHON_ENV}} {{SCRIPT_PATH}} -h"
- trigger: ";clear-db"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: 'rm ~/openai_chatgpt/chats.db'
- trigger: ";clear-clip"
replace: "{{output}}"
vars:
- name: message
type: echo
params:
echo: "'Clipboard contents cleared'"
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} -c "import pyperclip; pyperclip.copy({{message}})"; echo "Clipboard content were cleared."'
## Clipboard triggers
- trigger: ";ask"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "Answer this please" --system-role "A helpful assistant"'
- trigger: ";debug"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "Debug this code" --system-role "A helpful and wise programmer"'
- trigger: ";respond"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "Write a response to the following" --system-role "A helpful assistant"'
- trigger: ";code"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "Write a code with docs and example for the following" --system-role "A wise and helpful programmer"'
- trigger: ";snippet"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "Return only the code without explanation (but include code docs) for the following" --system-role "A helpful programmer"'
- trigger: ";previous-explain"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "Explain the previous response in detail with examples" --system-role "A helpful assistant" --disallow-clipboard'
- trigger: ";explain"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "Explain in detail" --system-role "A helpful assistant"'
- trigger: ";eli5"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "Explain like I am 5" --system-role "A helpful assistant"'
- trigger: ";summarize"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "Summarize" --system-role "A helpful assistant"'
- trigger: ";write"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "Write an article on" --system-role "A helpful assistant"'
- trigger: ";usage"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "Generate a usage doc in markdown format" --system-role "A helpful assistant"'
- trigger: ";grade"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "Grade the following part of an essay on writing skills and suggest improvements" --system-role "A helpful assistant"'
- trigger: ";rephrase"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "Rephrase the following" --system-role "A helpful assistant"'
- trigger: ";correct"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "Correct grammatical errors in the following" --system-role "A helpful assistant"'
# Lower temperature (0.2) used for fact checking.
- trigger: ";fact-check"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "Check this fact" --system-role "A helpful assistant" --temperature 0.2'
# Temperature (2.0) used for generating funny messages.
- trigger: ";make-funny"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "Make this funny" --system-role "A funny poet" --temperature 2.0'
- trigger: ";rhyme"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "Make it rhyme" --system-role "A funny poet"'
# Regex based query
# Low char limit because of Espanso's 30 character limit on regex.
- regex: ";q/(?P<query>.*)//"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "{{query}}" --system-role "A helpful assistant" --disallow-clipboard'
# Form based query
- trigger: ";form"
replace: "{{output}}"
vars:
- name: "query_form"
type: form
params:
layout: |
Prompt:
[[prompt]]
This will be sent to chatGPT.
fields:
prompt:
multiline: true
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "{{query_form.prompt}}" --system-role "A helpful assistant" --disallow-clipboard'
- trigger: ";clip-form"
replace: "{{output}}"
vars:
- name: "query_form"
type: form
params:
layout: |
Prompt:
[[prompt]]
This will be sent to chatGPT.
fields:
prompt:
multiline: true
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --clipboard-action "{{query_form.prompt}}" --system-role "A helpful assistant"'
# Sound based query
- trigger: ";talk"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --record --record-duration 10 --disallow-clipboard'
# Sound based query
- trigger: ";clip-talk"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: '{{PYTHON_ENV}} {{SCRIPT_PATH}} --record --record-duration 10'