-
Notifications
You must be signed in to change notification settings - Fork 9
/
config.py.example
246 lines (232 loc) · 8.22 KB
/
config.py.example
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
# To enable extensions, rename this file to "config.py"
# and fill in the necessary API keys and other details.
# Store API keys and other configuration details here:
# OPEN_AI_API_KEY = "YOUR_OPENAI_API_KEY_HERE"
# ANTHROPIC_API_KEY = "YOUR_ANTHROPIC_API_KEY_HERE"
# MISTRAL_API_KEY = "YOUR_MISTRAL_API_KEY_HERE"
# KAGI_SESSION_TOKEN = "YOUR_KAGI_SESSION_TOKEN_HERE"
# Used by weather extension (which currently only works for United States)
# ZIP_CODE = "YOUR_ZIP_CODE"
# Uncomment lines to enable desired extensions:
ENABLED_EXTENSIONS = [
#"chatgpt",
#"claude",
#"hackaday",
#"hacksburg",
#"hunterirving",
#"kagi",
#"mistral",
#"notyoutube",
#"npr",
#"reddit",
#"waybackmachine",
#"weather",
#"websimulator",
#"wiby",
#"wikipedia",
]
# While SIMPLIFY_HTML is True, you can use WHITELISTED_DOMAINS to disable post-processing for
# specific sites (only perform HTTPS -> HTTP conversion and character conversion (if CONVERT_CHARACTERS is True),
# without otherwise modifying the page's source code).
WHITELISTED_DOMAINS = [
#"example.com",
]
# Optionally, load a preset (.py file) from /presets, optimized for compatibility
# with a specific web browser. Enabling a preset may override one or more of the
# settings that follow below.
# The default values target compatability with the MacWeb 2.0 browser.
#PRESET = "wii_internet_channel"
# --------------------------------------------------------------------------------------
# *** One or more of the following settings may be overridden if you enable a preset ***
# --------------------------------------------------------------------------------------
# If True, parse HTML responses to strip specified tags and attributes.
# If False, always return the full, unmodified HTML as served by the requested site or extension
# (only perform HTTPS -> HTTP conversion and character conversion (if CONVERT_CHARACTERS is True),
# without otherwise modifying the page's source code).
SIMPLIFY_HTML = True
# If SIMPLIFY_HTML is True, unwrap these HTML tags during processing:
TAGS_TO_UNWRAP = [
"noscript",
]
# If SIMPLIFY_HTML is True, strip these HTML tags during processing:
TAGS_TO_STRIP = [
"script",
"link",
"style",
"source",
]
# If SIMPLIFY_HTML is True, strip these HTML attributes during processing:
ATTRIBUTES_TO_STRIP = [
"style",
"onclick",
"class",
"bgcolor",
"text",
"link",
"vlink"
]
# Process images for optimal rendering on your device/browser:
CAN_RENDER_INLINE_IMAGES = False # Mostly used to conditionally enable landing page images (ex: waybackmachine.py)
RESIZE_IMAGES = True
MAX_IMAGE_WIDTH = 512 # Only used if RESIZE_IMAGES is True
MAX_IMAGE_HEIGHT = 342 # Only used if RESIZE_IMAGES is True
CONVERT_IMAGES = True
CONVERT_IMAGES_TO_FILETYPE = "gif" # Only used if CONVERT_IMAGES is True
DITHERING_ALGORITHM = "FLOYDSTEINBERG" # Only used if CONVERT_IMAGES is True and CONVERT_IMAGES_TO_FILETYPE == "gif"
# In addition to the default web simulator prompt, add custom instructions to improve compatability with your web browser.
WEB_SIMULATOR_PROMPT_ADDENDUM = """<formatting>
IMPORTANT: The user's web browser only supports (most of) HTML 3.2 (you do not need to acknowledge this to the user, only understand it and use this knowledge to construct the HTML you respond with).
Their browser has NO CSS support and NO JavaScript support. Never include <script>, <style> or inline scripting or styling in your responses. The output html will always be rendered as black on a white background, and there's no need to try to change this.
Tags supported by the user's browser include:html, head, body, title, a, h1, h2, h3, p, ul, ol, li, div, table, tr, th, td, caption,
dl, dt, dd, kbd, samp, var, b, i, u, address, blockquote,
form, select, option, textarea,
input - inputs with type="text" and type="password" are fully supported. Inputs with type="radio", type="checkbox", type="file", and type="image" are NOT supported and should never be used. Never prepopulate forms with information. Never reveal passwords in webpages or urls.
hr - always format like <hr>, and never like <hr />, as this is not supported by the user's browser
<br> - always format like <br>, and never like <br />, as this is not supported by the user's browser
<xmp> - if presenting html code to the user, wrap it in this tag to keep it from being rendered as html
<img> - all images will render as a "broken image" in the user's browser, so use them sparingly. The dimensions of the user's browser are 512 × 342px; any included images should take this into consideration. The alt attribute is not supported, so don't include it. Instead, if a description of the img is relevant, use nearby text to describe it.
<pre> - can be used to wrap preformatted text, including ASCII art (which could represent game state, be an ASCII art text banner, etc.)
<font> - as CSS is not supported, text can be wrapped in <font> tags to set the size of text like so: <font size="7">. Sizes 1-7 are supported. Neither the face attribute nor the color attribute are supported, so do not use them. As a workaround for setting the font face, the user's web browser has configured all <h6> elements to render using the "Times New Roman" font, <h5> elements to use the "Palatino" font, and <h4> to use the "Chicago" font. By default, these elements will render at font size 1, so you may want to use <font> tags with the size attribute set to enlarge these if you use them).
<center> - as CSS is not supported, to center a group of elements, you can wrap them in the <center> tag. You can also use the "align" attribute on p, div, and table attributes to align them horizontally.
<table>s render well on the user's browser, so use them liberally to format tabular data such as posts in forum threads, messages in an inbox, etc. You can also render a table without a border to arrange information without giving the appearance of a table.
<tt> - use this tag to render text as it would appear on a fixed-width device such as a teletype (telegrams, simulated command-line interfaces, etc.)
Never use script tags or style tags.
</formatting>"""
# Conditionally enable/disable use of CONVERSION_TABLE
CONVERT_CHARACTERS = True
# Convert text characters for compatability with specific browsers
CONVERSION_TABLE = {
"¢": b"cent",
"¢": b"cent",
"€": b"EUR",
"€": b"EUR",
"¥": b"YEN",
"£": b"GBP",
"«": b"'",
"«": b"'",
"»": b"'",
"»": b"'",
"‘": b"'",
"‘": b"'",
"’": b"'",
"’": b"'",
"“": b"''",
"“": b"''",
"”": b"''",
"”": b"''",
"–": b"-",
"–": b"-",
"—": b"--",
"—": b"--",
"―": b"-",
"―": b"-",
"·": b"-",
"·": b"-",
"‚": b",",
"‚": b",",
"„": b",,",
"„": b",,",
"†": b"*",
"†": b"*",
"‡": b"**",
"‡": b"**",
"•": b"-",
"•": b"*",
"…": b"...",
"…": b"...",
"\u00A0": b" ",
" ": b" ",
"±": b"+/-",
"±": b"+/-",
"≈": b"~",
"≈": b"~",
"≠": b"!=",
"≠": b"!=",
"×": b"x",
"⁄": b"/",
"°": b"*",
"°": b"*",
"′": b"'",
"′": b"'",
"″": b"''",
"″": b"''",
"™": b"(tm)",
"™": b"(TM)",
"®": b"(R)",
"®": b"(R)",
"©": b"(c)",
"©": b"(c)",
"é": b"e",
"ø": b"o",
"Å": b"A",
"â": b"a",
"Æ": b"AE",
"æ": b"ae",
"á": b"a",
"ō": b"o",
"ó": b"o",
"ū": b"u",
"⟨": b"<",
"⟩": b">",
"←": b"<",
"›": b">",
"‹": b"<",
"←": b"<",
"→": b">",
"→": b">",
"↑": b"^",
"↑": b"^",
"↓": b"v",
"↓": b"v",
"↖": b"\\",
"↖": b"\\",
"↗": b"/",
"↗": b"/",
"↘": b"\\",
"↘": b"\\",
"↙": b"/",
"↙": b"/",
"─": b"-",
"─": b"-",
"│": b"|",
"│": b"|",
"┌": b"+",
"┌": b"+",
"┐": b"+",
"┐": b"+",
"└": b"+",
"└": b"+",
"┘": b"+",
"┘": b"+",
"├": b"+",
"├": b"+",
"┤": b"+",
"┤": b"+",
"┬": b"+",
"┬": b"+",
"┴": b"+",
"┴": b"+",
"┼": b"+",
"┼": b"+",
"█": b"#",
"█": b"#",
"▌": b"|",
"▄": b"|",
"▐": b"|",
"&rhblk;": b"|",
"▀": b"-",
"▀": b"-",
"▄": b"_",
"▄": b"_",
"▾": b"v",
"▾": b"v",
"▾": b"v",
"▾": b"v",
"♫": b"",
"♠": b"",
"\u200B": b"",
"​": b"",
"\u200C": b"",
"\u200D": b"",
"\uFEFF": b"",
}