|
|
|
@ -3,64 +3,60 @@ |
|
|
|
|
<div class="text"> |
|
|
|
|
{{ text }} |
|
|
|
|
</div> |
|
|
|
|
<input type="text" :value="value" /> |
|
|
|
|
<input type="text" v-model="value" /> |
|
|
|
|
<button @click="queryClick">点击发送</button> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import axios from 'axios'; |
|
|
|
|
import axios from "axios"; |
|
|
|
|
export default { |
|
|
|
|
components: {}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
text: '', |
|
|
|
|
value: '', |
|
|
|
|
text: "", |
|
|
|
|
value: "", |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
computed: {}, |
|
|
|
|
onShow() {}, |
|
|
|
|
methods: { |
|
|
|
|
async query(data) { |
|
|
|
|
// axios.defaults.headers.post['Access-Control-Allow-Origin'] = '*'; |
|
|
|
|
// axios.post('/api/v1/prediction/cf4f7471-7301-4bd6-aaa3-87c16e615b84', JSON.stringify(data), { |
|
|
|
|
// headers: { |
|
|
|
|
// 'Authorization': 'Bearer ZT1v19tYfMb4+2Y6VX7gtf9oacNEy6J03SabP8yfa6w=', |
|
|
|
|
// 'Content-Type': 'application/json', |
|
|
|
|
// } |
|
|
|
|
// }).then(function (resp) { |
|
|
|
|
// console.log(resp) |
|
|
|
|
// }).catch(function (error) { |
|
|
|
|
// console.log(error); |
|
|
|
|
// }) |
|
|
|
|
// axios |
|
|
|
|
// .post('v1/prediction/cf4f7471-7301-4bd6-aaa3-87c16e615b84', JSON.stringify(data), { |
|
|
|
|
// headers: { |
|
|
|
|
// 'Authorization': 'Bearer ZT1v19tYfMb4+2Y6VX7gtf9oacNEy6J03SabP8yfa6w=', |
|
|
|
|
// 'Content-Type': 'application/json', |
|
|
|
|
// }, |
|
|
|
|
// }) |
|
|
|
|
|
|
|
|
|
// .then(function (response) { |
|
|
|
|
// console.log(response); |
|
|
|
|
// }) |
|
|
|
|
// .catch(function (error) { |
|
|
|
|
// console.log(error); |
|
|
|
|
// }); |
|
|
|
|
const response = await fetch('/api/v1/prediction/cf4f7471-7301-4bd6-aaa3-87c16e615b84', { |
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
async function query(data) { |
|
|
|
|
const response = await fetch("https://flowise.tsl3060.com/api/v1/prediction/cf4f7471-7301-4bd6-aaa3-87c16e615b84", { |
|
|
|
|
headers: { |
|
|
|
|
'Authorization': 'Bearer ZT1v19tYfMb4+2Y6VX7gtf9oacNEy6J03SabP8yfa6w=', |
|
|
|
|
'Content-Type': 'application/json', |
|
|
|
|
Authorization: "Bearer ZT1v19tYfMb4+2Y6VX7gtf9oacNEy6J03SabP8yfa6w=", |
|
|
|
|
"Content-Type": "application/json" |
|
|
|
|
}, |
|
|
|
|
method: 'POST', |
|
|
|
|
body: JSON.stringify(data), |
|
|
|
|
method: "POST", |
|
|
|
|
body: JSON.stringify(data) |
|
|
|
|
}); |
|
|
|
|
const result = await response.json(); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
methods: { |
|
|
|
|
async query(data) { |
|
|
|
|
axios |
|
|
|
|
.post(`/api/v1/prediction/cf4f7471-7301-4bd6-aaa3-87c16e615b84`, data, { |
|
|
|
|
headers: { |
|
|
|
|
Authorization: |
|
|
|
|
"Bearer ZT1v19tYfMb4+2Y6VX7gtf9oacNEy6J03SabP8yfa6w=", |
|
|
|
|
"Content-Type": "application/json", |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
.then((response) => { |
|
|
|
|
console.log(response.data.text); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
queryClick() { |
|
|
|
|
let msg = this.query('hello'); |
|
|
|
|
console.log(msg); |
|
|
|
|
const _this = this; |
|
|
|
|
this.query({ |
|
|
|
|
question: _this.value, |
|
|
|
|
}).then((response) => { |
|
|
|
|
console.log(response); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|