yt-chat-components 2.0.8 → 2.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-chat-components",
3
- "version": "2.0.8",
3
+ "version": "2.0.10",
4
4
  "main": "build/static/js/bundle.min.js",
5
5
  "module": "build/static/js/bundle.min.js",
6
6
  "types": "build/static/js/index.d.ts",
@@ -76,9 +76,9 @@ const style = `
76
76
  width: 100vw;
77
77
  height:100vh;
78
78
  background: #fff;
79
- border-radius: 15px;
80
79
  display: flex;
81
80
  flex-direction: row;
81
+ border-radius:0;
82
82
  }
83
83
 
84
84
  .p_toolDialog .dialog_box .p_toolLogo {
@@ -150,14 +150,10 @@ const style = `
150
150
  }
151
151
 
152
152
  .p_historyDialog .p_historyListEmpty {
153
- position: absolute;
154
- top: 50%;
155
- left: 50%;
156
- transform: translate(-50%, -50%);
153
+ margin-top:80px;
157
154
  text-align: center;
158
155
  font-size: 12px;
159
156
  color: #999999;
160
- max-height: calc(100% - 1.7rem);
161
157
 
162
158
  }
163
159
 
@@ -313,16 +309,23 @@ export class ToolDialogV3 extends React.Component {
313
309
  }
314
310
 
315
311
  async componentDidMount() {
316
- const { appId: flowId,sceneId } = this.props;
317
- this.setState({ appId: flowId }, () => {
318
- this.getHistoryList(true);
312
+ const { appId: flowId, sceneId } = this.props;
313
+ this.setState({loading:true})
314
+ this.getSceneInfo()
315
+ .then(sceneInfo => {
316
+ this.setState({ appId: sceneInfo.data.flow_ids[0] }, () => {
317
+ this.getHistoryList(true);
318
+ })
319
+ }).finally(() => {
320
+ // this.setState({loading:false})
319
321
  })
320
- this.getSceneInfo();
321
322
  getFlowPage(this.props.hostUrl, api_key)
322
323
  .then(res => {
323
324
  if(res.status === 200) {
324
325
  this.setState({ allFlowList: res.data?.data_list })
325
326
  }
327
+ }).finally(() => {
328
+ this.setState({loading:false})
326
329
  })
327
330
  }
328
331
 
@@ -447,6 +450,9 @@ export class ToolDialogV3 extends React.Component {
447
450
 
448
451
  removeFromScene = (flow) => {
449
452
  const { sceneInfo } = this.state;
453
+ if(sceneInfo.flow_ids.length === 1) {
454
+ return message.error("至少需要一个对话")
455
+ }
450
456
  sceneInfo.flow_ids = sceneInfo.flow_ids.filter(item => item !== flow.id)
451
457
  modifyScene(this.props.hostUrl, api_key, sceneInfo).then(res => {
452
458
  if(res.status === 200) {
@@ -634,7 +640,7 @@ export class ToolDialogV3 extends React.Component {
634
640
  </div>
635
641
  ) : (
636
642
  <div className="p_historyListEmpty">
637
- <img src={historyListEmptyPng}/>
643
+ <img style={{ width: '160px' }} src={historyListEmptyPng}/>
638
644
  <div className="p_historyListEmptyText">暂无对话记录</div>
639
645
  </div>
640
646
  )}