From 58403f3fb8e49b9a54d1c02660e003dae6b0dfe9 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 5 Aug 2025 14:24:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20ichat=E8=8E=B7=E5=8F=96=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/model/ichat.js | 8 ++++++++ src/views/ichat/index.vue | 35 ++++++++++++++++++++++++++++------- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/api/model/ichat.js b/src/api/model/ichat.js index 84b67b00..185a6e44 100644 --- a/src/api/model/ichat.js +++ b/src/api/model/ichat.js @@ -11,6 +11,14 @@ export default { data ); } + }, + get: { + name: "获取结果", + req: async function (tid) { + return await http.get( + `${config.API_URL}/ichat/workchain/ask/?ichat_tid=${tid}` + ); + } } } } \ No newline at end of file diff --git a/src/views/ichat/index.vue b/src/views/ichat/index.vue index f40d4cf4..01f3858d 100644 --- a/src/views/ichat/index.vue +++ b/src/views/ichat/index.vue @@ -7,7 +7,16 @@ 提问 - + + +
+

{{step.msg}}

+
+
+ + + +
@@ -20,19 +29,31 @@ const plh = ref('请以 查询 开头,提出您的查询统计分析需求'); const input = ref(null); const myIframe = ref(null); +const ichatTid = ref(null); +const steps = ref([]); 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; + ichatTid.value = res.ichat_tid; + getTaskStatus(); }).catch(err=>{ }).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); +} \ No newline at end of file