|
@@ -13,6 +13,7 @@
|
|
@onGood="onGood"
|
|
@onGood="onGood"
|
|
@onBad="onBad"
|
|
@onBad="onBad"
|
|
@onNormal="onNormal"
|
|
@onNormal="onNormal"
|
|
|
|
+ @setText="val => setText(val.text, val.send)"
|
|
/>
|
|
/>
|
|
</template>
|
|
</template>
|
|
</template>
|
|
</template>
|
|
@@ -39,7 +40,7 @@
|
|
</div>
|
|
</div>
|
|
<div class="cibo-split"/>
|
|
<div class="cibo-split"/>
|
|
<el-tooltip content="发送" placement="top">
|
|
<el-tooltip content="发送" placement="top">
|
|
- <div class="cibo-send __hover" @click="onSend">
|
|
|
|
|
|
+ <div class="cibo-send __hover" @click="$czrUtil.isValue(state.text.trim()) ? onSend() : undefined">
|
|
<img src="@/views/smart-ask-answer/assistant/imgs/send.png"/>
|
|
<img src="@/views/smart-ask-answer/assistant/imgs/send.png"/>
|
|
</div>
|
|
</div>
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
@@ -81,11 +82,15 @@ const state: any = reactive({
|
|
const ref_text = ref()
|
|
const ref_text = ref()
|
|
const ref_chatMsg = ref()
|
|
const ref_chatMsg = ref()
|
|
const ref_auto = ref()
|
|
const ref_auto = ref()
|
|
-const onSend = () => {
|
|
|
|
|
|
+const onSend = (text) => {
|
|
state.loading = true
|
|
state.loading = true
|
|
- state.params.query = state.text + ''
|
|
|
|
|
|
+ if (text) {
|
|
|
|
+ state.params.query = text
|
|
|
|
+ } else {
|
|
|
|
+ state.params.query = state.text + ''
|
|
|
|
+ state.text = ''
|
|
|
|
+ }
|
|
emit('getText', state.params.query)
|
|
emit('getText', state.params.query)
|
|
- state.text = ''
|
|
|
|
const ask = {
|
|
const ask = {
|
|
type: 'ask',
|
|
type: 'ask',
|
|
content: state.params.query + ''
|
|
content: state.params.query + ''
|
|
@@ -156,14 +161,19 @@ const initChat = () => {
|
|
{
|
|
{
|
|
type: 'answer',
|
|
type: 'answer',
|
|
welcome: true,
|
|
welcome: true,
|
|
- content: res.opening_statement
|
|
|
|
|
|
+ content: res.opening_statement,
|
|
|
|
+ question: res.suggested_questions
|
|
},
|
|
},
|
|
]
|
|
]
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
-const setText = (text: string) => {
|
|
|
|
- state.text = text
|
|
|
|
|
|
+const setText = (text: string, send = false) => {
|
|
|
|
+ if (send) {
|
|
|
|
+ onSend(text)
|
|
|
|
+ } else {
|
|
|
|
+ state.text = text
|
|
|
|
+ }
|
|
}
|
|
}
|
|
const onGood = (item) => {
|
|
const onGood = (item) => {
|
|
updateFeedback({
|
|
updateFeedback({
|