feat: ichat index界面
This commit is contained in:
parent
b48e263cd6
commit
8137352425
|
@ -0,0 +1,16 @@
|
||||||
|
import config from "@/config"
|
||||||
|
import http from "@/utils/request"
|
||||||
|
|
||||||
|
export default {
|
||||||
|
workchain: {
|
||||||
|
ask: {
|
||||||
|
name: "询问",
|
||||||
|
req: async function (data) {
|
||||||
|
return await http.post(
|
||||||
|
`${config.API_URL}/ichat/workchain/ask/`,
|
||||||
|
data
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
<template>
|
||||||
|
<el-container>
|
||||||
|
<el-header height="160px">
|
||||||
|
<el-input :placeholder="plh"
|
||||||
|
v-model="input" type="textarea"
|
||||||
|
:rows="4" @keyup.enter="handleAsk"></el-input>
|
||||||
|
<el-button type="primary" size="large" style="margin-left: 10px;" @click="handleAsk">提问</el-button>
|
||||||
|
</el-header>
|
||||||
|
<el-main class="nopadding">
|
||||||
|
<iframe ref="myIframe" frameborder="0" width="100%" height="100%"></iframe>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import API from '@/api/index.js'
|
||||||
|
import { ElLoading } from 'element-plus'
|
||||||
|
|
||||||
|
const plh = ref('请以 查询 开头,提出您的查询统计分析需求');
|
||||||
|
const input = ref(null);
|
||||||
|
|
||||||
|
const myIframe = ref(null);
|
||||||
|
|
||||||
|
const handleAsk = () => {
|
||||||
|
if (input.value) {
|
||||||
|
const loading = ElLoading.service({
|
||||||
|
fullscreen: true,
|
||||||
|
text: "正在查询...请稍等",
|
||||||
|
});
|
||||||
|
API.ichat.workchain.ask.req({input: input.value}).then(res=>{
|
||||||
|
myIframe.value.srcdoc = res.content;
|
||||||
|
}).catch(err=>{
|
||||||
|
}).finally(()=>{
|
||||||
|
loading.close();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in New Issue