Andrchest commited on
Commit
0a008db
·
1 Parent(s): aab0e20

change app 5

Browse files
.idea/inspectionProfiles/Project_Default.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
5
+ <option name="ignoredPackages">
6
+ <value>
7
+ <list size="2">
8
+ <item index="0" class="java.lang.String" itemvalue="networkx" />
9
+ <item index="1" class="java.lang.String" itemvalue="numpy" />
10
+ </list>
11
+ </value>
12
+ </option>
13
+ </inspection_tool>
14
+ </profile>
15
+ </component>
.idea/inspectionProfiles/profiles_settings.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
.idea/misc.xml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Black">
4
+ <option name="sdkName" value="Python 3.10 (test) (2)" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (test) (2)" project-jdk-type="Python SDK" />
7
+ </project>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/test.iml" filepath="$PROJECT_DIR$/.idea/test.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/test.iml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/.venv" />
6
+ </content>
7
+ <orderEntry type="jdk" jdkName="Python 3.10 (test) (2)" jdkType="Python SDK" />
8
+ <orderEntry type="sourceFolder" forTests="false" />
9
+ </component>
10
+ </module>
.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
templates/base.html ADDED
@@ -0,0 +1,284 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>RAG System Interface</title>
7
+ <style>
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ box-sizing: border-box;
12
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
13
+ }
14
+
15
+ body {
16
+ display: flex;
17
+ height: 100vh;
18
+ background-color: #111827;
19
+ }
20
+
21
+ .sidebar {
22
+ width: 260px;
23
+ background-color: #1F2937;
24
+ padding: 20px;
25
+ overflow-y: auto;
26
+ }
27
+
28
+ .new-chat-btn {
29
+ display: flex;
30
+ align-items: center;
31
+ gap: 8px;
32
+ padding: 10px 15px;
33
+ border-radius: 8px;
34
+ background-color: #34D399;
35
+ cursor: pointer;
36
+ margin-bottom: 20px;
37
+ font-size: 14px;
38
+ color: #333;
39
+ }
40
+
41
+ .new-chat-btn:hover {
42
+ background-color: #90e2c4;
43
+ }
44
+
45
+ .time-section {
46
+ margin-bottom: 20px;
47
+ }
48
+
49
+ .time-header {
50
+ font-size: 12px;
51
+ color: #666;
52
+ margin-bottom: 10px;
53
+ font-weight: 500;
54
+ }
55
+
56
+ .chat-item {
57
+ padding: 8px 10px;
58
+ border-radius: 6px;
59
+ margin-bottom: 5px;
60
+ color: #eee;
61
+ cursor: pointer;
62
+ font-size: 14px;
63
+ white-space: nowrap;
64
+ overflow: hidden;
65
+ text-overflow: ellipsis;
66
+ border-width: 1px;
67
+ border-color: #bec0c4;
68
+ }
69
+
70
+ .chat-item:hover {
71
+ background-color: #242e3d;
72
+ }
73
+
74
+ .chat-item-selected {
75
+ padding: 8px 10px;
76
+ border-radius: 6px;
77
+ margin-bottom: 5px;
78
+ color: #111827; /* Dark text for better contrast on light green */
79
+ background-color: #34D399; /* Your signature green color */
80
+ cursor: pointer;
81
+ font-size: 14px;
82
+ white-space: nowrap;
83
+ overflow: hidden;
84
+ text-overflow: ellipsis;
85
+ border: 1px solid #2BB389; /* Slightly darker green border */
86
+ font-weight: 500; /* Slightly bolder text like your user messages */
87
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */
88
+ }
89
+
90
+ /* .main-content {
91
+ flex: 1;
92
+ display: flex;
93
+ flex-direction: column;
94
+ } */
95
+
96
+ .chat-container {
97
+ flex: 1;
98
+ padding: 30px;
99
+ overflow-y: auto;
100
+ display: flex;
101
+ flex-direction: column;
102
+ gap: 15px; /* This controls the space between messages */
103
+ }
104
+
105
+ .message {
106
+ max-width: 1000px;
107
+ width: 100%;
108
+ margin: 0 auto;
109
+ }
110
+
111
+ .user-message {
112
+ background-color: #34D399;
113
+ color: #000;
114
+ padding: 12px 16px;
115
+ border-radius: 12px;
116
+ font-weight: 500;
117
+ display: inline-block;
118
+ max-width: 80%;
119
+ float: right;
120
+ clear: both;
121
+ margin-bottom: 5px;
122
+ }
123
+
124
+ .bot-message {
125
+ background-color: #44444C;
126
+ color: white;
127
+ padding: 16px;
128
+ border-radius: 12px;
129
+ line-height: 1.6;
130
+ max-width: 80%;
131
+ float: left;
132
+ clear: both;
133
+ }
134
+
135
+ .bot-message h1 {
136
+ font-size: 24px;
137
+ margin-bottom: 15px;
138
+ }
139
+
140
+ .sources {
141
+ font-size: 13px;
142
+ color: #666;
143
+ margin-top: 20px;
144
+ padding-top: 15px;
145
+ border-top: 1px solid #eee;
146
+ }
147
+
148
+ .database-info {
149
+ text-align: center;
150
+ font-size: 13px;
151
+ color: #999;
152
+ margin: 20px 0;
153
+ }
154
+
155
+ .link {
156
+ color: rgb(62, 62, 206)
157
+ }
158
+ .plain-text {
159
+ color: white;
160
+ }
161
+
162
+ .input-container {
163
+ padding: 16px;
164
+ background-color: #111827;
165
+ border-top: 1px solid #2d3748;
166
+ }
167
+
168
+ .input-box {
169
+ max-width: 800px;
170
+ margin: 0 auto;
171
+ position: relative;
172
+ display: flex;
173
+ align-items: center;
174
+ }
175
+
176
+ input[type="text"] {
177
+ width: 100%;
178
+ padding: 12px 48px 12px 16px;
179
+ border: 1px solid #4b5563;
180
+ border-radius: 12px;
181
+ font-size: 15px;
182
+ outline: none;
183
+ background-color: #1f2937;
184
+ color: white;
185
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
186
+ transition: all 0.2s ease;
187
+ }
188
+
189
+ input[type="text"]:focus {
190
+ border-color: #6b7280;
191
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
192
+ }
193
+
194
+ .send-button {
195
+ position: absolute;
196
+ right: 12px;
197
+ background: none;
198
+ border: none;
199
+ color: #9ca3af;
200
+ cursor: pointer;
201
+ padding: 4px;
202
+ border-radius: 6px;
203
+ transition: all 0.2s ease;
204
+ }
205
+
206
+ .send-button:hover {
207
+ color: #d1d5db;
208
+ background-color: rgba(255, 255, 255, 0.05);
209
+ }
210
+
211
+ .send-button svg {
212
+ display: block;
213
+ }
214
+
215
+ .info-code {
216
+ position: absolute;
217
+ right: 15px;
218
+ bottom: -25px;
219
+ font-size: 12px;
220
+ color: #999;
221
+ }
222
+ .main-content {
223
+ flex: 1;
224
+ display: flex;
225
+ flex-direction: column;
226
+ justify-content: center; /* Add this for vertical centering */
227
+ align-items: center; /* Add this for horizontal centering */
228
+ padding: 20px; /* Optional: adds some spacing */
229
+ }
230
+
231
+ .rag-container {
232
+ text-align: center;
233
+ max-width: 600px;
234
+ width: 90%;
235
+ margin: 0 auto; /* Ensures horizontal centering */
236
+ }
237
+
238
+ .rag-title {
239
+ font-size: 2.5rem;
240
+ font-weight: 800;
241
+ margin-bottom: 0.5rem;
242
+ color: white; /* Changed to white for visibility on dark bg */
243
+ }
244
+
245
+ .rag-subtitle {
246
+ font-size: 1.1rem;
247
+ color: #9ca3af; /* Lighter color for better contrast */
248
+ margin-bottom: 2rem;
249
+ font-weight: 400;
250
+ }
251
+ </style>
252
+ </head>
253
+ <body>
254
+ <div class="sidebar">
255
+ <button class="new-chat-btn" onclick="location.href='/'">
256
+ <span>Add new chat</span>
257
+ </button>
258
+
259
+ <div class="time-section">
260
+ <div class="time-header">TODAY</div>
261
+ <div class="chat-item" onclick="location.href='/chat_example'">Explanation of RAG system</div>
262
+ <div class="chat-item" onclick="location.href='/chat_example'">IEEE citation format guidell...</div>
263
+ </div>
264
+
265
+ <div class="time-section">
266
+ <div class="time-header">LAST WEEK</div>
267
+ <div class="chat-item" onclick="location.href='/chat_example'">System test: explanation of...</div>
268
+ </div>
269
+
270
+ <div class="time-section">
271
+ <div class="time-header">LAST MONTH</div>
272
+ <div class="chat-item" onclick="location.href='/chat_example'">How rich is Elon Musk?</div>
273
+ <div class="chat-item" onclick="location.href='/chat_example'">Tesla: main pros and cons t...</div>
274
+ </div>
275
+ </div>
276
+
277
+ <div class="main-content">
278
+ <div class="rag-container">
279
+ <h1 class="rag-title">The Ultimate RAG</h1>
280
+ <p class="rag-subtitle">ask anything...</p>
281
+ </div>
282
+ </div>
283
+ </body>
284
+ </html>
templates/index.html ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>RAG System Interface</title>
7
+ <style>
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ box-sizing: border-box;
12
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
13
+ }
14
+
15
+ body {
16
+ display: flex;
17
+ height: 100vh;
18
+ background-color: #111827;
19
+ }
20
+
21
+ .sidebar {
22
+ width: 260px;
23
+ background-color: #1F2937;
24
+ padding: 20px;
25
+ overflow-y: auto;
26
+ }
27
+
28
+ .new-chat-btn {
29
+ display: flex;
30
+ align-items: center;
31
+ gap: 8px;
32
+ padding: 10px 15px;
33
+ border-radius: 8px;
34
+ background-color: #34D399;
35
+ cursor: pointer;
36
+ margin-bottom: 20px;
37
+ font-size: 14px;
38
+ color: #333;
39
+ }
40
+
41
+ .new-chat-btn:hover {
42
+ background-color: #90e2c4;
43
+ }
44
+
45
+ .time-section {
46
+ margin-bottom: 20px;
47
+ }
48
+
49
+ .time-header {
50
+ font-size: 12px;
51
+ color: #666;
52
+ margin-bottom: 10px;
53
+ font-weight: 500;
54
+ }
55
+
56
+ .chat-item {
57
+ padding: 8px 10px;
58
+ border-radius: 6px;
59
+ margin-bottom: 5px;
60
+ color: #eee;
61
+ cursor: pointer;
62
+ font-size: 14px;
63
+ white-space: nowrap;
64
+ overflow: hidden;
65
+ text-overflow: ellipsis;
66
+ border-width: 1px;
67
+ border-color: #bec0c4;
68
+ }
69
+
70
+ .chat-item:hover {
71
+ background-color: #242e3d;
72
+ }
73
+
74
+ .chat-item-selected {
75
+ padding: 8px 10px;
76
+ border-radius: 6px;
77
+ margin-bottom: 5px;
78
+ color: #111827; /* Dark text for better contrast on light green */
79
+ background-color: #34D399; /* Your signature green color */
80
+ cursor: pointer;
81
+ font-size: 14px;
82
+ white-space: nowrap;
83
+ overflow: hidden;
84
+ text-overflow: ellipsis;
85
+ border: 1px solid #2BB389; /* Slightly darker green border */
86
+ font-weight: 500; /* Slightly bolder text like your user messages */
87
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */
88
+ }
89
+
90
+ .main-content {
91
+ flex: 1;
92
+ display: flex;
93
+ flex-direction: column;
94
+ }
95
+
96
+ .chat-container {
97
+ flex: 1;
98
+ padding: 30px;
99
+ overflow-y: auto;
100
+ display: flex;
101
+ flex-direction: column;
102
+ gap: 15px; /* This controls the space between messages */
103
+ }
104
+
105
+ .message {
106
+ max-width: 1000px;
107
+ width: 100%;
108
+ margin: 0 auto;
109
+ }
110
+
111
+ .user-message {
112
+ background-color: #34D399;
113
+ color: #000;
114
+ padding: 12px 16px;
115
+ border-radius: 12px;
116
+ font-weight: 500;
117
+ display: inline-block;
118
+ max-width: 80%;
119
+ float: right;
120
+ clear: both;
121
+ margin-bottom: 5px;
122
+ }
123
+
124
+ .bot-message {
125
+ background-color: #44444C;
126
+ color: white;
127
+ padding: 16px;
128
+ border-radius: 12px;
129
+ line-height: 1.6;
130
+ max-width: 80%;
131
+ float: left;
132
+ clear: both;
133
+ }
134
+
135
+ .bot-message h1 {
136
+ font-size: 24px;
137
+ margin-bottom: 15px;
138
+ }
139
+
140
+ .sources {
141
+ font-size: 13px;
142
+ color: #666;
143
+ margin-top: 20px;
144
+ padding-top: 15px;
145
+ border-top: 1px solid #eee;
146
+ }
147
+
148
+ .database-info {
149
+ text-align: center;
150
+ font-size: 13px;
151
+ color: #999;
152
+ margin: 20px 0;
153
+ }
154
+
155
+ .link {
156
+ color: rgb(62, 62, 206)
157
+ }
158
+ .plain-text {
159
+ color: white;
160
+ }
161
+
162
+ .input-container {
163
+ padding: 16px;
164
+ background-color: #111827;
165
+ border-top: 1px solid #2d3748;
166
+ }
167
+
168
+ .input-box {
169
+ max-width: 800px;
170
+ margin: 0 auto;
171
+ position: relative;
172
+ display: flex;
173
+ align-items: center;
174
+ }
175
+
176
+ input[type="text"] {
177
+ width: 100%;
178
+ padding: 12px 48px 12px 16px;
179
+ border: 1px solid #4b5563;
180
+ border-radius: 12px;
181
+ font-size: 15px;
182
+ outline: none;
183
+ background-color: #1f2937;
184
+ color: white;
185
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
186
+ transition: all 0.2s ease;
187
+ }
188
+
189
+ input[type="text"]:focus {
190
+ border-color: #6b7280;
191
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
192
+ }
193
+
194
+ .send-button {
195
+ position: absolute;
196
+ right: 12px;
197
+ background: none;
198
+ border: none;
199
+ color: #9ca3af;
200
+ cursor: pointer;
201
+ padding: 4px;
202
+ border-radius: 6px;
203
+ transition: all 0.2s ease;
204
+ }
205
+
206
+ .send-button:hover {
207
+ color: #d1d5db;
208
+ background-color: rgba(255, 255, 255, 0.05);
209
+ }
210
+
211
+ .send-button svg {
212
+ display: block;
213
+ }
214
+
215
+ .info-code {
216
+ position: absolute;
217
+ right: 15px;
218
+ bottom: -25px;
219
+ font-size: 12px;
220
+ color: #999;
221
+ }
222
+ </style>
223
+ </head>
224
+ <body>
225
+ <div class="sidebar">
226
+ <button class="new-chat-btn" onclick="location.href='/'">
227
+ <span>Add new chat</span>
228
+ </button>
229
+
230
+ <div class="time-section">
231
+ <div class="time-header">TODAY</div>
232
+ <div class="chat-item-selected">Explanation of RAG system</div>
233
+ <div class="chat-item">IEEE citation format guidell...</div>
234
+ </div>
235
+
236
+ <div class="time-section">
237
+ <div class="time-header">LAST WEEK</div>
238
+ <div class="chat-item">System test: explanation of...</div>
239
+ </div>
240
+
241
+ <div class="time-section">
242
+ <div class="time-header">LAST MONTH</div>
243
+ <div class="chat-item">How rich is Elon Musk?</div>
244
+ <div class="chat-item">Tesla: main pros and cons t...</div>
245
+ </div>
246
+ </div>
247
+
248
+ <div class="main-content">
249
+ <div class="chat-container">
250
+ <div class="message">
251
+ <div class="user-message">
252
+ <p>Explain, please, what is RAG?</p>
253
+ </div>
254
+ </div>
255
+
256
+ <div class="message">
257
+ <div class="bot-message">
258
+ <h1 class="plain-text">RAG stands for Retrieval-Augmented Generation.</h1>
259
+
260
+ <p class="plain-text">Think of it as giving your AI a specific relevant documents (or chunks) that it can quickly scan through to find relevant information before answering your questions.</p>
261
+
262
+ <p class="plain-text">So, instead of searching the entire database (which might not fit in the LLM models context window, or even if it fits it will consume a lot of tokens to answers) we give the LLM only the relevant documents (chunks) that it needs to look up in order to answer user question.</p>
263
+
264
+ <h3 class="plain-text">Sources:</h3>
265
+ <div class="plain-text">1. <a href="#" class="link">«About RAG»</a>, p. 21, lines: 32-41</div>
266
+ </div>
267
+ </div>
268
+ </div>
269
+
270
+ <div class="input-container">
271
+ <div class="input-box">
272
+ <input type="text" placeholder="Ask your question here">
273
+ <button class="send-button">
274
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none">
275
+ <path d="M7 11L12 6L17 11M12 18V7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
276
+ </svg>
277
+ </button>
278
+ </div>
279
+ </div>
280
+ </div>
281
+ </body>
282
+ </html>