From 45d8686d2f8ab872465234f18f69831b6cafcdab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyangqiao=E2=80=9D?= <“3083813177@qq.com”> Date: Sun, 16 Feb 2025 21:27:02 +0800 Subject: [PATCH] pagedit --- frontend/.env | 6 ++- frontend/.env.development | 4 +- frontend/.env.prod | 4 +- frontend/src/App.vue | 2 + frontend/src/api/user.ts | 13 ++++++ frontend/src/components/CameraView/index.less | 9 ++++ frontend/src/components/CameraView/index.vue | 43 +++++++++++++++++++ .../src/components/ReasoningView/index.vue | 5 ++- frontend/src/components/StepsView.vue | 6 ++- frontend/src/components/TextareaView.vue | 14 +++--- .../src/components/collapseView/index.less | 3 +- .../src/components/collapseView/index.vue | 4 +- frontend/src/utils/websocket.ts | 4 +- frontend/src/view/home/index.vue | 10 +++-- frontend/src/view/reasoning/index.less | 2 +- frontend/src/view/reasoning/index.vue | 43 ++++++++++--------- frontend/vite.config.ts | 2 +- 17 files changed, 127 insertions(+), 47 deletions(-) create mode 100644 frontend/src/components/CameraView/index.less create mode 100644 frontend/src/components/CameraView/index.vue diff --git a/frontend/.env b/frontend/.env index 6719e82..2727fcc 100755 --- a/frontend/.env +++ b/frontend/.env @@ -1,6 +1,8 @@ # 打包路径 VITE_BASE_URL = / VITE_IS_REQUEST_PROXY = true -VITE_API_URL = http://47.121.220.134 +VITE_API_URL = http://159.75.70.95 VITE_API_URL_PREFIX = /matagent -VITE_WB_BASE_URL = ws://47.121.220.134:8000/matagent/chat \ No newline at end of file +VITE_WB_BASE_URL = ws://8.210.37.238:8000/ws/chat +VITE_WB_CAMERA_ONE_URL = ws://159.75.70.95:8000/video_stream/camera1 +VITE_WB_CAMERA_TWO_URL = ws://159.75.70.95:8000/video_stream/camera2 \ No newline at end of file diff --git a/frontend/.env.development b/frontend/.env.development index b047a66..faa2c0f 100755 --- a/frontend/.env.development +++ b/frontend/.env.development @@ -3,4 +3,6 @@ VITE_BASE_URL = / VITE_IS_REQUEST_PROXY = true VITE_API_URL = http://159.75.91.126 VITE_API_URL_PREFIX = /matagent -VITE_WB_BASE_URL = ws://47.121.220.134:8000/matagent/chat \ No newline at end of file +VITE_WB_BASE_URL = ws://8.210.37.238:8000/ws/chat +VITE_WB_CAMERA_ONE_URL = ws://159.75.70.95:8000/video_stream/camera1 +VITE_WB_CAMERA_TWO_URL = ws://159.75.70.95:8000/video_stream/camera2 diff --git a/frontend/.env.prod b/frontend/.env.prod index b047a66..d231c60 100755 --- a/frontend/.env.prod +++ b/frontend/.env.prod @@ -3,4 +3,6 @@ VITE_BASE_URL = / VITE_IS_REQUEST_PROXY = true VITE_API_URL = http://159.75.91.126 VITE_API_URL_PREFIX = /matagent -VITE_WB_BASE_URL = ws://47.121.220.134:8000/matagent/chat \ No newline at end of file +VITE_WB_BASE_URL = ws://47.121.220.134:8000/matagent/chat +VITE_WB_CAMERA_ONE_URL = ws://159.75.70.95:8000/video_stream/camera1 +VITE_WB_CAMERA_TWO_URL = ws://159.75.70.95:8000/video_stream/camera2 \ No newline at end of file diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 1d79ff4..62bc35e 100755 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,11 +1,13 @@ diff --git a/frontend/src/components/ReasoningView/index.vue b/frontend/src/components/ReasoningView/index.vue index a5bb272..a023518 100755 --- a/frontend/src/components/ReasoningView/index.vue +++ b/frontend/src/components/ReasoningView/index.vue @@ -18,8 +18,9 @@ >
- {{generateTitle('角色')}}({{ item.group_name }}) - {{generateTitle('模型名称')}}({{ `${item.group_name}: ${item.agent_name}` }}) + {{generateTitle('角色')}}({{ item.source }}) + {{generateTitle('模型名称')}}({{ `${item.source}` }}) +

-

