@@ -12,7 +12,7 @@ import ConfigForm from '../configForm';
1212import CommonChat from '../chatPreview/chatComminPage' ;
1313import ChoreographyHead from '../components/header' ;
1414import { getAppInfo , updateFormInfo } from '@/shared/http/aipp' ;
15- import { debounce , getCurrentTime , getUiD , setSpaClassName } from '@/shared/utils/common' ;
15+ import { debounce , getCurrentTime , getUiD , setSpaClassName , getAppConfig } from '@/shared/utils/common' ;
1616import { useAppDispatch , useAppSelector } from '@/store/hook' ;
1717import { setInspirationOpen } from '@/store/chatStore/chatStore' ;
1818import { setAippId , setAppId , setAppInfo , setChoseNodeId , setValidateInfo } from '@/store/appInfo/appInfo' ;
@@ -29,6 +29,7 @@ import { RenderContext } from '@/pages/aippIndex/context';
2929const AippIndex = ( ) => {
3030 const { appId, tenantId, aippId } = useParams ( ) ;
3131 const [ showElsa , setShowElsa ] = useState ( false ) ;
32+ const [ showConfig , setShowConfig ] = useState ( true ) ;
3233 const [ spinning , setSpinning ] = useState ( false ) ;
3334 const [ saveTime , setSaveTime ] = useState ( '' ) ;
3435 const [ reloadInspiration , setReloadInspiration ] = useState ( '' ) ;
@@ -40,15 +41,35 @@ const AippIndex = () => {
4041 const inspirationRefresh = useRef < any > ( false ) ;
4142 const dispatch = useAppDispatch ( ) ;
4243 const appInfo = useAppSelector ( ( state ) => state . appStore . appInfo ) ;
44+ const pluginList = useAppSelector ( ( state ) => state . chatCommonStore . pluginList ) ;
4345 const addFlowRef = useRef < any > ( null ) ;
4446 const renderRef = useRef ( false ) ;
4547 const elsaReadOnlyRef = useRef ( false ) ;
4648
49+ const [ pluginName , setPluginName ] = useState ( 'default' ) ;
50+ const [ plugin , setPlugin ] = useState ( ) ;
51+
52+
4753 const elsaChange = ( ) => {
4854 setShowElsa ( ! showElsa ) ;
4955 showElsa && getAippDetails ( true ) ;
5056 }
5157
58+ const handleChangeShowConfig = ( ) => {
59+ setShowConfig ( ! showConfig ) ;
60+ } ;
61+
62+ useEffect ( ( ) => {
63+ const found = pluginList . find ( ( item : any ) => item . name === pluginName ) ;
64+ setPlugin ( found ) ;
65+ } , [ pluginList , pluginName ] ) ;
66+
67+ useEffect ( ( ) => {
68+ if ( plugin ) {
69+ setShowConfig ( false ) ;
70+ }
71+ } , [ plugin ] ) ;
72+
5273 useEffect ( ( ) => {
5374 dispatch ( setAppInfo ( { } ) ) ;
5475 dispatch ( setAppId ( appId ) ) ;
@@ -83,11 +104,20 @@ const AippIndex = () => {
83104 res . data . hideHistory = true ;
84105 aippRef . current = res . data ;
85106 dispatch ( setAppInfo ( res . data ) ) ;
107+ RefreshChatStyle ( res . data ) ;
86108 }
87109 } finally {
88110 setSpinning ( false ) ;
89111 }
90112 }
113+
114+ // 基于appInfo更新对话界面
115+ const RefreshChatStyle = ( appInfo ) => {
116+ const appChatStyle = getAppConfig ( appInfo ) ? getAppConfig ( appInfo ) . appChatStyle : null ;
117+ setPluginName ( appChatStyle || 'default' ) ;
118+ } ;
119+
120+
91121 // 修改aipp更新回调
92122 const updateAippCallBack = ( partialData ) => {
93123 if ( partialData ) {
@@ -181,9 +211,16 @@ const AippIndex = () => {
181211 handleConfigDataChange = { handleConfigDataChange }
182212 inspirationChange = { inspirationChange }
183213 showElsa = { showElsa }
214+ showConfig = { showConfig }
215+ onChangeShowConfig = { handleChangeShowConfig }
184216 />
185217 ) }
186- < CommonChat contextProvider = { contextProvider } previewBack = { changeChat } />
218+ < CommonChat
219+ showElsa = { showElsa }
220+ contextProvider = { contextProvider }
221+ previewBack = { changeChat }
222+ pluginName = { pluginName }
223+ />
187224 </ div >
188225 </ RenderContext . Provider >
189226 </ div >
0 commit comments