Mon May 15 04:07:00 UTC 2023 inscode

上级 3ad44d2a
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
</div> </div>
</template> </template>
</div> </div>
<div class="prompt ivu-mt"> <div class="question ivu-mt">
<Input <Input
v-model="prompt" v-model="question"
type="textarea" type="textarea"
:autosize="{ minRows: 4, maxRows: 6 }" :autosize="{ minRows: 4, maxRows: 6 }"
placeholder="输入你的问题" placeholder="输入你的问题"
...@@ -26,10 +26,13 @@ ...@@ -26,10 +26,13 @@
</div> </div>
</template> </template>
<script> <script>
const token = 'Bearer ZXlKMGVYQWlPaUpLVjFRaUxDSmhiR2NpT2lKSVV6STFOaUo5LmV5SjBkQ0k2TkN3aVlYVmtJam9pTmpZME56QTNaR016TUdabU5ETTRNRGs1WkRBek9EWTFPRFV5T0RsaE0yWWlMQ0pzZFNJNklubGhibWgxYVNJc0ltVjRjQ0k2TVRZNE5UVTBPRGM1T1N3aWRYSWlPaklzSW1wMGFTSTZJa0ZRU1Y5VVQwdEZUbDgyTmpRM01EZGtZek13Wm1ZME16Z3dPVGxrTURNNE5qVTROVEk0T1dFelppMDBJbjAuejRNWE4xOHVoQmI0Y29WbHd1dm4tNzA1eG1RRHBsRE43cHA3cUxURzN0NA==';
const api = 'https://api.ai100.ai/ai/api/ai/chat';
export default { export default {
data () { data () {
return { return {
prompt: '', question: '',
loading: false, loading: false,
dialogs: [ dialogs: [
{ {
...@@ -44,10 +47,31 @@ ...@@ -44,10 +47,31 @@
} }
}, },
methods: { methods: {
handleSend () { async handleSend () {
if (this.loading) return; if (this.loading || this.question === '') return;
this.loading = true; this.loading = true;
// todo // todo
const response = await fetch(api, this.getParams());
console.log(response)
},
getParams () {
const headers = {
"Accept": "*/*",
"Authorization": token,
"Content-Type": "application/json"
}
const payload = {
prompt: '',
question: this.question,
stream: false
}
return {
method: 'POST',
headers,
body: JSON.stringify(payload)
}
}, },
handleNewChat () { handleNewChat () {
this.dialogs = []; this.dialogs = [];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册