Skip to content

Commit 29f5cb0

Browse files
committed
Initial commit
0 parents  commit 29f5cb0

20 files changed

+1251
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Hans Scharler
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# code-assistant
2+
Simple web app to help you code with AI. A custom mode allows you to make customizations. The app requires an OpenAI API Key.

favicon.ico

14.7 KB
Binary file not shown.

images/android-chrome-192x192.png

1.82 KB
Loading

images/android-chrome-512x512.png

8.85 KB
Loading

images/apple-touch-icon.png

1.78 KB
Loading

images/favicon-16x16.png

577 Bytes
Loading

images/favicon-32x32.png

694 Bytes
Loading

images/safari-pinned-tab.svg

+24
Loading

index.html

+205
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>AI Assistant</title>
8+
9+
<link rel="apple-touch-icon" sizes="180x180" href="images/apple-touch-icon.png" />
10+
<link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png" />
11+
<link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png" />
12+
<link rel="mask-icon" href="images/safari-pinned-tab.svg" color="#5bbad5" />
13+
14+
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
15+
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous" />
16+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css" />
17+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css"
18+
integrity="sha384-vKruj+a13U8yHIkAyGgK1J3ArTLzrFGBbBc0tDp4ad/EyewESeXE/Iv67Aj8gKZ0" crossorigin="anonymous" />
19+
<link href="styles/prism.css?v0.1.1" rel="stylesheet" />
20+
<link href="styles/prism-custom.css?v0.1.1" rel="stylesheet" />
21+
<link href="styles/styles.css?v0.1.1" rel="stylesheet" />
22+
<link href="styles/thinking.css?v0.1.1" rel="stylesheet" />
23+
</head>
24+
25+
<body class="d-flex flex-column min-vh-100">
26+
<header class="bg-primary py-2">
27+
<div class="container-fluid">
28+
<div class="d-flex justify-content-between align-items-center">
29+
<h1 class="text-white mb-0">
30+
<i class="bi bi-terminal"></i> <span id="app_name">AI</span>
31+
<span class="d-none d-sm-inline">Assistant</span>
32+
</h1>
33+
<div>
34+
<div class="btn-group">
35+
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown"
36+
aria-expanded="false">
37+
<span class="d-none d-sm-inline"><i class="bi bi-gear-fill"></i></span>
38+
<span class="current-mode">Default</span>
39+
</button>
40+
<ul class="dropdown-menu" id="app_modes">
41+
<li>
42+
<a class="dropdown-item" href="#" data-mode="Default">Default</a>
43+
</li>
44+
<li>
45+
<a class="dropdown-item" href="#" data-mode="Math">Math</a>
46+
</li>
47+
<li>
48+
<a class="dropdown-item" href="#" data-mode="Flashcard">Flashcard</a>
49+
</li>
50+
<li>
51+
<a class="dropdown-item" href="#" data-mode="Custom">Custom</a>
52+
</li>
53+
</ul>
54+
</div>
55+
<button type="button" class="btn btn-light btn-sm me-2 d-none" id="custom_button"
56+
data-bs-toggle="modal" data-bs-target="#customPromptModal">
57+
<i class="bi bi-pencil-square"></i>
58+
<span class="d-none d-sm-inline">Custom</span>
59+
</button>
60+
<button class="btn btn-light btn-sm me-2" onclick="download_running_session()">
61+
<i class="bi bi-download"></i>
62+
<span class="d-none d-sm-inline">Download</span>
63+
</button>
64+
</div>
65+
</div>
66+
</div>
67+
</header>
68+
69+
<main class="scrollable-area" id="scrollableArea">
70+
<div class="container">
71+
<div class="row" id="responseArea"></div>
72+
<div class="is-thinking mx-auto my-2 d-none" id="renderingArea">
73+
<div class="thinking-dot-1"></div>
74+
<div class="thinking-dot-2"></div>
75+
<div class="thinking-dot-3"></div>
76+
<div class="thinking-dot-4"></div>
77+
<div class="thinking-dot-5"></div>
78+
</div>
79+
</div>
80+
</main>
81+
82+
<footer class="footer bg-secondary mt-auto py-3">
83+
<div class="container">
84+
<div class="row">
85+
<div class="col-12 d-flex">
86+
<button class="btn btn-primary" id="random_prompt_button" type="button"
87+
onclick="openai_completions(random_user_prompt())">
88+
<i class="bi bi-shuffle"></i>
89+
</button>
90+
<input type="text" class="form-control mx-2" id="user_prompt_field" value="" />
91+
<button class="btn btn-primary" type="button" id="user_prompt_button"
92+
onclick="openai_completions()">
93+
<i class="bi bi-chat-square-fill"></i>
94+
</button>
95+
</div>
96+
</div>
97+
<div class="row mt-2">
98+
<div class="col-12 text-center">
99+
<p class="small text-muted">
100+
<i class="bi bi-stars"></i> Surprises are possible.
101+
<i class="bi bi-github"></i> <a href="https://nothans.com" target="_blank"
102+
class="text-muted">NotHans</a>
103+
<i class="bi bi-x-circle"></i> <a href="" onclick="clear_cache()" class="text-muted"> Clear
104+
cache</a>.
105+
</p>
106+
</div>
107+
</div>
108+
</div>
109+
</footer>
110+
111+
<div class="modal fade" id="customPromptModal" tabindex="-1">
112+
<div class="modal-dialog modal-lg">
113+
<div class="modal-content">
114+
<div class="modal-header">
115+
<h5 class="modal-title">Edit Custom Prompt Settings <button type="button"
116+
class="btn btn-success ms-auto" id="save_changes">
117+
<i class="bi bi-save"></i> Save
118+
</button></h5>
119+
<button type="button" class="btn btn-close" data-bs-dismiss="modal"></button>
120+
121+
</div>
122+
<div class="modal-body">
123+
<form id="editForm">
124+
<div class="mb-3">
125+
<label for="system_prompt" class="form-label">
126+
<h6>System Prompt</h6>
127+
</label>
128+
<textarea class="form-control" id="system_prompt" name="system_prompt" rows="3"></textarea>
129+
</div>
130+
<div class="row">
131+
<div class="col-md-6">
132+
<div class="mb-3">
133+
<label for="default_assistant_message" class="form-label">
134+
<h6>Default Assistant Message</h6>
135+
</label>
136+
<input type="text" class="form-control" id="default_assistant_message"
137+
name="default_assistant_message" />
138+
</div>
139+
<div class="mb-3">
140+
<label for="default_prompt" class="form-label">
141+
<h6>Default User Prompt</h6>
142+
</label>
143+
<input type="text" class="form-control" id="default_prompt" name="default_prompt" />
144+
</div>
145+
<div class="mb-3">
146+
<label for="user_prompt_format" class="form-label">
147+
<h6>User Prompt Format</h6>
148+
</label>
149+
<input type="text" class="form-control" id="user_prompt_format"
150+
name="user_prompt_format" />
151+
</div>
152+
<div class="mb-3">
153+
<label for="temperature" class="form-label">
154+
<h6>Temperature</h6>
155+
</label>
156+
<input type="number" step="0.1" class="form-control" id="temperature"
157+
name="temperature" min="0" max="1" />
158+
</div>
159+
<div class="mb-3">
160+
<label for="model" class="form-label">
161+
<h6>Model</h6>
162+
</label>
163+
<select class="form-select" id="model" name="model">
164+
<option value="gpt-4o-mini" selected>gpt-4o-mini</option>
165+
<option value="gpt-4o">gpt-4o</option>
166+
<option value="gpt-3.5-turbo">gpt-3.5-turbo</option>
167+
</select>
168+
</div>
169+
</div>
170+
<div class="col-md-6">
171+
<div class="mb-3">
172+
<label class="form-label">
173+
<h6>User Prompts</h6>
174+
</label>
175+
<div id="user_prompts_container"></div>
176+
<button type="button" class="btn btn-primary btn-sm mt-2" id="add_prompt">
177+
Add User Prompt
178+
</button>
179+
</div>
180+
</div>
181+
</div>
182+
</form>
183+
</div>
184+
</div>
185+
</div>
186+
</div>
187+
188+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
189+
integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe"
190+
crossorigin="anonymous"></script>
191+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js"
192+
integrity="sha384-PwRUT/YqbnEjkZO0zZxNqcxACrXe+j766U2amXcgMg5457rve2Y7I6ZJSm2A0mS4"
193+
crossorigin="anonymous"></script>
194+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js"
195+
integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05"
196+
crossorigin="anonymous"></script>
197+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/showdown.min.js"></script>
198+
<script src="scripts/prism.js?v0.1.5"></script>
199+
<script src="scripts/prism-buttons.js?v0.1.5"></script>
200+
<script src="scripts/app.js?v0.1.5"></script>
201+
<script src="scripts/prompt-settings.js?v0.1.5"></script>
202+
<script src="scripts/openai-api.js?v0.1.5"></script>
203+
</body>
204+
205+
</html>

0 commit comments

Comments
 (0)