Skip to content

Commit

Permalink
Add feedback form.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathewjordan committed Jan 28, 2025
1 parent c6fa6c0 commit e9a90cd
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
23 changes: 14 additions & 9 deletions components/Chat/Feedback/Feedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,16 @@ const StyledChatFeedbackActivate = styled("div", {
margin: "0 0 $gr2 ",
display: "flex",
alignItems: "center",
fontSize: "$gr3",
gap: "$gr2",
});
borderTop: "1px solid $gray6",
padding: "$gr3 0",

const StyledChatFeedbackConfirmation = styled("div", {
fontSize: "$gr3",
"> span": {
marginRight: "$gr2",
},
});

const StyledChatFeedbackConfirmation = styled("div", {});

const StyledChatFeedbackForm = styled("form", {
margin: "$gr3 0",
transition: "200ms all ease-in-out",
Expand All @@ -244,6 +246,9 @@ const StyledChatFeedbackForm = styled("form", {
});

const StyledChatFeedback = styled("div", {
fontSize: "$gr2",
color: "$black50",

variants: {
isSubmitted: {
true: {
Expand All @@ -257,7 +262,7 @@ const StyledChatFeedback = styled("div", {
});

const StyledSentimentButton = styled("button", {
backgroundColor: "$purple10",
backgroundColor: "transparent",
border: "none",
padding: 0,
height: "40px",
Expand All @@ -270,8 +275,8 @@ const StyledSentimentButton = styled("button", {
borderRadius: "50%",

"> span": {
height: "36px",
width: "36px",
height: "32px",
width: "32px",
},

"&:not([disabled])": {
Expand All @@ -290,7 +295,7 @@ const StyledSentimentButton = styled("button", {

"&[data-is-selected=false]": {
"> span": {
fill: "$purple30",
fill: "$black20",
},
},
});
Expand Down
2 changes: 1 addition & 1 deletion components/Chat/Response/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import useMarkdown from "@nulib/use-markdown";
function addTableWrapper(html: string) {
let parsedHtml = html;

const tableRegex = /<table>(.*?)<\/table>/gs;
const tableRegex = /<table>([\s\S]*?)<\/table>/g;
const tableMatch = html.match(tableRegex);

if (tableMatch) {
Expand Down
11 changes: 11 additions & 0 deletions components/Chat/Response/Options.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import ChatFeedback from "../Feedback/Feedback";

const ResponseOptions = () => {
return (
<>
<ChatFeedback />
</>
);
};

export default ResponseOptions;
3 changes: 2 additions & 1 deletion components/Chat/Response/Response.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Container from "@/components/Shared/Container";
import ResponseImages from "@/components/Chat/Response/Images";
import ResponseInterstitial from "@/components/Chat/Response/Interstitial";
import ResponseMarkdown from "@/components/Chat/Response/Markdown";
import ResponseOptions from "./Options";
import { prepareQuestion } from "@/lib/chat-helpers";
import useChatSocket from "@/hooks/useChatSocket";

Expand Down Expand Up @@ -130,7 +131,7 @@ const ChatResponse: React.FC<ChatResponseProps> = ({
<div>
{renderedMessage}
{streamedMessage && <ResponseMarkdown content={streamedMessage} />}
{!isStreamingComplete && <BouncingLoader />}
{isStreamingComplete ? <ResponseOptions /> : <BouncingLoader />}
</div>
</StyledResponse>
);
Expand Down

0 comments on commit e9a90cd

Please sign in to comment.