Skip to content

Commit f6ba8a5

Browse files
committed
Merge branch 'main' into fix/input-history
2 parents 57c08a6 + abb6271 commit f6ba8a5

File tree

10 files changed

+227
-84
lines changed

10 files changed

+227
-84
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "bks-ai-shell",
33
"name": "AI Shell",
4-
"version": "1.4.0",
4+
"version": "1.4.1",
55
"minAppVersion": "5.4.0",
66
"description": "Ask AI to analyze your database and generate SQL queries.",
77
"author": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@ai-sdk/google": "^1.2.22",
2020
"@ai-sdk/openai": "^1.3.22",
2121
"@ai-sdk/vue": "^1.2.12",
22-
"@beekeeperstudio/plugin": "^1.4.0-beta.6",
22+
"@beekeeperstudio/plugin": "^1.4.0",
2323
"@langchain/core": "^0.3.61",
2424
"@material-symbols/font-400": "^0.31.2",
2525
"ai": "^4.3.16",

src/assets/styles/components/_buttons.scss

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,34 @@ $btn-border-radius: 8px;
4949
&:disabled {
5050
opacity: 0.6;
5151
}
52+
53+
.title-popup {
54+
position: absolute;
55+
width: max-content;
56+
top: 1.9rem;
57+
font-size: 0.7rem;
58+
font-weight: 600;
59+
line-height: 1;
60+
padding: 0.4rem 0.7rem;
61+
border-radius: 4px;
62+
background-color: var(--btn-hover-bg-color);
63+
user-select: none;
64+
opacity: 0;
65+
pointer-events: none;
66+
}
67+
68+
&:hover .title-popup {
69+
animation: fadeInAfterDelay 0.8s forwards;
70+
}
71+
}
72+
73+
@keyframes fadeInAfterDelay {
74+
0%, 75% {
75+
opacity: 0;
76+
}
77+
100% {
78+
opacity: 1;
79+
}
5280
}
5381

5482
.btn-primary {

src/assets/styles/pages/_chat-interface.scss

Lines changed: 95 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@
2727
position: sticky;
2828
top: 0;
2929
background-color: var(--query-editor-bg);
30+
z-index: 1;
3031

3132
.settings-btn {
32-
background-color: transparent;
3333
min-width: 0;
34+
width: 1.8rem;
35+
height: 1.8rem;
3436
border: none;
35-
border-radius: 4px;
37+
border-radius: 9999px;
3638
cursor: pointer;
37-
color: var(--text-dark);
38-
transition: all 0.2s ease;
3939
margin-left: auto;
4040
margin-right: 0.3rem;
4141
opacity: 0.7;
4242
box-shadow: none;
43-
padding-inline: 0.35rem;
43+
padding: 0;
4444

4545
&:hover {
4646
opacity: 1;
@@ -83,6 +83,43 @@
8383
flex-grow: 1;
8484
}
8585
}
86+
87+
.scroll-container>.header .btn, .code-block .actions .btn {
88+
--btn-hover-bg-color: color-mix(in srgb, var(--theme-base) 10%, var(--query-editor-bg));
89+
color: var(--text-dark);
90+
background-color: var(--query-editor-bg);
91+
92+
&:hover {
93+
background-color: var(--btn-hover-bg-color);
94+
}
95+
}
96+
97+
.scroll-down-btn {
98+
position: absolute;
99+
bottom: 7rem;
100+
left: 50%;
101+
transform: translateX(-50%);
102+
min-width: 0;
103+
width: 2rem;
104+
height: 2rem;
105+
padding: 0;
106+
border: 1px solid var(--border-color);
107+
border-radius: 9999px;
108+
color: var(--text-dark);
109+
background-color: var(--query-editor-bg);
110+
display: flex;
111+
align-items: center;
112+
justify-content: center;
113+
114+
&:hover {
115+
background-color: color-mix(in srgb, var(--theme-base) 10%, var(--query-editor-bg));
116+
}
117+
118+
.material-symbols-outlined {
119+
margin-top: 0.2rem;
120+
font-size: 1.6rem;
121+
}
122+
}
86123
}
87124

