From f74f264d875b003730484f3fe7cb242c7f91294e Mon Sep 17 00:00:00 2001 From: zhangxiao <898441624@qq.com> Date: 星期四, 15 八月 2024 17:32:55 +0800 Subject: [PATCH] fix: 模型管理代码修改 --- src/views/sessionManager/components/agentSession.vue | 75 +++++++++++++++++++------------------ 1 files changed, 38 insertions(+), 37 deletions(-) diff --git a/src/views/sessionManager/components/agentSession.vue b/src/views/sessionManager/components/agentSession.vue index 53aaf45..5018c67 100644 --- a/src/views/sessionManager/components/agentSession.vue +++ b/src/views/sessionManager/components/agentSession.vue @@ -2,7 +2,7 @@ <!-- 鍐呭--> <a-scrollbar ref="scrollbar" - id="home" + id="agentHome" class="chat-list" style=" width: 90%; @@ -153,7 +153,9 @@ title: agentObj.title, dsl: agentObj.dsl, }); - if (res.code === 200) { + console.log(res,'agentSet'); + if (res.code == 0) { + // sessionDetailList.value = res.data.dsl.messages; // Message.success('淇敼鎴愬姛'); } } @@ -187,30 +189,30 @@ .pipeThrough(new EventSourceParserStream()) .getReader(); currIndex.value = 0; - while (true) { - const x = await reader?.read(); - if (x) { - const { done, value } = x; - console.log(x, 999); - try { - const val = JSON.parse(value?.data || ''); - const d = val?.data; - if (typeof d !== 'boolean') { - console.info('data:', d); - streamStr.value = d.content; - startDisplayStr(); - } - } catch (e) { - console.warn(e); - } - if (done) { - console.info('done'); - displayedText.value = ''; - queryAgentSessionDetail(agentObj.id); - break; - } - } - } + // while (true) { + // const x = await reader?.read(); + // if (x) { + // const { done, value } = x; + // console.log(x, 999); + // try { + // const val = JSON.parse(value?.data || ''); + // const d = val?.data; + // if (typeof d !== 'boolean') { + // console.info('data:', d); + // streamStr.value = d.content; + // startDisplayStr(); + // } + // } catch (e) { + // console.warn(e); + // } + // if (done) { + // console.info('done'); + // displayedText.value = ''; + // queryAgentSessionDetail(agentObj.id); + // break; + // } + // } + // } chatDis.value = false; loading.value = false; inputMsg.value = ''; @@ -222,7 +224,7 @@ if (code == 0) { console.log(data,'浼氳瘽璇︽儏'); sessionDetailList.value = data.dsl.messages; - // refreshScroll(); //鍒锋柊婊氬姩鏉′綅缃� + refreshScroll(); //鍒锋柊婊氬姩鏉′綅缃� } }; @@ -243,12 +245,12 @@ chatDis.value = true; loading.value = true; - if (!activeSessionId.value) { - Message.warning('璇烽�夋嫨浼氳瘽'); - chatDis.value = false; - loading.value = false; - return; - } + // if (!agentObj.id) { + // Message.warning('璇烽�夋嫨浼氳瘽'); + // chatDis.value = false; + // loading.value = false; + // return; + // } // if (displayedText.value) { // querySessionList(); @@ -270,8 +272,8 @@ 'Content-Type': 'application/json', }, body: JSON.stringify({ - conversation_id: activeSessionId.value, - messages: inputMsg.value, + id: agentObj.id, + message: inputMsg.value, }), } ); @@ -345,7 +347,7 @@ const scrollbar = ref(null); const refreshScroll = () => { nextTick(() => { - const container = document.getElementById('home'); + const container = document.getElementById('agentHome'); scrollbar.value.scrollTop(container.scrollHeight); }); }; @@ -358,7 +360,6 @@ watch( () => props.modalObj, (newVal, oldVal) => { - console.log(newVal,'鐩戝惉鍙樺寲'); Object.assign(agentObj, newVal); //璋冪敤agent鍒濆鍖栨柟娉� if(JSON.stringify(newVal) != '{}'){ -- Gitblit v1.8.0