|
@@ -20,22 +20,16 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
this.loading = true
|
|
|
- this.result = null
|
|
|
- let header = {
|
|
|
- 'Content-Type': 'application/json',
|
|
|
- 'Authorization': `Bearer ${api_key}`,
|
|
|
- }
|
|
|
+ this.result = []
|
|
|
let data = {
|
|
|
- inputs:{
|
|
|
- claim:this.claim
|
|
|
- },
|
|
|
- response_mode:'blocking',
|
|
|
- user:this.userinfo.id
|
|
|
+ claim:this.claim
|
|
|
}
|
|
|
this.controller = new AbortController();
|
|
|
- let res = await fetch(url + '/workflows/run', {
|
|
|
+ let res = await fetch('/api/xiaoshi/dify/generateClaimExplain', {
|
|
|
method: 'POST',
|
|
|
- headers: header,
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
+ },
|
|
|
body: JSON.stringify(data),
|
|
|
signal: this.controller.signal
|
|
|
})
|
|
@@ -51,8 +45,7 @@ export default {
|
|
|
if(chunk){
|
|
|
try{
|
|
|
let json = JSON.parse(chunk)
|
|
|
- this.result = json.data.outputs?json.data.outputs.json:{}
|
|
|
- this.saveSession(json)
|
|
|
+ this.result = json.data||[]
|
|
|
}catch(e){
|
|
|
}finally{
|
|
|
this.loading = false
|
|
@@ -76,7 +69,7 @@ export default {
|
|
|
query:{
|
|
|
claim:this.claim,
|
|
|
},
|
|
|
- answer:data.outputs?data.outputs.json:{}
|
|
|
+ answer:data.outputs?data.outputs.json:[]
|
|
|
}
|
|
|
let params = {
|
|
|
conversationId:data.id,
|