-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add support for custom prompts for query relaxation and generation - uses db config rules to target specific workspaces, channels or Slack apps
- Loading branch information
Showing
12 changed files
with
147 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React from "react"; | ||
import { Link, Box } from "@mui/material"; | ||
import ReactMarkdown from "react-markdown"; | ||
import { LightAsync as SyntaxHighlighter } from "react-syntax-highlighter"; | ||
import { github } from "react-syntax-highlighter/dist/esm/styles/hljs"; | ||
import { DocsBotReplyMessage } from "../models/Models"; | ||
import ErrorBoundary from "./ErrorBoundary"; | ||
|
||
export type Params = DocsBotReplyMessage & {}; | ||
|
||
const RagSourceView: React.FC<Params> = ({ message }) => { | ||
const components = { | ||
code({ node, inline, className, children, ...props }) { | ||
const match = /language-(\w+)/.exec(className || ""); | ||
return !inline && match ? ( | ||
<SyntaxHighlighter | ||
children={String(children).replace(/\n$/, "")} | ||
style={github} | ||
language={match[1]} | ||
PreTag="div" | ||
{...props} | ||
/> | ||
) : ( | ||
<code className={className} {...props}> | ||
{children} | ||
</code> | ||
); | ||
}, | ||
}; | ||
|
||
return ( | ||
<Box sx={{ flexWrap: "wrap" }}> | ||
<React.Fragment> | ||
<ErrorBoundary> | ||
{" "} | ||
<ul> | ||
{Object.entries(message?.content?.prompts || {}).map( | ||
([key, value], index) => ( | ||
<li key={key}> | ||
<Box flexDirection="column"> | ||
<span> | ||
Prompt #{index + 1}: {key} | ||
</span> | ||
<ReactMarkdown components={components}> | ||
{value} | ||
</ReactMarkdown> | ||
</Box> | ||
<hr /> | ||
</li> | ||
), | ||
)} | ||
</ul> | ||
</ErrorBoundary> | ||
</React.Fragment> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default RagSourceView; |
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
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
Oops, something went wrong.