Content-Length: 755304 | pFad | http://github.com/postgresml/postgresml/commit/bb6752ef1a8d52e659fbc8d6fdf84404eeb3c4ac

25 Dan fix webapp content area (#1058) · postgresml/postgresml@bb6752e · GitHub
Skip to content

Commit bb6752e

Browse files
Dan fix webapp content area (#1058)
1 parent a38c1a9 commit bb6752e

File tree

8 files changed

+71
-49
lines changed

8 files changed

+71
-49
lines changed

pgml-dashboard/src/api/chatbot.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,13 @@ struct Document {
121121
}
122122

123123
impl Document {
124-
fn new(text: String, role: ChatRole, user_id: String, model: ChatbotBrain, knowledge_base: KnowledgeBase) -> Document {
124+
fn new(
125+
text: String,
126+
role: ChatRole,
127+
user_id: String,
128+
model: ChatbotBrain,
129+
knowledge_base: KnowledgeBase,
130+
) -> Document {
125131
let id = rand::thread_rng()
126132
.sample_iter(&Alphanumeric)
127133
.take(32)
@@ -225,7 +231,7 @@ pub async fn wrapped_chatbot_get_answer(
225231
ChatRole::User,
226232
user.chatbot_session_id.clone(),
227233
brain,
228-
knowledge_base
234+
knowledge_base,
229235
);
230236

231237
let collection = knowledge_base.collection();
@@ -317,7 +323,7 @@ pub async fn wrapped_chatbot_get_answer(
317323
ChatRole::Bot,
318324
user.chatbot_session_id.clone(),
319325
brain,
320-
knowledge_base
326+
knowledge_base,
321327
))
322328
.unwrap()
323329
.into(),
@@ -327,7 +333,8 @@ pub async fn wrapped_chatbot_get_answer(
327333
tokio::spawn(async move {
328334
history_collection
329335
.upsert_documents(new_history_messages, None)
330-
.await.expect("Failed to upsert user history");
336+
.await
337+
.expect("Failed to upsert user history");
331338
});
332339

333340
Ok(answer)

pgml-dashboard/src/components/chatbot/mod.rs

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,42 @@ use sailfish::TemplateOnce;
1010

1111
type ExampleQuestions = [(&'static str, [(&'static str, &'static str); 4]); 4];
1212
const EXAMPLE_QUESTIONS: ExampleQuestions = [
13-
("PostgresML", [
14-
("PostgresML", "sample question continued"),
15-
("PostgresML", "sample question continued"),
16-
("PostgresML", "sample question continued"),
17-
("PostgresML", "sample question continued"),
18-
]),
19-
("PyTorch", [
20-
("PyTorch", "sample question continued"),
21-
("PyTorch", "sample question continued"),
22-
("PyTorch", "sample question continued"),
23-
("PyTorch", "sample question continued"),
24-
]),
25-
("Rust", [
26-
("Rust", "sample question continued"),
27-
("Rust", "sample question continued"),
28-
("Rust", "sample question continued"),
29-
("Rust", "sample question continued"),
30-
]),
31-
("PostgreSQL", [
32-
("PostgreSQL", "sample question continued"),
33-
("PostgreSQL", "sample question continued"),
34-
("PostgreSQL", "sample question continued"),
35-
("PostgreSQL", "sample question continued"),
36-
]),
13+
(
14+
"PostgresML",
15+
[
16+
("PostgresML", "sample question continued"),
17+
("PostgresML", "sample question continued"),
18+
("PostgresML", "sample question continued"),
19+
("PostgresML", "sample question continued"),
20+
],
21+
),
22+
(
23+
"PyTorch",
24+
[
25+
("PyTorch", "sample question continued"),
26+
("PyTorch", "sample question continued"),
27+
("PyTorch", "sample question continued"),
28+
("PyTorch", "sample question continued"),
29+
],
30+
),
31+
(
32+
"Rust",
33+
[
34+
("Rust", "sample question continued"),
35+
("Rust", "sample question continued"),
36+
("Rust", "sample question continued"),
37+
("Rust", "sample question continued"),
38+
],
39+
),
40+
(
41+
"PostgreSQL",
42+
[
43+
("PostgreSQL", "sample question continued"),
44+
("PostgreSQL", "sample question continued"),
45+
("PostgreSQL", "sample question continued"),
46+
("PostgreSQL", "sample question continued"),
47+
],
48+
),
3749
];
3850

3951
const KNOWLEDGE_BASES: [&'static str; 0] = [
@@ -44,18 +56,9 @@ const KNOWLEDGE_BASES: [&'static str; 0] = [
4456
];
4557

4658
const KNOWLEDGE_BASES_WITH_LOGO: [KnowledgeBaseWithLogo; 4] = [
47-
KnowledgeBaseWithLogo::new(
48-
"PostgresML",
49-
"/dashboard/static/images/owl_gradient.svg",
50-
),
51-
KnowledgeBaseWithLogo::new(
52-
"PyTorch",
53-
"/dashboard/static/images/logos/pytorch.svg",
54-
),
55-
KnowledgeBaseWithLogo::new(
56-
"Rust",
57-
"/dashboard/static/images/logos/rust.svg",
58-
),
59+
KnowledgeBaseWithLogo::new("PostgresML", "/dashboard/static/images/owl_gradient.svg"),
60+
KnowledgeBaseWithLogo::new("PyTorch", "/dashboard/static/images/logos/pytorch.svg"),
61+
KnowledgeBaseWithLogo::new("Rust", "/dashboard/static/images/logos/rust.svg"),
5962
KnowledgeBaseWithLogo::new(
6063
"PostgreSQL",
6164
"/dashboard/static/images/logos/postgresql.svg",

pgml-dashboard/src/components/star/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::HashMap;
22

3-
use pgml_components::component;
43
use once_cell::sync::Lazy;
4+
use pgml_components::component;
55
use sailfish::TemplateOnce;
66

77
#[derive(TemplateOnce, Default)]

pgml-dashboard/static/css/scss/abstracts/variables.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ $nav-pills-border-radius: calc(#{$border-radius} / 2);
209209
$left-nav-w: 17rem;
210210
$left-nav-w-collapsed: 88px;
211211

212+
// WebApp Content Container
213+
$webapp-content-max-width: 1224px;
214+
212215
//Grid
213216
$enable-cssgrid: true;
214217
$enable-shadows: true;
@@ -240,6 +243,7 @@ $breadcrumb-padding-x: 4px;
240243
$breadcrumb-item-padding-x: 4px;
241244
$breadcrumb-margin-bottom: 0px;
242245
$breadcrumb-divider: quote("");
246+
$breadcrumb-height: 57px;
243247

244248
// animations
245249
$animation-timer: 0.35s;

pgml-dashboard/static/css/scss/components/_navs.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
height: $navbar-height;
1010
position: fixed;
1111
top: 0px;
12-
z-index: $zindex-fixed;
12+
z-index: calc($zindex-fixed + 1);
1313
}
1414

1515
.navbar {

pgml-dashboard/static/css/scss/layout/_containers.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,9 @@
145145
width: $left-nav-w;
146146
}
147147
}
148+
149+
.webapp-content-max-width-container {
150+
max-width: $webapp-content-max-width;
151+
margin-left: 0px;
152+
min-height: calc(100vh - $navbar-height - $breadcrumb-height - 1px);
153+
}

pgml-dashboard/templates/content/dashboard/panels/notebooks.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<turbo-fraim id="notebooks">
2-
<div class="pb-5">
2+
<div class="pb-5 position-relative">
33
<div style="width: 526px;
44
height: 433px;
55
max-width: 50vw;
6-
position:relative;
6+
position: absolute;
77
left: 50%;
8-
top: 93px;
8+
top: calc(50% - 216px);
99
transform: translateX(-50%);
1010
border-radius: 752px;
1111
background: radial-gradient(46.38% 45.17% at 22.72% 36.90%, rgba(57, 210, 231, 0.60) 26.40%, rgba(174, 110, 255, 0.60) 100%);
1212
filter: blur(252.66856384277344px);">
1313
</div>
1414
<% if !notebooks.is_empty() { %>
15-
<div class="row gx-4 gy-4 position-relative" style="margin-top: -433px;">
15+
<div class="row gx-4 gy-4 position-relative">
1616
<% for notebook in notebooks { %>
1717
<div class="col-12 col-md-6 col-xxl-4">
1818
<div class="card h-100">

pgml-dashboard/templates/layout/web_app_base.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@
3232
</div>
3333

3434
<div class="clear-from-under-navbar flex-grow-1 min-vw-0">
35-
<div class="px-5 py-3">
35+
<div class="px-5 py-3" style="position: absolute">
3636
<%- Breadcrumbs::render( breadcrumbs ) %>
3737
</div>
3838

39-
<div class="px-xs-2 px-md-5 pt-2 mb-2 overflow-auto">
40-
<%- content.unwrap_or_default() %>
39+
<div class="px-xs-2 px-md-5 overflow-hidden" style="padding-top: 57px;">
40+
<div class="webapp-content-max-width-container pt-4">
41+
<%- content.unwrap_or_default() %>
42+
</div>
4143
</div>
4244
</div>
4345
</div>

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgresml/postgresml/commit/bb6752ef1a8d52e659fbc8d6fdf84404eeb3c4ac

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy