Compare commits
No commits in common. "ceea2e2674daf1e95e55f032debe61c194126cd1" and "4c8a3b0cc2516f215d5a88da344de849002c5fb7" have entirely different histories.
ceea2e2674
...
4c8a3b0cc2
|
|
@ -11,14 +11,6 @@ export default {
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
get: {
|
|
||||||
name: "获取结果",
|
|
||||||
req: async function (tid) {
|
|
||||||
return await http.get(
|
|
||||||
`${config.API_URL}/ichat/workchain/ask/?ichat_tid=${tid}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7,16 +7,7 @@
|
||||||
<el-button type="primary" size="large" style="margin-left: 10px;" @click="handleAsk">提问</el-button>
|
<el-button type="primary" size="large" style="margin-left: 10px;" @click="handleAsk">提问</el-button>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main class="nopadding">
|
<el-main class="nopadding">
|
||||||
<el-container>
|
<iframe ref="myIframe" frameborder="0" width="100%" height="100%"></iframe>
|
||||||
<el-aside width="200px">
|
|
||||||
<div style="margin-left:4px; font-size:16px">
|
|
||||||
<p v-for="step in steps" :key="step.id">{{step.msg}}</p>
|
|
||||||
</div>
|
|
||||||
</el-aside>
|
|
||||||
<el-main class="nopadding">
|
|
||||||
<iframe ref="myIframe" width="100%" height="100%" frameborder="0"></iframe>
|
|
||||||
</el-main>
|
|
||||||
</el-container>
|
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -29,31 +20,19 @@ const plh = ref('请以 查询 开头,提出您的查询统计分析需求');
|
||||||
const input = ref(null);
|
const input = ref(null);
|
||||||
|
|
||||||
const myIframe = ref(null);
|
const myIframe = ref(null);
|
||||||
const ichatTid = ref(null);
|
|
||||||
const steps = ref([]);
|
|
||||||
|
|
||||||
const handleAsk = () => {
|
const handleAsk = () => {
|
||||||
if (input.value) {
|
if (input.value) {
|
||||||
|
const loading = ElLoading.service({
|
||||||
|
fullscreen: true,
|
||||||
|
text: "正在查询...请稍等",
|
||||||
|
});
|
||||||
API.ichat.workchain.ask.req({input: input.value}).then(res=>{
|
API.ichat.workchain.ask.req({input: input.value}).then(res=>{
|
||||||
ichatTid.value = res.ichat_tid;
|
myIframe.value.srcdoc = res.content;
|
||||||
getTaskStatus();
|
|
||||||
}).catch(err=>{
|
}).catch(err=>{
|
||||||
}).finally(()=>{
|
}).finally(()=>{
|
||||||
|
loading.close();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getTaskStatus = () => {
|
|
||||||
const interval = setInterval(() => {
|
|
||||||
API.ichat.workchain.get.req(ichatTid.value).then(res=>{
|
|
||||||
steps.value = res.steps;
|
|
||||||
if(res.state == "done"){
|
|
||||||
myIframe.value.srcdoc = res.content;
|
|
||||||
}
|
|
||||||
if (res.state != "progress") {
|
|
||||||
clearInterval(interval);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, 2000);
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue