Skip to content

Commit 0c635a2

Browse files
skeptrunedevcdxker
authored andcommitted
bugfux: chat playground dark mode + search input deselect
1 parent 2e5e3d4 commit 0c635a2

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

frontends/chat/src/components/ScoreChunk.tsx

+3-12
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ const ScoreChunk = (props: ScoreChunkProps) => {
7979
(import.meta.env.VITE_SEARCH_UI_URL as string | undefined) ??
8080
"https://search.trieve.ai";
8181

82-
const linesBeforeShowMore = 12;
83-
8482
const [expanded, setExpanded] = createSignal(props.initialExpanded ?? false);
8583
const [copied, setCopied] = createSignal(false);
8684
const [expandMetadata, setExpandMetadata] = createSignal(false);
@@ -127,7 +125,7 @@ const ScoreChunk = (props: ScoreChunkProps) => {
127125

128126
const useExpand = createMemo(() => {
129127
if (!props.chunk.chunk_html) return false;
130-
return props.chunk.chunk_html.split(" ").length > 20 * linesBeforeShowMore;
128+
return props.chunk.chunk_html.split(" ").length > 20 * 15;
131129
});
132130

133131
return (
@@ -344,11 +342,7 @@ const ScoreChunk = (props: ScoreChunkProps) => {
344342
"text-ellipsis max-w-[100%] w-full break-words space-y-5 leading-normal !text-black dark:!text-white":
345343
true,
346344
}}
347-
style={
348-
useExpand() && !expanded()
349-
? { "-webkit-line-clamp": linesBeforeShowMore }
350-
: {}
351-
}
345+
style={useExpand() && !expanded() ? { "-webkit-line-clamp": 15 } : {}}
352346
// eslint-disable-next-line solid/no-innerhtml, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
353347
innerHTML={sanitizeHtml(
354348
props.chunk.chunk_html !== undefined
@@ -361,10 +355,7 @@ const ScoreChunk = (props: ScoreChunkProps) => {
361355
/>
362356
<Show when={useExpand()}>
363357
<button
364-
classList={{
365-
"ml-2 font-semibold": true,
366-
"text-neutral-300 dark:text-neutral-500": !props.showExpand,
367-
}}
358+
class="ml-2 font-semibold !text-black dark:!text-white"
368359
disabled={!props.showExpand}
369360
onClick={() => setExpanded((prev) => !prev)}
370361
>

frontends/search/src/components/SearchForm.tsx

+23
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,29 @@ const SearchForm = (props: {
254254
e.currentTarget.style.height = "auto";
255255
e.currentTarget.style.height =
256256
e.currentTarget.scrollHeight + "px";
257+
258+
const searchTextarea = document.getElementById(
259+
"search-query-textarea",
260+
);
261+
searchTextarea?.focus();
262+
setTimeout(() => {
263+
searchTextarea?.focus();
264+
}, 50);
265+
setTimeout(() => {
266+
searchTextarea?.focus();
267+
}, 100);
268+
setTimeout(() => {
269+
searchTextarea?.focus();
270+
}, 200);
271+
setTimeout(() => {
272+
searchTextarea?.focus();
273+
}, 300);
274+
setTimeout(() => {
275+
searchTextarea?.focus();
276+
}, 400);
277+
setTimeout(() => {
278+
searchTextarea?.focus();
279+
}, 500);
257280
}}
258281
onKeyDown={(e) => {
259282
if (

0 commit comments

Comments
 (0)