@@ -12,7 +12,7 @@ import ConfigForm from '../configForm';
12
12
import CommonChat from '../chatPreview/chatComminPage' ;
13
13
import ChoreographyHead from '../components/header' ;
14
14
import { 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' ;
16
16
import { useAppDispatch , useAppSelector } from '@/store/hook' ;
17
17
import { setInspirationOpen } from '@/store/chatStore/chatStore' ;
18
18
import { setAippId , setAppId , setAppInfo , setChoseNodeId , setValidateInfo } from '@/store/appInfo/appInfo' ;
@@ -29,6 +29,7 @@ import { RenderContext } from '@/pages/aippIndex/context';
29
29
const AippIndex = ( ) => {
30
30
const { appId, tenantId, aippId } = useParams ( ) ;
31
31
const [ showElsa , setShowElsa ] = useState ( false ) ;
32
+ const [ showConfig , setShowConfig ] = useState ( true ) ;
32
33
const [ spinning , setSpinning ] = useState ( false ) ;
33
34
const [ saveTime , setSaveTime ] = useState ( '' ) ;
34
35
const [ reloadInspiration , setReloadInspiration ] = useState ( '' ) ;
@@ -40,15 +41,35 @@ const AippIndex = () => {
40
41
const inspirationRefresh = useRef < any > ( false ) ;
41
42
const dispatch = useAppDispatch ( ) ;
42
43
const appInfo = useAppSelector ( ( state ) => state . appStore . appInfo ) ;
44
+ const pluginList = useAppSelector ( ( state ) => state . chatCommonStore . pluginList ) ;
43
45
const addFlowRef = useRef < any > ( null ) ;
44
46
const renderRef = useRef ( false ) ;
45
47
const elsaReadOnlyRef = useRef ( false ) ;
46
48
49
+ const [ pluginName , setPluginName ] = useState ( 'default' ) ;
50
+ const [ plugin , setPlugin ] = useState ( ) ;
51
+
52
+
47
53
const elsaChange = ( ) => {
48
54
setShowElsa ( ! showElsa ) ;
49
55
showElsa && getAippDetails ( true ) ;
50
56
}
51
57
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
+
52
73
useEffect ( ( ) => {
53
74
dispatch ( setAppInfo ( { } ) ) ;
54
75
dispatch ( setAppId ( appId ) ) ;
@@ -83,11 +104,20 @@ const AippIndex = () => {
83
104
res . data . hideHistory = true ;
84
105
aippRef . current = res . data ;
85
106
dispatch ( setAppInfo ( res . data ) ) ;
107
+ RefreshChatStyle ( res . data ) ;
86
108
}
87
109
} finally {
88
110
setSpinning ( false ) ;
89
111
}
90
112
}
113
+
114
+ // 基于appInfo更新对话界面
115
+ const RefreshChatStyle = ( appInfo ) => {
116
+ const appChatStyle = getAppConfig ( appInfo ) ? getAppConfig ( appInfo ) . appChatStyle : null ;
117
+ setPluginName ( appChatStyle || 'default' ) ;
118
+ } ;
119
+
120
+
91
121
// 修改aipp更新回调
92
122
const updateAippCallBack = ( partialData ) => {
93
123
if ( partialData ) {
@@ -181,9 +211,16 @@ const AippIndex = () => {
181
211
handleConfigDataChange = { handleConfigDataChange }
182
212
inspirationChange = { inspirationChange }
183
213
showElsa = { showElsa }
214
+ showConfig = { showConfig }
215
+ onChangeShowConfig = { handleChangeShowConfig }
184
216
/>
185
217
) }
186
- < CommonChat contextProvider = { contextProvider } previewBack = { changeChat } />
218
+ < CommonChat
219
+ showElsa = { showElsa }
220
+ contextProvider = { contextProvider }
221
+ previewBack = { changeChat }
222
+ pluginName = { pluginName }
223
+ />
187
224
</ div >
188
225
</ RenderContext . Provider >
189
226
</ div >
0 commit comments