@@ -768,293 +768,7 @@ const Chat = () => {
768
768
769
769
return (
770
770
< div className = { styles . container } role = "main" >
771
- { showAuthMessage ? (
772
- < Stack className = { styles . chatEmptyState } >
773
- < ShieldLockRegular
774
- className = { styles . chatIcon }
775
- style = { { color : 'darkorange' , height : '200px' , width : '200px' } }
776
- />
777
- < h1 className = { styles . chatEmptyStateTitle } > Authentication Not Configured</ h1 >
778
- < h2 className = { styles . chatEmptyStateSubtitle } >
779
- This app does not have authentication configured. Please add an identity provider by finding your app in the{ ' ' }
780
- < a href = "https://portal.azure.com/" target = "_blank" >
781
- Azure Portal
782
- </ a >
783
- and following{ ' ' }
784
- < a
785
- href = "https://learn.microsoft.com/en-us/azure/app-service/scenario-secure-app-authentication-app-service#3-configure-authentication-and-authorization"
786
- target = "_blank" >
787
- these instructions
788
- </ a >
789
- .
790
- </ h2 >
791
- < h2 className = { styles . chatEmptyStateSubtitle } style = { { fontSize : '20px' } } >
792
- < strong > Authentication configuration takes a few minutes to apply. </ strong >
793
- </ h2 >
794
- < h2 className = { styles . chatEmptyStateSubtitle } style = { { fontSize : '20px' } } >
795
- < strong > If you deployed in the last 10 minutes, please wait and reload the page after 10 minutes.</ strong >
796
- </ h2 >
797
- </ Stack >
798
- ) : (
799
- < Stack horizontal className = { styles . chatRoot } >
800
- < div className = { styles . chatContainer } >
801
- { ! messages || messages . length < 1 ? (
802
- < Stack className = { styles . chatEmptyState } >
803
- < img src = { logo } className = { styles . chatIcon } aria-hidden = "true" />
804
- < h1 className = { styles . chatEmptyStateTitle } > { ui ?. chat_title } </ h1 >
805
- < h2 className = { styles . chatEmptyStateSubtitle } > { ui ?. chat_description } </ h2 >
806
- </ Stack >
807
- ) : (
808
- < div className = { styles . chatMessageStream } style = { { marginBottom : isLoading ? '40px' : '0px' } } role = "log" >
809
- { messages . map ( ( answer , index ) => (
810
- < >
811
- { answer . role === 'user' ? (
812
- < div className = { styles . chatMessageUser } tabIndex = { 0 } >
813
- < div className = { styles . chatMessageUserMessage } > { answer . content } </ div >
814
- </ div >
815
- ) : answer . role === 'assistant' ? (
816
- < div className = { styles . chatMessageGpt } >
817
- < Answer
818
- answer = { {
819
- answer : answer . content ,
820
- citations : parseCitationFromMessage ( messages [ index - 1 ] ) ,
821
- plotly_data : parsePlotFromMessage ( messages [ index - 1 ] ) ,
822
- message_id : answer . id ,
823
- feedback : answer . feedback ,
824
- exec_results : execResults
825
- } }
826
- onCitationClicked = { c => onShowCitation ( c ) }
827
- onExectResultClicked = { ( ) => onShowExecResult ( ) }
828
- />
829
- </ div >
830
- ) : answer . role === ERROR ? (
831
- < div className = { styles . chatMessageError } >
832
- < Stack horizontal className = { styles . chatMessageErrorContent } >
833
- < ErrorCircleRegular className = { styles . errorIcon } style = { { color : 'rgba(182, 52, 67, 1)' } } />
834
- < span > Error</ span >
835
- </ Stack >
836
- < span className = { styles . chatMessageErrorContent } > { answer . content } </ span >
837
- </ div >
838
- ) : null }
839
- </ >
840
- ) ) }
841
- { showLoadingMessage && (
842
- < >
843
- < div className = { styles . chatMessageGpt } >
844
- < Answer
845
- answer = { {
846
- answer : "Generating answer..." ,
847
- citations : [ ] ,
848
- plotly_data : null
849
- } }
850
- onCitationClicked = { ( ) => null }
851
- onExectResultClicked = { ( ) => null }
852
- />
853
- </ div >
854
- </ >
855
- ) }
856
- < div ref = { chatMessageStreamEnd } />
857
- </ div >
858
- ) }
859
-
860
- < Stack horizontal className = { styles . chatInput } >
861
- { isLoading && messages . length > 0 && (
862
- < Stack
863
- horizontal
864
- className = { styles . stopGeneratingContainer }
865
- role = "button"
866
- aria-label = "Stop generating"
867
- tabIndex = { 0 }
868
- onClick = { stopGenerating }
869
- onKeyDown = { e => ( e . key === 'Enter' || e . key === ' ' ? stopGenerating ( ) : null ) } >
870
- < SquareRegular className = { styles . stopGeneratingIcon } aria-hidden = "true" />
871
- < span className = { styles . stopGeneratingText } aria-hidden = "true" >
872
- Stop generating
873
- </ span >
874
- </ Stack >
875
- ) }
876
- < Stack >
877
- { appStateContext ?. state . isCosmosDBAvailable ?. status !== CosmosDBStatus . NotConfigured && (
878
- < CommandBarButton
879
- role = "button"
880
- styles = { {
881
- icon : {
882
- color : '#FFFFFF'
883
- } ,
884
- iconDisabled : {
885
- color : '#BDBDBD !important'
886
- } ,
887
- root : {
888
- color : '#FFFFFF' ,
889
- background :
890
- 'radial-gradient(109.81% 107.82% at 100.1% 90.19%, #0F6CBD 33.63%, #2D87C3 70.31%, #8DDDD8 100%)'
891
- } ,
892
- rootDisabled : {
893
- background : '#F0F0F0'
894
- }
895
- } }
896
- className = { styles . newChatIcon }
897
- iconProps = { { iconName : 'Add' } }
898
- onClick = { newChat }
899
- disabled = { disabledButton ( ) }
900
- aria-label = "start a new chat button"
901
- />
902
- ) }
903
- < CommandBarButton
904
- role = "button"
905
- styles = { {
906
- icon : {
907
- color : '#FFFFFF'
908
- } ,
909
- iconDisabled : {
910
- color : '#BDBDBD !important'
911
- } ,
912
- root : {
913
- color : '#FFFFFF' ,
914
- background :
915
- 'radial-gradient(109.81% 107.82% at 100.1% 90.19%, #0F6CBD 33.63%, #2D87C3 70.31%, #8DDDD8 100%)'
916
- } ,
917
- rootDisabled : {
918
- background : '#F0F0F0'
919
- }
920
- } }
921
- className = {
922
- appStateContext ?. state . isCosmosDBAvailable ?. status !== CosmosDBStatus . NotConfigured
923
- ? styles . clearChatBroom
924
- : styles . clearChatBroomNoCosmos
925
- }
926
- iconProps = { { iconName : 'Broom' } }
927
- onClick = {
928
- appStateContext ?. state . isCosmosDBAvailable ?. status !== CosmosDBStatus . NotConfigured
929
- ? clearChat
930
- : newChat
931
- }
932
- disabled = { disabledButton ( ) }
933
- aria-label = "clear chat button"
934
- />
935
- < Dialog
936
- hidden = { hideErrorDialog }
937
- onDismiss = { handleErrorDialogClose }
938
- dialogContentProps = { errorDialogContentProps }
939
- modalProps = { modalProps } > </ Dialog >
940
- </ Stack >
941
- < QuestionInput
942
- clearOnSend
943
- placeholder = "Type a new question..."
944
- disabled = { isLoading }
945
- onSend = { ( question , id ) => {
946
- appStateContext ?. state . isCosmosDBAvailable ?. cosmosDB
947
- ? makeApiRequestWithCosmosDB ( question , id )
948
- : makeApiRequestWithoutCosmosDB ( question , id )
949
- } }
950
- conversationId = {
951
- appStateContext ?. state . currentChat ?. id ? appStateContext ?. state . currentChat ?. id : undefined
952
- }
953
- />
954
- </ Stack >
955
- </ div >
956
- { /* Citation Panel */ }
957
- { messages && messages . length > 0 && isCitationPanelOpen && activeCitation && (
958
- < Stack . Item className = { styles . citationPanel } tabIndex = { 0 } role = "tabpanel" aria-label = "Citations Panel" >
959
- < Stack
960
- aria-label = "Citations Panel Header Container"
961
- horizontal
962
- className = { styles . citationPanelHeaderContainer }
963
- horizontalAlign = "space-between"
964
- verticalAlign = "center" >
965
- < span aria-label = "Citations" className = { styles . citationPanelHeader } >
966
- Citations
967
- </ span >
968
- < IconButton
969
- iconProps = { { iconName : 'Cancel' } }
970
- aria-label = "Close citations panel"
971
- onClick = { ( ) => setIsCitationPanelOpen ( false ) }
972
- />
973
- </ Stack >
974
- < h5
975
- className = { styles . citationPanelTitle }
976
- tabIndex = { 0 }
977
- title = {
978
- activeCitation . url && ! activeCitation . url . includes ( 'blob.core' )
979
- ? activeCitation . url
980
- : activeCitation . title ?? ''
981
- }
982
- onClick = { ( ) => onViewSource ( activeCitation ) } >
983
- { activeCitation . title }
984
- </ h5 >
985
- < div tabIndex = { 0 } >
986
- < ReactMarkdown
987
- linkTarget = "_blank"
988
- className = { styles . citationPanelContent }
989
- children = { DOMPurify . sanitize ( activeCitation . content , { ALLOWED_TAGS : XSSAllowTags } ) }
990
- remarkPlugins = { [ remarkGfm ] }
991
- rehypePlugins = { [ rehypeRaw ] }
992
- />
993
- </ div >
994
- </ Stack . Item >
995
- ) }
996
- { messages && messages . length > 0 && isIntentsPanelOpen && (
997
- < Stack . Item className = { styles . citationPanel } tabIndex = { 0 } role = "tabpanel" aria-label = "Intents Panel" >
998
- < Stack
999
- aria-label = "Intents Panel Header Container"
1000
- horizontal
1001
- className = { styles . citationPanelHeaderContainer }
1002
- horizontalAlign = "space-between"
1003
- verticalAlign = "center" >
1004
- < span aria-label = "Intents" className = { styles . citationPanelHeader } >
1005
- Intents
1006
- </ span >
1007
- < IconButton
1008
- iconProps = { { iconName : 'Cancel' } }
1009
- aria-label = "Close intents panel"
1010
- onClick = { ( ) => setIsIntentsPanelOpen ( false ) }
1011
- />
1012
- </ Stack >
1013
- < Stack horizontalAlign = "space-between" >
1014
- { execResults . map ( ( execResult ) => {
1015
- return (
1016
- < Stack className = { styles . exectResultList } verticalAlign = "space-between" >
1017
- < > < span > Intent:</ span > < p > { execResult . intent } </ p > </ >
1018
- { execResult . search_query && < > < span > Search Query:</ span >
1019
- < SyntaxHighlighter
1020
- style = { nord }
1021
- wrapLines = { true }
1022
- lineProps = { { style : { wordBreak : 'break-all' , whiteSpace : 'pre-wrap' } } }
1023
- language = "sql"
1024
- PreTag = "p" >
1025
- { execResult . search_query }
1026
- </ SyntaxHighlighter > </ > }
1027
- { execResult . search_result && < > < span > Search Result:</ span > < p > { execResult . search_result } </ p > </ > }
1028
- { execResult . code_generated && < > < span > Code Generated:</ span >
1029
- < SyntaxHighlighter
1030
- style = { nord }
1031
- wrapLines = { true }
1032
- lineProps = { { style : { wordBreak : 'break-all' , whiteSpace : 'pre-wrap' } } }
1033
- language = "python"
1034
- PreTag = "p" >
1035
- { execResult . code_generated }
1036
- </ SyntaxHighlighter >
1037
- </ > }
1038
- </ Stack >
1039
- )
1040
- } ) }
1041
- </ Stack >
1042
- </ Stack . Item >
1043
- ) }
1044
- { appStateContext ?. state . isChatHistoryOpen &&
1045
- appStateContext ?. state . isCosmosDBAvailable ?. status !== CosmosDBStatus . NotConfigured && < ChatHistoryPanel /> }
1046
- </ Stack >
1047
- ) }
1048
- < Dialog
1049
- hidden = { ! dialogVisible }
1050
- onDismiss = { hideDialog }
1051
- dialogContentProps = { {
1052
- type : DialogType . largeHeader ,
1053
- title : 'Query Parameters' ,
1054
- subText : queryParams
1055
- } }
1056
- >
1057
- </ Dialog >
771
+ This is a test.
1058
772
</ div >
1059
773
)
1060
774
}
0 commit comments