Fix small bugs.

This commit is contained in:
Haifeng Luo 2022-04-11 00:12:09 +08:00
parent 268515e83f
commit 0c3363b118
3 changed files with 12 additions and 5 deletions

View File

@ -32,14 +32,21 @@ func GetWordsetGraph(id string, clusterNumber int, distanceLimit int) *Graph {
return nil
}
if len(wordset.Vectors[0].Data) == 0 {
allZero := true
for _, vector := range wordset.Vectors {
if len(vector.Data) != 0 {
allZero = false
break
}
}
if allZero {
return nil
}
runKmeans(wordset.Vectors, clusterNumber)
g = generateGraph(wordset.Vectors, distanceLimit)
graphCache[cacheId] = g
//graphCache[cacheId] = g
return g
}

View File

@ -47,7 +47,7 @@ class WordsetGraph extends React.Component {
strength: 20,
distanceMax: 100,
clusterNumber: 100,
distanceLimit: 14,
distanceLimit: this.props.wordset.distanceLimit,
selectedType: null,
selectedId: null,
selectedIds: [],
@ -315,7 +315,7 @@ class WordsetGraph extends React.Component {
</span>
</Col>
<Col style={{marginTop: '5px', textAlign: 'center'}} span={12}>
<InputNumber style={{width: "100%"}} min={5} max={20} step={1} value={this.state.distanceLimit} onChange={value => {
<InputNumber style={{width: "100%"}} min={1} max={20} step={1} value={this.state.distanceLimit} onChange={value => {
this.setState({
distanceLimit: value,
});

View File

@ -162,7 +162,7 @@ class WordsetListPage extends React.Component {
render: (text, record, index) => {
return (
<div>
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} onClick={() => this.props.history.push(`/wordsets/${record.name}/graph`)}>{i18next.t("general:Result")}</Button>
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} onClick={() => Setting.openLink(`/wordsets/${record.name}/graph`)}>{i18next.t("general:Result")}</Button>
<Button style={{marginBottom: '10px', marginRight: '10px'}} type="primary" onClick={() => this.props.history.push(`/wordsets/${record.name}`)}>{i18next.t("general:Edit")}</Button>
<Popconfirm
title={`Sure to delete wordset: ${record.name} ?`}