-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wire up iteration of conversations UI to new message API.
Co-authored-by: Karen Shaw <[email protected]> Co-authored-by: charlesLoder <[email protected]>
- Loading branch information
1 parent
59350a9
commit b9451d3
Showing
23 changed files
with
471 additions
and
247 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
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
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,56 @@ | ||
import { keyframes, styled } from "@/stitches.config"; | ||
|
||
const gradientAnimation = keyframes({ | ||
to: { | ||
backgroundSize: "500%", | ||
backgroundPosition: "38.2%", | ||
}, | ||
}); | ||
|
||
const StyledInterstitialIcon = styled("div", { | ||
display: "flex", | ||
width: "1.5rem", | ||
height: "1.5rem", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
borderRadius: "50%", | ||
background: | ||
"linear-gradient(73deg, $purple120 0%, $purple 38.2%, $brightBlueB 61.8%)", | ||
backgroundSize: "250%", | ||
backgroundPosition: "61.8%", | ||
animation: `${gradientAnimation} 5s infinite alternate`, | ||
transition: "$dcAll", | ||
content: "", | ||
|
||
variants: { | ||
isActive: { | ||
true: { | ||
backgroundPosition: "61.8%", | ||
}, | ||
false: { | ||
backgroundPosition: "0%", | ||
}, | ||
}, | ||
}, | ||
|
||
svg: { | ||
fill: "$white", | ||
width: "0.85rem", | ||
height: "0.85rem", | ||
}, | ||
}); | ||
|
||
const StyledInterstitial = styled("div", { | ||
color: "$black", | ||
fontFamily: "$northwesternSansBold", | ||
fontSize: "$gr4", | ||
display: "flex", | ||
alignItems: "center", | ||
gap: "$gr2", | ||
|
||
em: { | ||
color: "$purple", | ||
}, | ||
}); | ||
|
||
export { StyledInterstitial, StyledInterstitialIcon }; |
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,52 @@ | ||
import { | ||
StyledInterstitial, | ||
StyledInterstitialIcon, | ||
} from "@/components/Chat/Response/Interstitial.styled"; | ||
|
||
import { IconSearch } from "@/components/Shared/SVG/Icons"; | ||
import React from "react"; | ||
import { ToolStartMessage } from "@/types/components/chat"; | ||
|
||
interface ResponseInterstitialProps { | ||
message: ToolStartMessage["message"]; | ||
} | ||
|
||
const ResponseInterstitial: React.FC<ResponseInterstitialProps> = ({ | ||
message, | ||
}) => { | ||
const { tool, input } = message; | ||
let text: React.ReactElement = <></>; | ||
|
||
switch (tool) { | ||
case "aggregate": | ||
text = ( | ||
<> | ||
Aggregating {input.agg_field} by {input.term_field} {input.term} | ||
</> | ||
); | ||
break; | ||
case "discover_fields": | ||
text = <>Discovering fields</>; | ||
break; | ||
case "search": | ||
text = ( | ||
<> | ||
Searching for <em>{input.query}</em> | ||
</> | ||
); | ||
break; | ||
default: | ||
console.warn("Unknown tool_start message", message); | ||
} | ||
|
||
return ( | ||
<StyledInterstitial data-testid="response-interstitial" data-tool={tool}> | ||
<StyledInterstitialIcon> | ||
<IconSearch /> | ||
</StyledInterstitialIcon> | ||
<label>{text}</label> | ||
</StyledInterstitial> | ||
); | ||
}; | ||
|
||
export default React.memo(ResponseInterstitial); |
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,11 @@ | ||
import React from "react"; | ||
import { StyledResponseMarkdown } from "@/components/Chat/Response/Response.styled"; | ||
import useMarkdown from "@nulib/use-markdown"; | ||
|
||
const ResponseMarkdown = ({ content }: { content: string }) => { | ||
const { jsx } = useMarkdown(content); | ||
|
||
return <StyledResponseMarkdown>{jsx}</StyledResponseMarkdown>; | ||
}; | ||
|
||
export default ResponseMarkdown; |
Oops, something went wrong.