+
- {{ `${key.group_name?key.group_name+':':''} ${key.agent_name}` }} + {{ `${key.source || ''}` }} +
({ - chat_id: '', - message: '' + // chat_id: '', + content: '' }) //如何在室温条件下合成CsPbBr3 const disableStatus = ref(false) const emits = defineEmits(['submitFun']) const submitFun = async () => { - if (!chatData.value.message) { + if (!chatData.value.content) { ElMessage.error('请输入问题') return } @@ -53,11 +53,11 @@ const submitFun = async () => { ElMessage.error('回答输出中,暂不能再次提问') return } - chatData.value.chat_id = new Date().getTime() + // chatData.value.chat_id = new Date().getTime() emits('submitFun', JSON.stringify(chatData.value)) chatData.value = { - chat_id: '', - message: '' + // chat_id: '', + content: '' } } defineExpose({ diff --git a/frontend/src/components/collapseView/index.less b/frontend/src/components/collapseView/index.less index f15d873..c57021a 100755 --- a/frontend/src/components/collapseView/index.less +++ b/frontend/src/components/collapseView/index.less @@ -9,7 +9,8 @@ .collapse-demo { width: 36px; - height: calc(100% - 260px); + height: 100%; + // height: calc(100% - 260px); background: #093e7a; border: 1px solid rgba(2, 83, 137, 1); padding: 12px; diff --git a/frontend/src/components/collapseView/index.vue b/frontend/src/components/collapseView/index.vue index 3fb767e..5419f6f 100755 --- a/frontend/src/components/collapseView/index.vue +++ b/frontend/src/components/collapseView/index.vue @@ -21,7 +21,7 @@ Jayson
--> -
+
diff --git a/frontend/src/utils/websocket.ts b/frontend/src/utils/websocket.ts index 5ae2b84..53f2e1f 100755 --- a/frontend/src/utils/websocket.ts +++ b/frontend/src/utils/websocket.ts @@ -1,5 +1,5 @@ -function useWebsocket(handleMessage: any) { - const ws = new WebSocket(import.meta.env.VITE_WB_BASE_URL) +function useWebsocket(handleMessage: any,url: any) { + const ws = new WebSocket(url||import.meta.env.VITE_WB_BASE_URL) const init = () => { bindEvent(); } diff --git a/frontend/src/view/home/index.vue b/frontend/src/view/home/index.vue index 997cd11..eb76e55 100755 --- a/frontend/src/view/home/index.vue +++ b/frontend/src/view/home/index.vue @@ -40,13 +40,15 @@ const recommendList = ref>([ const router = useRouter() const submitFun = (e: any) => { let data = { - chat_id: new Date().getTime(), - message: e + // chat_id: new Date().getTime(), + // message: e + content: e, + source: "user" } - router.push('/reasoning?message=' + JSON.stringify(data)) + router.push('/reasoning?content=' + JSON.stringify(data)) } const reasoningFun = (e: any) => { - router.push('/reasoning?message=' + e) + router.push('/reasoning?content=' + e) } onMounted(() => {}) diff --git a/frontend/src/view/reasoning/index.less b/frontend/src/view/reasoning/index.less index 04fe772..10f9517 100755 --- a/frontend/src/view/reasoning/index.less +++ b/frontend/src/view/reasoning/index.less @@ -27,7 +27,7 @@ } } - .message-box { + .content-box { width: calc(100% - 48px); padding-top: 30px; diff --git a/frontend/src/view/reasoning/index.vue b/frontend/src/view/reasoning/index.vue index b075a5d..72efacb 100755 --- a/frontend/src/view/reasoning/index.vue +++ b/frontend/src/view/reasoning/index.vue @@ -13,7 +13,7 @@ :reasoningList="reasoningList" />
-
+

@@ -65,7 +65,7 @@ const reasoningList = ref>([]); // } const submitFun = (val: any) => { completeFun(); - addMode(JSON.parse(val).message); + addMode(JSON.parse(val).content); ws.send(val); }; const addMode = (val: any) => { @@ -91,33 +91,34 @@ const handleMessage = (e: any) => { const endStatus = ref(false); const getMessage = async (e: any) => { reasoningRef.value.reasonStatus.show = true; - console.log(JSON.parse(e), "e::"); let data = JSON.parse(e); - let list = reasoningList.value[reasoningList.value.length - 1].children; - let status = list.filter((key: any) => key.group_name === data.group_name && - key.agent_name === data.agent_name)[0] - if (list.length && status && status.agent_name) { - for (let i = 0; i < list.length; i++) { - const item = list[i]; - if ( - item.group_name === data.group_name && - item.agent_name === data.agent_name - ) { - item.content += data.content; + if (data.content) { + let list = reasoningList.value[reasoningList.value.length - 1].children; + let status = list.filter( + (key: any) => + key.group_name === data.group_name && key.agent_name === data.agent_name + )[0]; + if (list.length && status && status.agent_name) { + for (let i = 0; i < list.length; i++) { + const item = list[i]; + if ( + item.group_name === data.group_name && + item.agent_name === data.agent_name + ) { + item.content += data.content; + } } + } else { + list.push(JSON.parse(e)); } - } else { - list.push( - JSON.parse(e) - ); } }; -const ws = useWebSocket(handleMessage); +const ws = useWebSocket(handleMessage,''); const sendFun = () => { setTimeout(() => { - addMode(JSON.parse(route.query.message).message); + addMode(JSON.parse(route.query.content).content); completeFun(); - ws.send(JSON.stringify(route.query.message)); + ws.send(route.query.content); }, 300); }; const container = ref(null); diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index a14cc32..1666705 100755 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -8,7 +8,7 @@ export default defineConfig({ host: '0.0.0.0', proxy: { '/matagent': { - target: 'http://47.121.220.134:8000', + target: 'http://159.75.91.126:8000', changeOrigin: true, rewrite: (path) => path.replace(/^\/matagent/, '/matagent') }