From 2ed941d917034fe0feabefece21079bbdabb9b29 Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期四, 15 八月 2024 19:06:07 +0800
Subject: [PATCH] 新版UI对话页面开发
---
src/views/sessionManager/style/layout.css | 10
src/views/sessionManager/components/smartAi.vue | 201 +++++++++++++++
src/views/sessionManager/components/chatMenu.vue | 22
src/views/sessionManager/index.vue | 247 +++++++-----------
src/views/sessionManager/components/historySession.vue | 248 +++++++++++++++++++
5 files changed, 563 insertions(+), 165 deletions(-)
diff --git a/src/views/sessionManager/components/chatMenu.vue b/src/views/sessionManager/components/chatMenu.vue
index 3f0ce14..f0fc1d0 100644
--- a/src/views/sessionManager/components/chatMenu.vue
+++ b/src/views/sessionManager/components/chatMenu.vue
@@ -4,22 +4,28 @@
<div class="myAgent___djnd_ myAgentAnim myAgentlight___yK7Gk">
<!-- <div data-testid="msh-sidebar-main" class="myAgentHome___PG6IZ"></div>-->
<div class="myAgentLine___Isl6E"></div>
- <div class="myAgentTool___Y1_mC" data-testid="msh-sidebar-new">
+ <div class="myAgentTool___Y1_mC" data-testid="msh-sidebar-new" @click="()=>{
+ EventBus.emit('newChat')
+ }">
<div class="myAgentToolIcon___gaAKI myAgentToolIconNew___DBZrW">
<img
src="../../../assets/images/talkbg.svg"
style="width: 24px"
alt=""></div>
</div>
- <div data-testid="msh-sidebar-history" class="myAgentTool___Y1_mC">
- <div class="myAgentToolIcon___gaAKI myAgentToolIconHistory___GTLWk">
+ <div data-testid="msh-sidebar-history" class="myAgentTool___Y1_mC" @click="()=>{
+ EventBus.emit('history')
+ }">
+ <div class="myAgentToolIcon___gaAKI myAgentToolIconHistory___GTLWk" >
<img
src="../../../assets/images/history.svg"
style="width: 24px"
alt="">
</div>
</div>
- <div data-testid="msh-sidebar-square" class="myAgentTool___Y1_mC myAgentToolSquare___dbLm1">
+ <div data-testid="msh-sidebar-square" class="myAgentTool___Y1_mC myAgentToolSquare___dbLm1" @click="()=>{
+ EventBus.emit('smartAi')
+ }">
<div class="myAgentToolIcon___gaAKI myAgentToolIconSquare___Rj1o_"><img
src="../../../assets/images/agentbg.svg"
style="width: 24px"
@@ -101,13 +107,7 @@
import { computed, nextTick, onMounted, watch, reactive, ref } from "vue";
import { Message } from "@arco-design/web-vue";
-import { EventSourceParserStream } from "eventsource-parser/stream";
-import {
- chatApi,
- getDialogListApi,
- getSessionDetailsApi,
- sessionListApi
-} from "@/api/session";
+import EventBus from '@/utils/EventBus';
</script>
<style scoped lang="less">
diff --git a/src/views/sessionManager/components/historySession.vue b/src/views/sessionManager/components/historySession.vue
new file mode 100644
index 0000000..c355dce
--- /dev/null
+++ b/src/views/sessionManager/components/historySession.vue
@@ -0,0 +1,248 @@
+<template>
+ <div class="layoutHisCenter">
+ <a-button
+ type="primary"
+ status="danger"
+ style="
+ position: absolute;
+ top: 10px;
+ left: -40px;
+ font-size: 30px;
+ z-index: 9999;
+ cursor: pointer"
+ @click="emit('changeAgentType','1')"
+ >
+ <template #icon>
+ <icon-close style="font-size: 20px" />
+ </template>
+ </a-button>
+
+ <a-scrollbar
+ class="left-list"
+ style="
+ height: calc(100vh - 100px);
+ overflow-y: auto;
+ overflow-x: hidden;
+ "
+ >
+ <div class="historyTitle___F_iam">鍘嗗彶浼氳瘽</div>
+
+
+ <div class="search">
+<!-- 鏌ヨ妗�-->
+ <div class="search-box">
+ <icon-search />
+ <a-input
+ placeholder="鎼滅储鍘嗗彶浼氳瘽"
+ v-model="searchValue"
+ style="width: 90%;"
+ />
+ </div>
+
+ </div>
+
+
+ <div class="historyCenter">
+ <div
+ class="item historyCenter-box"
+ v-for="session in sessionList"
+ @click="querySessionDetail(session)"
+ >
+ <div class="text" >
+ <img
+ :style="{ width: '16px' }"
+ alt="dessert"
+ :src="session.avatar || imgSrc"
+ />
+ {{ session.name }}
+ </div>
+ <div class="time"
+ >{{
+ moment(new Date(session.create_time)).format(
+ 'YYYY-MM-DD HH:mm:ss'
+ )
+ }}
+ </div>
+ </div>
+ </div>
+ </a-scrollbar>
+ </div>
+</template>
+<script setup lang="ts">
+import {
+ IconClose,
+ IconSearch,
+ IconTiktokColor
+} from "@arco-design/web-vue/es/icon";
+import { useAppStore, useUserStore } from "@/store";
+import { computed, nextTick, onMounted, watch, reactive, ref, onBeforeMount, onBeforeUnmount } from "vue";
+
+import { Message } from "@arco-design/web-vue";
+import EventBus from '@/utils/EventBus';
+import moment from "moment";
+import {
+ addSessionApi,
+ chatApi,
+ getDialogListApi,
+ getSessionDetailsApi,
+ sessionListApi
+} from "@/api/session";
+import { queryCanvasList } from "@/api/Agent";
+const emit = defineEmits(["querySessionDetail","changeAgentType"]);
+import logo from "@/assets/images/model.png";
+const sessionList = ref([]); //浼氳瘽鍒楄〃
+const activeSessionId = ref("");
+const fieldNames = { value: "id", label: "name" };
+const dialogs = ref([]);
+const dialogObj = reactive({});
+const agentObj = reactive({});
+const agentList = ref([]);
+const searchValue = ref("");
+const selectValue = ref("");
+const sectionList = ref({});
+const imgSrc = ref(logo);
+const DialogList = async () => {
+ const { code, data } = await getDialogListApi();
+ if (code === 200) {
+ if (data) {
+ selectValue.value = data[0].id;
+ dialogs.value = data.map((item) => {
+ return {
+ ...item,
+ type: 1 //鏅鸿兘浣�
+ };
+ });
+ // console.log(data, "dialogs");
+ queryCanvas();
+ }
+ }
+};
+
+const queryCanvas = async (params = {}) => {
+ try {
+ const { data } = await queryCanvasList(params);
+ console.log(data, "agent");
+ agentList.value = data.map((item) => {
+ return {
+ ...item,
+ name: item.title,
+ type: 2 //agent
+ };
+ });
+ // 鍚堝苟鏁扮粍
+ dialogs.value = dialogs.value.concat(agentList.value);
+
+ // 鍒ゆ柇褰撳墠鏄櫤鑳戒綋鎴朼gent
+ // console.log(val, 'val');
+ // if (dialogs.value.length > 0) {
+ // dialogChange(dialogs.value[0].id);
+ // }
+ //鏂板缓浼氳瘽
+ querySessionList(dialogs.value[0].id);
+
+
+ } catch (err) {
+ // you can report use errorHandler or other
+ } finally {
+ }
+};
+
+
+// 鏌ヨ浼氳瘽鍒楄〃
+const querySessionList = async (id) => {
+ const { code, data } = await sessionListApi(id);
+ if (code === 200) {
+ sessionList.value = data;
+
+
+
+ } else {
+ Message.warning("鏌ヨ澶辫触");
+ }
+};
+
+
+const querySessionDetail = async (session) => {
+ console.log(session, 'session');
+ emit('changeAgentType','1');
+ emit('querySessionDetail',session);
+}
+onBeforeMount(()=>{
+ DialogList()
+})
+
+onMounted(() => {
+ EventBus.on("history", () => {
+ emit('changeAgentType','3');
+ DialogList()
+
+ });
+})
+onBeforeUnmount(() => {
+ EventBus.off("history");
+});
+
+
+</script>
+<style scoped lang="less">
+ .layoutHisCenter{
+ width: 100%;
+ //background: #999999;
+ position: absolute;
+ left: 0;
+ top: 0;
+ .historyTitle___F_iam {
+ font-size: 36px;
+ line-height: 50px;
+ font-weight: 700;
+ text-align: center;
+ }
+ .search{
+ width: 100%;
+ .search-box{
+ width: 70%;
+ margin-left: 15%;
+ border: 1px solid var(--color-text-4);
+ padding: 10px;
+ border-radius: 12px;
+ background: var(--color-bg-2);
+ margin-top: 20px;
+ margin-bottom: 20px;
+ :deep(.arco-input-wrapper){
+ border: none;
+ background: var(--color-bg-2);
+ }
+ }
+ }
+ .historyCenter{
+ width: 100%;
+ margin-top: 30px;
+ .historyCenter-box{
+ display: flex;
+ width: 70%;
+ margin-left: 15%;
+ //border: 1px solid var(--color-text-4);
+ padding: 16px;
+ border-radius: 12px;
+ background: var(--color-bg-2);
+ margin-top: 10px;
+ cursor: pointer;
+ justify-content: space-between;
+ align-items: center;
+ }
+ .historyCenter-box:hover{
+ color: #2a2a2b;
+ border: 1px solid var(--color-neutral-3);
+ //background: #e8e8ea;
+ box-shadow: 0 1px 2px -2px rgba(0, 0, 0, 0.16), 0 3px 6px 0 rgba(0, 0, 0, 0.12), 0 5px 12px 4px rgba(0, 0, 0, 0.09);
+ }
+ }
+
+
+
+
+ }
+
+
+
+</style>
diff --git a/src/views/sessionManager/components/smartAi.vue b/src/views/sessionManager/components/smartAi.vue
new file mode 100644
index 0000000..26b3555
--- /dev/null
+++ b/src/views/sessionManager/components/smartAi.vue
@@ -0,0 +1,201 @@
+<template>
+ <div class="layoutHisCenter">
+ <a-scrollbar
+ class="left-list"
+ style="
+ height: calc(100vh - 100px);
+ overflow-y: auto;
+ overflow-x: hidden;
+ "
+ >
+ <div class="historyCenter">
+ <div
+ class="item historyCenter-box"
+ v-for="item in dialogs"
+ @click="querySessionDetail(item)"
+ >
+ <div class="text" >
+ <img
+ :style="{ width: '16px' }"
+ alt="dessert"
+ :src="item.avatar || imgSrc"
+ />
+ {{ item.name }}
+ </div>
+ <div class="time"
+ >
+ </div>
+ </div>
+ </div>
+ </a-scrollbar>
+ </div>
+</template>
+<script setup lang="ts">
+import {
+ IconClose,
+ IconSearch,
+ IconTiktokColor
+} from "@arco-design/web-vue/es/icon";
+import { useAppStore, useUserStore } from "@/store";
+import { computed, nextTick, onMounted, watch, reactive, ref, onBeforeMount, onBeforeUnmount } from "vue";
+
+import { Message } from "@arco-design/web-vue";
+import EventBus from '@/utils/EventBus';
+import moment from "moment";
+import {
+ addSessionApi,
+ chatApi,
+ getDialogListApi,
+ getSessionDetailsApi,
+ sessionListApi
+} from "@/api/session";
+import { queryCanvasList } from "@/api/Agent";
+const emit = defineEmits(["querySessionDetail","changeAgentType"]);
+import logo from "@/assets/images/model.png";
+const sessionList = ref([]); //浼氳瘽鍒楄〃
+const activeSessionId = ref("");
+const fieldNames = { value: "id", label: "name" };
+const dialogs = ref([]);
+const dialogObj = reactive({});
+const agentObj = reactive({});
+const agentList = ref([]);
+const searchValue = ref("");
+const selectValue = ref("");
+const sectionList = ref({});
+const imgSrc = ref(logo);
+const DialogList = async () => {
+ const { code, data } = await getDialogListApi();
+ if (code === 200) {
+ if (data) {
+ selectValue.value = data[0].id;
+ dialogs.value = data.map((item) => {
+ return {
+ ...item,
+ type: 1 //鏅鸿兘浣�
+ };
+ });
+ // console.log(data, "dialogs");
+ queryCanvas();
+ }
+ }
+};
+
+const queryCanvas = async (params = {}) => {
+ try {
+ const { data } = await queryCanvasList(params);
+ console.log(data, "agent");
+ agentList.value = data.map((item) => {
+ return {
+ ...item,
+ name: item.title,
+ type: 2 //agent
+ };
+ });
+ // 鍚堝苟鏁扮粍
+ dialogs.value = dialogs.value.concat(agentList.value);
+
+
+ } catch (err) {
+ // you can report use errorHandler or other
+ } finally {
+ }
+};
+
+
+// 鏌ヨ浼氳瘽鍒楄〃
+const querySessionList = async (id) => {
+ const { code, data } = await sessionListApi(id);
+ if (code === 200) {
+ sessionList.value = data;
+
+
+
+ } else {
+ Message.warning("鏌ヨ澶辫触");
+ }
+};
+
+
+const querySessionDetail = async (session) => {
+ console.log(session, 'session');
+ emit('changeAgentType','1');
+ emit('querySessionDetail',session);
+}
+onBeforeMount(()=>{
+ DialogList()
+})
+
+onMounted(() => {
+ EventBus.on("smartAi", () => {
+ emit('changeAgentType','4');
+ DialogList()
+ });
+})
+onBeforeUnmount(() => {
+ EventBus.off("smartAi");
+});
+
+
+</script>
+<style scoped lang="less">
+ .layoutHisCenter{
+ width: 100%;
+ //background: #999999;
+ position: absolute;
+ left: 0;
+ top: 0;
+ .historyTitle___F_iam {
+ font-size: 36px;
+ line-height: 50px;
+ font-weight: 700;
+ text-align: center;
+ }
+ .search{
+ width: 100%;
+ .search-box{
+ width: 70%;
+ margin-left: 15%;
+ border: 1px solid var(--color-text-4);
+ padding: 10px;
+ border-radius: 12px;
+ background: var(--color-bg-2);
+ margin-top: 20px;
+ margin-bottom: 20px;
+ :deep(.arco-input-wrapper){
+ border: none;
+ background: var(--color-bg-2);
+ }
+ }
+ }
+ .historyCenter{
+ width: 100%;
+ margin-top: 30px;
+ .historyCenter-box{
+ display: flex;
+ width: 70%;
+ margin-left: 15%;
+ //border: 1px solid var(--color-text-4);
+ padding: 16px;
+ border-radius: 12px;
+ background: var(--color-bg-2);
+ margin-top: 10px;
+ cursor: pointer;
+ justify-content: space-between;
+ align-items: center;
+ }
+ .historyCenter-box:hover{
+ color: #2a2a2b;
+ border: 1px solid var(--color-neutral-3);
+ //background: #e8e8ea;
+ box-shadow: 0 1px 2px -2px rgba(0, 0, 0, 0.16), 0 3px 6px 0 rgba(0, 0, 0, 0.12), 0 5px 12px 4px rgba(0, 0, 0, 0.09);
+ }
+ }
+
+
+
+
+ }
+
+
+
+</style>
diff --git a/src/views/sessionManager/index.vue b/src/views/sessionManager/index.vue
index d1f4042..b50777e 100644
--- a/src/views/sessionManager/index.vue
+++ b/src/views/sessionManager/index.vue
@@ -1,10 +1,10 @@
<template>
<div class="container">
- <AddSession
- :modalObj="modalObj"
- @addSession="addSession"
- :dialogId="dialogId"
- ></AddSession>
+<!-- <AddSession-->
+<!-- :modalObj="modalObj"-->
+<!-- @addSession="addSession"-->
+<!-- :dialogId="dialogId"-->
+<!-- ></AddSession>-->
<!-- <a-card class="top-title">AI浼氳瘽璁板綍</a-card>-->
<a-row :gutter="[5, 5]" style="margin-top: 3px;">
<!-- <a-col :span="6">-->
@@ -68,83 +68,14 @@
</a-col>
<!-- 鏅鸿兘浣撲細璇�-->
<a-col :span="23" v-show="agentType == '1'">
- <!-- <div
- v-if="sessionDetailList.length === 0"
- style="
- width: 90%;
- overflow: auto;
- height: 65vh;
- margin: 0px auto 20px;
- "
- >
- <div class="center-title">鏅鸿兘闂瓟</div>
- <div class="center-content">
- 鎴戝彲浠ョ悊瑙e拰瀛︿範浜虹被鐨勮瑷�锛屽叿澶囧杞璇濈殑鑳藉姏锛岀幇鍦ㄥ拰鎴戝紑濮嬩氦娴佸惂~
- </div>
- <div class="center-question">
- <div class="center-question-left">璇曚竴璇曡繖鏍烽棶鎴�</div>
- <div class="center-question-right">
- <a-button type="primary">鎹竴鎹�</a-button>
+ <div class="center">
+ <div class="header___lEPyH">
+ <div class="chatHeader">
+ <div class="chatHeaderBox">
+ <span class="title">{{agentTitle}}</span>
+ </div>
</div>
</div>
- <a-row justify="space-around" class="center-list">
- <a-col :span="7" class="item">
- <div class="item-title">
- <IconTiktokColor></IconTiktokColor>
- 鎶栭煶甯﹁揣鑴氭湰
- </div>
- <div class="item-content" :class="{ dark: theme === 'dark' }">
- 缂栧啓寮曚汉娉ㄧ洰涓斿叿鏈夎鏈嶅姏鐨勩�侀�傜敤浜庝骇鍝佺殑...
- </div>
- </a-col>
- <a-col :span="7" class="item">
- <div class="item-title">
- <IconTiktokColor></IconTiktokColor>
- 鎶栭煶甯﹁揣鑴氭湰
- </div>
- <div class="item-content" :class="{ dark: theme === 'dark' }">
- 缂栧啓寮曚汉娉ㄧ洰涓斿叿鏈夎鏈嶅姏鐨勩�侀�傜敤浜庝骇鍝佺殑...
- </div>
- </a-col>
- <a-col :span="7" class="item">
- <div class="item-title">
- <IconTiktokColor></IconTiktokColor>
- 鎶栭煶甯﹁揣鑴氭湰
- </div>
- <div class="item-content" :class="{ dark: theme === 'dark' }">
- 缂栧啓寮曚汉娉ㄧ洰涓斿叿鏈夎鏈嶅姏鐨勩�侀�傜敤浜庝骇鍝佺殑...
- </div>
- </a-col>
- <a-col :span="7" class="item">
- <div class="item-title">
- <IconTiktokColor></IconTiktokColor>
- 鎶栭煶甯﹁揣鑴氭湰
- </div>
- <div class="item-content" :class="{ dark: theme === 'dark' }">
- 缂栧啓寮曚汉娉ㄧ洰涓斿叿鏈夎鏈嶅姏鐨勩�侀�傜敤浜庝骇鍝佺殑...
- </div>
- </a-col>
- <a-col :span="7" class="item">
- <div class="item-title">
- <IconTiktokColor></IconTiktokColor>
- 鎶栭煶甯﹁揣鑴氭湰
- </div>
- <div class="item-content" :class="{ dark: theme === 'dark' }">
- 缂栧啓寮曚汉娉ㄧ洰涓斿叿鏈夎鏈嶅姏鐨勩�侀�傜敤浜庝骇鍝佺殑...
- </div>
- </a-col>
- <a-col :span="7" class="item">
- <div class="item-title">
- <IconTiktokColor></IconTiktokColor>
- 鎶栭煶甯﹁揣鑴氭湰
- </div>
- <div class="item-content" :class="{ dark: theme === 'dark' }">
- 缂栧啓寮曚汉娉ㄧ洰涓斿叿鏈夎鏈嶅姏鐨勩�侀�傜敤浜庝骇鍝佺殑...
- </div>
- </a-col>
- </a-row>
- </div> -->
- <div class="center">
<a-scrollbar
ref="scrollbar"
id="home"
@@ -259,67 +190,16 @@
<agentSession :modalObj="agentObj"></agentSession>
</div>
</a-col>
-
- <!-- <a-col :span="5">
- <a-card class="right">
- <div class="right-top">
- <div class="right-title">鏁版櫤搴�</div>
- <div class="right-btn">
- <a-button type="outline" shape="circle" style="border: none">
- <icon-search />
- </a-button>
- <a-button
- type="outline"
- shape="circle"
- style="border: none; margin-left: -10px"
- >
- <icon-close />
- </a-button>
- </div>
- </div>
- <div class="right-tag">
- <a-button type="primary" size="mini" class="btn">鍏ㄩ儴 </a-button>
- <a-button type="outline" size="mini" class="btn"
- >鏂囨。鍒涗綔
- </a-button>
- <a-button type="outline" size="mini" class="btn"
- >鐭ヨ瘑瀛︿範
- </a-button>
- <a-button type="outline" size="mini" class="btn"
- >鏁堢巼鎻愬崌
- </a-button>
- </div>
- <div class="right-list">
- <div class="right-item">
- <div class="item-title">
- <IconTiktokColor></IconTiktokColor>
- 鎶栭煶甯﹁揣鑴氭湰
- </div>
- <div class="item-content" :class="{ dark: theme === 'dark' }">
- 缂栧啓寮曚汉娉ㄧ洰涓斿叿鏈夎鏈嶅姏鐨勩�侀�傜敤浜庝骇鍝佺殑...
- </div>
- </div>
- <div class="right-item">
- <div class="item-title">
- <IconTiktokColor></IconTiktokColor>
- 鎶栭煶甯﹁揣鑴氭湰
- </div>
- <div class="item-content" :class="{ dark: theme === 'dark' }">
- 缂栧啓寮曚汉娉ㄧ洰涓斿叿鏈夎鏈嶅姏鐨勩�侀�傜敤浜庝骇鍝佺殑...
- </div>
- </div>
- <div class="right-item">
- <div class="item-title">
- <IconTiktokColor></IconTiktokColor>
- 鎶栭煶甯﹁揣鑴氭湰
- </div>
- <div class="item-content" :class="{ dark: theme === 'dark' }">
- 缂栧啓寮曚汉娉ㄧ洰涓斿叿鏈夎鏈嶅姏鐨勩�侀�傜敤浜庝骇鍝佺殑...
- </div>
- </div>
- </div>
- </a-card>
- </a-col> -->
+ <a-col :span="23" v-show="agentType == '3'">
+ <div class="center" style="padding: 0">
+ <historySession @querySessionDetail="querySessionDetail" @changeAgentType="changeAgentType"></historySession>
+ </div>
+ </a-col>
+ <a-col :span="23" v-show="agentType == '4'">
+ <div class="center" style="padding: 0">
+ <smartAi @querySessionDetail="querySessionDetail" @changeAgentType="changeAgentType"></smartAi>
+ </div>
+ </a-col>
</a-row>
</div>
</template>
@@ -330,7 +210,7 @@
IconTiktokColor
} from "@arco-design/web-vue/es/icon";
import { useAppStore, useUserStore } from "@/store";
-import { computed, nextTick, onMounted, watch, reactive, ref } from "vue";
+import { computed, nextTick, onMounted, watch, reactive, ref, onBeforeMount, onBeforeUnmount } from "vue";
import { Message } from "@arco-design/web-vue";
import { EventSourceParserStream } from "eventsource-parser/stream";
@@ -338,7 +218,11 @@
import chatMenu from "@/views/sessionManager/components/chatMenu.vue";
import AddSession from "@/views/sessionManager/components/addSession.vue";
import agentSession from "@/views/sessionManager/components/agentSession.vue";
+import historySession from "@/views/sessionManager/components/historySession.vue";
+import smartAi from "@/views/sessionManager/components/smartAi.vue";
+import EventBus from "@/utils/EventBus";
import {
+ addSessionApi,
chatApi,
getDialogListApi,
getSessionDetailsApi,
@@ -355,6 +239,7 @@
const chatDis = ref(false);
const loading = ref(false);
const agentType = ref("1");
+const agentTitle = ref("鏈懡鍚嶄細璇�");
const currIndex = ref(0);
const displayedText = ref(""); // 姝e湪鏄剧ず鐨勬枃瀛�
@@ -382,7 +267,6 @@
});
console.log(data, "dialogs");
queryCanvas();
- // querySessionList();
}
}
};
@@ -403,14 +287,35 @@
// 鍒ゆ柇褰撳墠鏄櫤鑳戒綋鎴朼gent
// console.log(val, 'val');
- if (dialogs.value.length > 0) {
- dialogChange(dialogs.value[0].id);
- }
+ // if (dialogs.value.length > 0) {
+ // dialogChange(dialogs.value[0].id);
+ // }
+ //鏂板缓浼氳瘽
+ createSession(dialogs.value[0].id);
+
+
} catch (err) {
// you can report use errorHandler or other
} finally {
}
};
+// 鏂板缓浼氳瘽
+const createSession = async (id) => {
+ const res = await addSessionApi({
+ dialog_id: id,
+ conversation_desc: "鏈懡鍚嶄細璇�"
+ });
+ console.log(res, "res");
+ if (res.code == 200) {
+ // console.log(res.data.conversation_id);
+ activeSessionId.value = res.data?.conversation_id;
+ queryNewSessionDetail(res.data?.conversation_id);
+ } else {
+ Message.error("鍒涘缓浼氳瘽澶辫触锛岃閲嶈瘯");
+ }
+
+};
+
const handleShiftEnter = (event) => {
event.preventDefault();
@@ -506,12 +411,12 @@
if (done) {
console.info("done");
displayedText.value = "";
- querySessionDetail(sectionList.value);
+ queryNewSessionDetail(activeSessionId.value);
break;
}
}
}
- querySessionList();
+ // querySessionList();
chatDis.value = false;
loading.value = false;
inputMsg.value = "";
@@ -523,6 +428,22 @@
}
}
};
+
+const queryNewSessionDetail = async (id) => {
+ activeSessionId.value = id;
+ const { code, data } = await getSessionDetailsApi(id);
+ if (code === 200) {
+ sessionDetailList.value = data.message;
+ agentTitle.value = data.name;
+ refreshScroll(); //鍒锋柊婊氬姩鏉′綅缃�
+ }
+};
+
+const changeAgentType = (val,session) => {
+ agentType.value = val;
+ console.log(val, "val");
+}
+
const querySessionDetail = async (session) => {
sectionList.value = session;
activeSessionId.value = session.id;
@@ -574,8 +495,17 @@
const addSession = () => {
querySessionList();
};
-onMounted(() => {
+onBeforeMount(() => {
DialogList();
+});
+onMounted(() => {
+ EventBus.on("newChat", () => {
+ agentType.value = 1;
+ createSession(dialogs.value[0].id);
+ });
+});
+onBeforeUnmount(() => {
+ EventBus.off("newChat");
});
const appStore = useAppStore();
@@ -694,6 +624,7 @@
.center {
position: relative;
+ padding-left: 50px;
.center-title {
line-height: 60px;
@@ -862,4 +793,22 @@
}
}
}
+.header___lEPyH {
+ width: 100%;
+ height: 46px;
+ position: relative;
+ backdrop-filter: blur(15px);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ -webkit-backdrop-filter: blur(15px);
+ .chatHeaderBox {
+ width: auto;
+ border-radius: 8px;
+ padding: 4px 20px;
+ transition: all var(--animation-duration) var(--animation-transition);
+ display: flex;
+ align-items: flex-end;
+ }
+}
</style>
diff --git a/src/views/sessionManager/style/layout.css b/src/views/sessionManager/style/layout.css
index 2804c54..791e160 100644
--- a/src/views/sessionManager/style/layout.css
+++ b/src/views/sessionManager/style/layout.css
@@ -1395,7 +1395,7 @@
.myAgentLine___Isl6E {
width: 24px;
height: 1px;
- background-color: #ece7e7;
+ background-color: #f0f0f0;
border-radius: 12px;
margin-bottom: 16px;
cursor: pointer
@@ -1438,7 +1438,7 @@
height: 28px;
line-height: 28px;
text-align: center;
- content: "\5f00\542f\65b0\4f1a\8bdd";
+ content: "寮�鍚柊浼氳瘽";
position: absolute;
left: 54px;
display: none;
@@ -1475,7 +1475,7 @@
height: 28px;
line-height: 28px;
text-align: center;
- content: "\5386\53f2\4f1a\8bdd";
+ content: "鍘嗗彶浼氳瘽";
position: absolute;
left: 54px;
display: none;
@@ -1508,11 +1508,11 @@
}
.myAgent___djnd_ .myAgentTool___Y1_mC .myAgentToolIconSquare___Rj1o_:after {
- width: 58px;
+ width: 70px;
height: 28px;
line-height: 28px;
text-align: center;
- content: "Kimi+";
+ content: "SmartAl+";
position: absolute;
left: 54px;
display: none;
--
Gitblit v1.8.0