This commit is contained in:
“yangqiao”
2025-02-16 21:27:02 +08:00
parent f912c98e16
commit 45d8686d2f
17 changed files with 127 additions and 47 deletions

View File

@@ -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
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

View File

@@ -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
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

View File

@@ -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
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

View File

@@ -1,11 +1,13 @@
<template>
<div>
<SwitchLanguage />
<!-- <CameraView /> -->
<router-view></router-view>
</div>
</template>
<script setup lang="ts">
import SwitchLanguage from "./components/SwitchLanguage.vue";
// import CameraView from "./components/CameraView/index.vue";
</script>
<style scoped>

View File

@@ -20,3 +20,16 @@ export function getModelList() {
url: `/model`
})
}
// 获取历史消息列表
export function getSessionsList() {
return request.get<ProjectListResult>({
url: `/sessions`
})
}
// 获取单条历史消息的聊天历史
export function getSessionsInfoList(session_uuid: any) {
return request.get<ProjectListResult>({
url: `/history/${session_uuid}`
})
}

View File

@@ -0,0 +1,9 @@
.camera_box {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 99;
background: rgba(0,0,0,0.4);
}

View File

@@ -0,0 +1,43 @@
<template>
<div class="camera_box">
<img :src="imgOneVal" alt="" style="width: 50vw; height: 50vh">
<img :src="imgTwoVal" alt="" style="width: 50vw; height: 50vh">
<!-- <canvas ref="cameraOne" style="width: 50vw; height: 50vh"></canvas> -->
<!-- <canvas ref="cameraTwo" style="width: 50vw; height: 50vh"></canvas> -->
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, onUnmounted } from "vue";
import useWebSocket from "../../utils/websocket";
const videoElement = ref<HTMLVideoElement | null>(null);
// const cameraOne = ref("")
// const cameraTwo = ref("");
const imgOneVal = ref("");
const imgTwoVal = ref("");
// const videoUrl = ref('');
const handleMessage = (e: any) => {
imgOneVal.value = "data:image/jpeg;base64," + e.data
};
const handleTwoMessage = (e: any) => {
imgTwoVal.value = "data:image/jpeg;base64," + e.data
};
const ws = useWebSocket(handleMessage, import.meta.env.VITE_WB_CAMERA_ONE_URL);
const wsTwo = useWebSocket(handleTwoMessage, import.meta.env.VITE_WB_CAMERA_TWO_URL);
// const ws = new WebSocket(import.meta.env.VITE_WB_CAMERA_ONE_URL)
onMounted(() => {
});
onUnmounted(() => {
if (ws) {
ws.close();
ws = null;
wsTwo.close();
wsTwo = null;
}
});
</script>
<style scoped>
@import "./index.less";
</style>

View File

@@ -18,8 +18,9 @@
>
<div class="title">
<img src="../../assets/logo.png" alt="" />
<span v-if="item.group_name === 'Planner'">{{generateTitle('角色')}}{{ item.group_name }}</span>
<span v-else>{{generateTitle('模型名称')}}{{ `${item.group_name}: ${item.agent_name}` }}</span>
<span v-if="item.source === 'Planner'">{{generateTitle('角色')}}{{ item.source }}</span>
<span v-else>{{generateTitle('模型名称')}}{{ `${item.source}` }}</span>
<!-- <span v-else>{{generateTitle('模型名称')}}{{ `${item.source}: ${item.agent_name}` }}</span> -->
<p
class="active_item"
v-if="reasonStatus.index === index && reasonStatus.show"

View File

@@ -13,8 +13,9 @@
@click="toContent(index, num)"
v-for="(key, num) in item.children"
:key="num"
style="width: 100%;"
>
<div v-if="key.group_name !== 'Planner'" class="li">
<div v-if="key.source !== 'Planner'" class="li">
<div
class="p-box"
:class="{
@@ -31,7 +32,8 @@
src="../assets/layout/vector.png"
alt=""
/>
<span>{{ `${key.group_name?key.group_name+':':''} ${key.agent_name}` }}</span>
<span>{{ `${key.source || ''}` }}</span>
<!-- <span>{{ `${key.source?key.source+':':''} ${key.agent_name}` }}</span> -->
</div>
<img
class="next"

View File

@@ -1,7 +1,7 @@
<template>
<div class="textarea-content">
<el-input
v-model="chatData.message"
v-model="chatData.content"
@keydown="handleKeydown"
:placeholder="generateTitle('在此输入您的问题或需求有问必答Shift+Enter换行')"
type="textarea"
@@ -38,14 +38,14 @@ const props = defineProps({
})
const chatData = ref<any>({
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({

View File

@@ -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;

View File

@@ -21,7 +21,7 @@
<img src="../../assets/logo.png" alt="" />
<span v-show="isCollapse">Jayson</span>
</div> -->
<div class="chart-box" v-show="isCollapse">
<!-- <div class="chart-box" v-show="isCollapse">
<div class="body-box">
<div class="out-round-list">
<div
@@ -87,7 +87,7 @@
</div>
</div>
</div>
</div>
</div> -->
</div>
</div>
</div>

View File

@@ -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();
}

View File

@@ -40,13 +40,15 @@ const recommendList = ref<Array<any>>([
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(() => {})
</script>

View File

@@ -27,7 +27,7 @@
}
}
.message-box {
.content-box {
width: calc(100% - 48px);
padding-top: 30px;

View File

@@ -13,7 +13,7 @@
:reasoningList="reasoningList"
/>
</div>
<div class="message-box">
<div class="content-box">
<div class="tip-box">
<p class="active_item">
<el-icon size="6" color="#fff"><Plus /></el-icon>
@@ -65,7 +65,7 @@ const reasoningList = ref<Array<any>>([]);
// }
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<any>(null);

View File

@@ -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')
}