88125
.chat-messages {
@@ -128,7 +165,7 @@
128165
display: inline-block;
129166
background-color: var(--bks-text-editor-bg-color);
130167
color: var(--bks-text-editor-fg-color);
131-
padding: 0.2rem 0.5rem 0.5rem 0.5rem;
168+
padding: 0.5rem;
132169
width: 100%;
133170
line-height: 1.07rem;
134171
font-size: 0.765rem;
@@ -164,45 +201,68 @@
164201
border: 1px solid var(--border-color);
165202
border-radius: 8px;
166203
white-space: normal;
204+
--header-text-color: var(--text-dark);
205+
--header-bg-color: color-mix(in srgb, var(--theme-base) 3%, var(--query-editor-bg));
167206

168-
.header {
169-
padding: 0.2rem 0.5rem 0;
207+
.lang {
208+
padding-inline: 0.5rem;
209+
height: 1.75rem;
170210
display: flex;
171211
justify-content: space-between;
212+
font-size: 0.75rem;
213+
line-height: 1.75rem;
214+
color: var(--header-text-color);
215+
background-color: var(--header-bg-color);
216+
border-top-left-radius: 8px;
217+
border-top-right-radius: 8px;
218+
}
172219

173-
.lang {
174-
font-size: 0.7rem;
175-
opacity: 0.5;
176-
line-height: 1.25rem;
220+
.actions {
221+
position: sticky;
222+
top: 4.3rem;
223+
margin-right: 0.3rem;
224+
225+
.group {
226+
position: absolute;
227+
bottom: 0.1rem;
228+
right: 0;
229+
display: flex;
230+
justify-content: flex-end;
231+
gap: 0.25rem;
177232
}
178233

179234
.btn {
235+
min-width: 0px;
236+
padding: 0 0;
237+
width: 1.75rem;
238+
height: 1.5rem;
180239
box-shadow: none;
181-
}
240+
color: var(--header-text-color);
241+
background-color: var(--header-bg-color);
182242

183-
.copy-btn {
184-
font-size: 0.7rem;
185-
color: var(--text-dark);
243+
&:disabled {
244+
opacity: 1;
245+
color: color-mix(in srgb, var(--theme-base) 50%, var(--query-editor-bg));
246+
}
186247

187248
.material-symbols-outlined {
188-
font-size: 0.9rem;
249+
font-size: 1rem;
189250
}
190251

191252
&.copied .copy-label,
192-
&:not(.copied) .copied-label {
253+
&.copied .copy-icon,
254+
&:not(.copied) .copied-label,
255+
&:not(.copied) .copied-icon {
193256
display: none;
194257
}
258+
}
195259

196-
.label {
197-
content: "Copy";
198-
}
260+
[data-action=open-in-query-editor] .title-popup {
261+
max-width: 10rem;
199262

200-
padding: 0.3rem;
201-
background-color: transparent;
202-
gap: 0.2rem;
203-
line-height: 1;
204-
height: auto;
205-
min-width: 0px;
263+
@media (min-width: 840px) {
264+
max-width: unset;
265+
}
206266
}
207267
}
208268
}
@@ -527,4 +587,12 @@
527587
.chat-container .scroll-container>.header {
528588
background-color: transparent;
529589
}
590+
591+
.chat-messages {
592+
z-index: 1;
593+
}
594+
595+
.message-content .code-block .actions {
596+
top: 1.9rem;
597+
}
530598
}

src/assets/styles/pages/configuration/_main.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
inset: 0;
88
display: flex;
99
flex-direction: column;
10+
z-index: 1;
1011

1112
&:not(.active) {
1213
display: none;

src/components/ChatInterface.vue

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@
5959
</div>
6060
<div ref="bottomMarker"></div>
6161
</div>
62+
<button
63+
v-if="!isAtBottom"
64+
@click="scrollToBottom({ smooth: true })"
65+
class="btn scroll-down-btn"
66+
title="Scroll to bottom"
67+
>
68+
<span class="material-symbols-outlined">keyboard_arrow_down</span>
69+
</button>
6270
<div class="chat-input-container-container">
6371
<PromptInput storage-key="inputHistory" :processing="processing" :selected-model="model"
6472
@select-model="selectModel" @manage-models="$emit('manage-models')" @submit="submit" @stop="stop" />
@@ -242,12 +250,19 @@ export default {
242250
}
243251
},
244252
245-
scrollToBottom() {
253+
scrollToBottom(options?: { smooth?: boolean }) {
246254
if (!this.$refs.scrollContainerRef) {
247255
return;
248256
}
249-
this.$refs.scrollContainerRef.scrollTop =
250-
this.$refs.scrollContainerRef.scrollHeight;
257+
if (options?.smooth) {
258+
this.$refs.scrollContainerRef.scrollTo({
259+
top: this.$refs.scrollContainerRef.scrollHeight,
260+
behavior: 'smooth'
261+
});
262+
} else {
263+
this.$refs.scrollContainerRef.scrollTop =
264+
this.$refs.scrollContainerRef.scrollHeight;
265+
}
251266
},
252267
253268
selectModel(model: Model) {

src/components/messages/Markdown.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
</template>
44

55
<script lang="ts">
6-
import { clipboard } from "@beekeeperstudio/plugin";
6+
import { clipboard, openTab } from "@beekeeperstudio/plugin";
77
import { parseMarkdownToHTML } from "@/markdownParser";
88
99
export default {
@@ -59,10 +59,14 @@ export default {
5959
}
6060
this.copyTimeout = setTimeout(
6161
() => target.classList.remove("copied"),
62-
3000,
62+
1000,
6363
);
6464
break;
6565
}
66+
case "open-in-query-editor": {
67+
await openTab("query", { query: text });
68+
break;
69+
}
6670
case "run": {
6771
target.classList.add("running");
6872
// TODO call request("runQuery") here

0 commit comments

Comments
 (0)