(props: {
open: boolean;
setOpen: (open: boolean) => void;
actions: Action[];
})
| 45 | ]; |
| 46 | |
| 47 | export default function ViewSystemPromptModal(props: { |
| 48 | open: boolean; |
| 49 | setOpen: (open: boolean) => void; |
| 50 | actions: Action[]; |
| 51 | }) { |
| 52 | const { profile } = useProfile(); |
| 53 | const [viewSystemPrompt, setViewSystemPrompt] = useState<boolean>(false); |
| 54 | |
| 55 | const additionalActions: Action[] = []; |
| 56 | if (profile?.organizations?.chat_to_docs_enabled) { |
| 57 | additionalActions.unshift(getSearchDocsAction(profile.organizations, "")); |
| 58 | } |
| 59 | const actions = additionalActions.concat(props.actions); |
| 60 | |
| 61 | return ( |
| 62 | <Modal open={props.open} setOpen={props.setOpen} classNames="max-w-7xl"> |
| 63 | <div className="relative mt-3 text-center sm:mt-5"> |
| 64 | <Dialog.Title |
| 65 | as="h3" |
| 66 | className="text-2xl font-semibold leading-6 text-gray-100 flex flex-row gap-x-2 justify-center place-items-center" |
| 67 | > |
| 68 | {viewSystemPrompt ? "System Prompt" : "Actions Description"} |
| 69 | </Dialog.Title> |
| 70 | |
| 71 | <div className="flex flex-row justify-center"> |
| 72 | <p className="mt-4 text-gray-300 whitespace-pre-wrap text-center max-w-2xl"> |
| 73 | {viewSystemPrompt ? items[0].description : items[1].description} |
| 74 | </p> |
| 75 | </div> |
| 76 | <div className="absolute top-2 left-3 flex flex-row gap-x-3 text-sm place-items-center text-gray-400"> |
| 77 | Actions description |
| 78 | <Toggle |
| 79 | enabled={viewSystemPrompt} |
| 80 | setEnabled={setViewSystemPrompt} |
| 81 | size={"sm"} |
| 82 | sr={"View System Prompt"} |
| 83 | /> |
| 84 | System prompt |
| 85 | </div> |
| 86 | <p className="mt-4 text-gray-200 bg-gray-700 rounded-md px-4 py-3 whitespace-pre-wrap text-left"> |
| 87 | {viewSystemPrompt |
| 88 | ? addTabsToVariables( |
| 89 | getMessages( |
| 90 | [], |
| 91 | actions, |
| 92 | "<USER DESCRIPTION GOES HERE>", |
| 93 | { |
| 94 | name: profile?.organizations?.name ?? "<ORG NAME>", |
| 95 | description: |
| 96 | profile?.organizations?.description ?? |
| 97 | "<ORG DESCRIPTION>", |
| 98 | chatbot_instructions: |
| 99 | profile?.organizations?.chatbot_instructions ?? "", |
| 100 | enable_data_analysis: |
| 101 | profile?.organizations?.enable_data_analysis ?? false, |
| 102 | }, |
| 103 | "English", |
| 104 | false, |
nothing calls this directly
no test coverage detected