-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: remove react-mentions * feat: add chat header * feat: remove v2/chat * feat: add fature flag * feat: add new chat UI * feat: add prompt and brain name to messages
- Loading branch information
1 parent
d4d19bb
commit 80be40a
Showing
41 changed files
with
363 additions
and
484 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
frontend/app/chat/[chatId]/components/ActionsBar/ActionsBar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ChatInput } from "../ChatInput"; | ||
|
||
export const ActionsBar = (): JSX.Element => { | ||
return ( | ||
<div className="flex mt-4 flex-row w-full shadow-md dark:shadow-primary/25 hover:shadow-xl transition-shadow rounded-xl bg-white dark:bg-black border border-black/10 dark:border-white/25 p-6"> | ||
<ChatInput /> | ||
</div> | ||
); | ||
}; |
File renamed without changes.
21 changes: 21 additions & 0 deletions
21
frontend/app/chat/[chatId]/components/ActionsBar/components/MentionsInput.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
type StyleMentionsInputProps = { | ||
value: string; | ||
onChange: (value: string) => void; | ||
placeholder: string; | ||
}; | ||
|
||
export const MentionsInput = ({ | ||
onChange, | ||
placeholder, | ||
value, | ||
}: StyleMentionsInputProps): JSX.Element => { | ||
return ( | ||
<input | ||
autoFocus | ||
placeholder={placeholder} | ||
onChange={(event) => onChange(event.target.value)} | ||
value={value} | ||
className="focus:outline-none focus:border-none" | ||
/> | ||
); | ||
}; |
File renamed without changes.
15 changes: 15 additions & 0 deletions
15
frontend/app/chat/[chatId]/components/ActionsBar/hooks/useActionsBar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { useState } from "react"; | ||
|
||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
export const useActionsBar = () => { | ||
const [value, setValue] = useState(""); | ||
|
||
const handleChange = (newPlainTextValue: string) => { | ||
setValue(newPlainTextValue); | ||
}; | ||
|
||
return { | ||
handleChange, | ||
value, | ||
}; | ||
}; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useTranslation } from "react-i18next"; | ||
|
||
import { useChatContext } from "@/lib/context"; | ||
|
||
export const ChatHeader = (): JSX.Element => { | ||
const { t } = useTranslation(["chat"]); | ||
const { history } = useChatContext(); | ||
|
||
if (history.length !== 0) { | ||
return ( | ||
<h1 className="text-3xl font-bold text-center"> | ||
{t("chat_title_intro")}{" "} | ||
<span className="text-purple-500">{t("brains")}</span> | ||
</h1> | ||
); | ||
} | ||
|
||
return ( | ||
<h1 className="text-3xl font-bold text-center"> | ||
{t("chat_title_intro")}{" "} | ||
<span className="text-purple-500">{t("brains")}</span> | ||
{" !! "} | ||
<br /> | ||
{t("empty_brain_title_prefix")}{" "} | ||
<span className="text-purple-500">{t("brain")}</span>{" "} | ||
{t("empty_brain_title_suffix")} | ||
</h1> | ||
); | ||
}; |
26 changes: 26 additions & 0 deletions
26
frontend/app/chat/[chatId]/components/ChatInput/hooks/useChatInput.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { useState } from "react"; | ||
|
||
import { useChat } from "../../../hooks/useChat"; | ||
|
||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
export const useChatInput = () => { | ||
const [message, setMessage] = useState<string>(""); | ||
const { addQuestion, generatingAnswer, chatId } = useChat(); | ||
|
||
const submitQuestion = () => { | ||
if (message.length === 0) { | ||
return; | ||
} | ||
if (!generatingAnswer) { | ||
void addQuestion(message, () => setMessage("")); | ||
} | ||
}; | ||
|
||
return { | ||
message, | ||
setMessage, | ||
submitQuestion, | ||
generatingAnswer, | ||
chatId, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
...at/[chatId]/components/ChatMessages/components/ChatMessage/__tests__/ChatMessage.test.tsx
This file was deleted.
Oops, something went wrong.
80 changes: 47 additions & 33 deletions
80
...p/chat/[chatId]/components/ChatMessages/components/ChatMessage/components/ChatMessage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.