Skip to content

Commit dfcf290

Browse files
committed
improvements to chat
1 parent 206f135 commit dfcf290

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

frontend/src/app.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import { Route, Routes } from "react-router-dom";
2020
import { Notifications } from './components/notifications';
2121
import { PrivateRoute, PublicRoutes, getRoutes } from './config/routes';
2222
import { NavigateToDefault } from "./pages/chat/default-chat-route";
23-
import { useAppDispatch, useAppSelector } from "./store/hooks";
24-
import { useCallback } from "react";
23+
import { useAppSelector } from "./store/hooks";
24+
import { useCallback, useEffect } from "react";
2525
import { useUpdateSettingsMutation } from "./generated/graphql";
2626
import { optInUser, optOutUser } from "./config/posthog";
2727

frontend/src/components/search.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type ISearchInputProps = {
2929

3030
export const SearchInput: FC<ISearchInputProps> = ({ search, setSearch, placeholder, inputProps, testId }) => {
3131
return (<div className="relative grow group/search-input" data-testid={testId}>
32-
<Input value={search} setValue={setSearch} placeholder={placeholder} inputProps={{ autoFocus: true, ...inputProps, }} />
32+
<Input value={search} setValue={setSearch} placeholder={placeholder} inputProps={{ autoFocus: true, ...inputProps, className: "w-full" }} />
3333
{cloneElement(Icons.Search, {
3434
className: "w-4 h-4 absolute right-2 top-1/2 -translate-y-1/2 stroke-gray-500 dark:stroke-neutral-500 cursor-pointer transition-all hover:scale-110 rounded-full group-hover/search-input:opacity-10",
3535
})}

frontend/src/pages/chat/chat.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const TablePreview: FC<{ type: string, data: TableData, text: string }> = ({ typ
7676
setShowSQL(status => !status);
7777
}, []);
7878

79-
return <div className="flex flex-col w-full group/table-preview gap-2 relative">
79+
return <div className="flex flex-col w-[calc(100%-50px)] group/table-preview gap-2 relative">
8080
<div className="absolute -top-3 -left-3 opacity-0 group-hover/table-preview:opacity-100 transition-all z-[1]">
8181
<ActionButton containerClassName="w-8 h-8" className="w-5 h-5" icon={cloneElement(showSQL ? Icons.Tables : Icons.Code, {
8282
className: "w-6 h-6 stroke-white",
@@ -132,7 +132,6 @@ export const ChatPage: FC = () => {
132132
const scrollContainerRef = useRef<HTMLDivElement>(null);
133133
const schema = useAppSelector(state => state.database.schema);
134134
const [currentSearchIndex, setCurrentSearchIndex] = useState<number>();
135-
const dispatch = useAppDispatch();
136135

137136
const loading = useMemo(() => {
138137
return getAIChatLoading || getAIModelsLoading;
@@ -487,6 +486,7 @@ export const ChatPage: FC = () => {
487486
: <div className="pl-4" />}
488487
<div className={classNames("text-neutral-800 dark:text-neutral-300 px-4 py-2 rounded-xl whitespace-pre-wrap", {
489488
"bg-neutral-600/5 dark:bg-[#2C2F33]": chat.isUserInput,
489+
"-ml-2": !chat.isUserInput && chats[i-1]?.isUserInput,
490490
})}>
491491
{chat.Text}
492492
</div>
@@ -531,7 +531,7 @@ export const ChatPage: FC = () => {
531531
<Input value={query} setValue={setQuery} placeholder="Talk to me..." onSubmit={handleSubmitQuery} inputProps={{
532532
disabled: disableChat,
533533
onKeyUp: handleKeyUp,
534-
autoFocus: true,
534+
ref: (input) => input?.focus()
535535
}} />
536536
</div>
537537
{

0 commit comments

Comments
 (0)