feat: 对话逻辑调整、历史对话接口联调
This commit is contained in:
68
src/api/all/chat.ts
Normal file
68
src/api/all/chat.ts
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
import Http from '@/api';
|
||||||
|
import axios from 'axios';
|
||||||
|
import { glsWithCatch } from '@/utils/stroage';
|
||||||
|
import { useEnterpriseStore } from '@/stores/modules/enterprise';
|
||||||
|
|
||||||
|
// 历史记录-列表
|
||||||
|
export const getAgentHistory = (id: string) => {
|
||||||
|
return Http.get(`/v1/multi-agent/history/${id}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 历史记录-更新标题
|
||||||
|
export const postUpdateSessionTitle = (data: any) => {
|
||||||
|
return Http.post('/v1/multi-agent/edit-session-title', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 历史记录-置顶/取消置顶
|
||||||
|
export const postUpdateSessionSort = (data: any) => {
|
||||||
|
return Http.post('/v1/multi-agent/edit-session-sort', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 历史记录-删除
|
||||||
|
export const deleteHistoryItem = (id: string) => {
|
||||||
|
return Http.delete(`/v1/multi-agent/del-session/${id}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const baseUrl = 'http://192.168.40.41:8001';
|
||||||
|
const getHeaders = () => {
|
||||||
|
const store = useEnterpriseStore();
|
||||||
|
return {
|
||||||
|
Authorization: glsWithCatch('accessToken'),
|
||||||
|
'enterprise-id': store.enterpriseInfo?.id,
|
||||||
|
Accept: 'application/json',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取智能体信息
|
||||||
|
*/
|
||||||
|
export const getAgentInfo = async () => {
|
||||||
|
const { data } = await axios.get(`${baseUrl}/api/agent/info`, {
|
||||||
|
headers: getHeaders(),
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指令输入
|
||||||
|
*/
|
||||||
|
export const getInputAgent = async (params: {}) => {
|
||||||
|
const { data } = await axios.get(`${baseUrl}/api/agent/input`, {
|
||||||
|
params,
|
||||||
|
headers: { ...getHeaders(), Accept: 'text/event-stream' },
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成会话id
|
||||||
|
*/
|
||||||
|
export const createSession = async () => {
|
||||||
|
const { data } = await axios.get(`${baseUrl}/api/agent/create_session`, {
|
||||||
|
headers: getHeaders(),
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
};
|
||||||
@ -72,7 +72,6 @@ export class Request {
|
|||||||
const { response } = err;
|
const { response } = err;
|
||||||
const status = response?.status;
|
const status = response?.status;
|
||||||
let errMessage = response?.data?.message ?? err.message;
|
let errMessage = response?.data?.message ?? err.message;
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case HttpStatusCode.InternalServerError:
|
case HttpStatusCode.InternalServerError:
|
||||||
errMessage = '系统繁忙,请稍后再试或联系管理员。';
|
errMessage = '系统繁忙,请稍后再试或联系管理员。';
|
||||||
|
|||||||
@ -71,7 +71,7 @@ export default defineComponent({
|
|||||||
};
|
};
|
||||||
const onMenuItemClick = ({ menuInfo, item }) => {
|
const onMenuItemClick = ({ menuInfo, item }) => {
|
||||||
const { key } = menuInfo;
|
const { key } = menuInfo;
|
||||||
emit('menuClick', menuInfo);
|
emit('menuClick', { menuInfo, item });
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case 'rename':
|
case 'rename':
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
<script lang="jsx">
|
<script lang="jsx">
|
||||||
import { Input } from 'ant-design-vue';
|
import { Input } from 'ant-design-vue';
|
||||||
import { handleUserHome } from '@/utils/user.ts';
|
import { handleUserHome } from '@/utils/user.ts';
|
||||||
import { useSharedDataStore } from '@/stores/modules/share-data';
|
import { useChatStore } from '@/stores/modules/chat';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup(props, { emit, expose }) {
|
setup(props, { emit, expose }) {
|
||||||
const sharedDataStore = useSharedDataStore();
|
const chatStore = useChatStore();
|
||||||
const keyWord = ref('');
|
const keyWord = ref('');
|
||||||
|
|
||||||
const handleSearch = () => {
|
const handleSearch = () => {
|
||||||
sharedDataStore.setRouteParams({ keyWord: keyWord.value });
|
chatStore.setSearchValue(keyWord.value);
|
||||||
handleUserHome();
|
chatStore.onCreateSession();
|
||||||
keyWord.value = '';
|
keyWord.value = '';
|
||||||
};
|
};
|
||||||
return () => (
|
return () => (
|
||||||
|
|||||||
46
src/stores/modules/chat/index.ts
Normal file
46
src/stores/modules/chat/index.ts
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import { defineStore } from 'pinia';
|
||||||
|
import { createSession } from '@/api/all/chat';
|
||||||
|
import { handleUserHome } from '@/utils/user';
|
||||||
|
|
||||||
|
interface ChatState {
|
||||||
|
searchValue?: string;
|
||||||
|
agentInfo?: agentInfo;
|
||||||
|
}
|
||||||
|
type agentInfo = {
|
||||||
|
agent_id?: string;
|
||||||
|
name?: string;
|
||||||
|
description?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useChatStore = defineStore('chat', {
|
||||||
|
state: (): ChatState => ({
|
||||||
|
searchValue: '',
|
||||||
|
agentInfo: {},
|
||||||
|
}),
|
||||||
|
actions: {
|
||||||
|
setSearchValue(searchValue: string) {
|
||||||
|
this.searchValue = searchValue;
|
||||||
|
},
|
||||||
|
clearSearchValue() {
|
||||||
|
this.searchValue = '';
|
||||||
|
},
|
||||||
|
setAgentInfo(agentInfo: agentInfo) {
|
||||||
|
this.agentInfo = agentInfo;
|
||||||
|
},
|
||||||
|
clearAgentInfo() {
|
||||||
|
this.agentInfo = {};
|
||||||
|
},
|
||||||
|
clearAllAgentInfo() {
|
||||||
|
this.agentInfo = {};
|
||||||
|
this.searchValue = '';
|
||||||
|
},
|
||||||
|
async onCreateSession() {
|
||||||
|
const { code, data } = await createSession();
|
||||||
|
if (code === 200) {
|
||||||
|
handleUserHome({
|
||||||
|
conversationId: data.session_id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
@ -8,3 +8,4 @@
|
|||||||
export * from './app';
|
export * from './app';
|
||||||
export * from './tab-bar';
|
export * from './tab-bar';
|
||||||
export * from './user';
|
export * from './user';
|
||||||
|
export * from './chat';
|
||||||
|
|||||||
@ -1,20 +0,0 @@
|
|||||||
import { defineStore } from 'pinia';
|
|
||||||
|
|
||||||
interface SharedDataState {
|
|
||||||
routeParams: Record<string, any> | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const useSharedDataStore = defineStore('sharedData', {
|
|
||||||
state: (): SharedDataState => ({
|
|
||||||
routeParams: null,
|
|
||||||
}),
|
|
||||||
|
|
||||||
actions: {
|
|
||||||
setRouteParams(params: Record<string, any>) {
|
|
||||||
this.routeParams = params;
|
|
||||||
},
|
|
||||||
clearRouteParams() {
|
|
||||||
this.routeParams = null;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@ -4,11 +4,13 @@ import { BubbleList } from '@/components/xt-chat/xt-bubble';
|
|||||||
import SenderInput from '../sender-input/index.vue';
|
import SenderInput from '../sender-input/index.vue';
|
||||||
import { Typography } from 'ant-design-vue';
|
import { Typography } from 'ant-design-vue';
|
||||||
import RightView from './rightView.vue';
|
import RightView from './rightView.vue';
|
||||||
|
import type { Ref } from 'vue';
|
||||||
|
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import markdownit from 'markdown-it';
|
import markdownit from 'markdown-it';
|
||||||
import { useClipboard } from '@vueuse/core';
|
import { useClipboard } from '@vueuse/core';
|
||||||
import { genRandomId } from '@/utils/tools';
|
import { genRandomId } from '@/utils/tools';
|
||||||
|
import { useChatStore } from '@/stores/modules/chat';
|
||||||
import type { BubbleListProps } from '@/components/xt-chat/xt-bubble/types';
|
import type { BubbleListProps } from '@/components/xt-chat/xt-bubble/types';
|
||||||
|
|
||||||
const QUESTION_ROLE = 'question';
|
const QUESTION_ROLE = 'question';
|
||||||
@ -16,6 +18,8 @@ const ANSWER_ROLE = 'text';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup(props, { emit, expose }) {
|
setup(props, { emit, expose }) {
|
||||||
|
const chatStore = useChatStore();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { copy } = useClipboard();
|
const { copy } = useClipboard();
|
||||||
|
|
||||||
@ -187,6 +191,20 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const initSse = () => {
|
||||||
|
console.log('initSse', { agentInfo: chatStore.agentInfo, searchValue: chatStore.searchValue });
|
||||||
|
};
|
||||||
|
const closeSse = () => {
|
||||||
|
console.log('closeSse');
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
initSse();
|
||||||
|
});
|
||||||
|
onUnmounted(() => {
|
||||||
|
closeSse();
|
||||||
|
});
|
||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<div class="conversation-detail-wrap w-full h-full flex">
|
<div class="conversation-detail-wrap w-full h-full flex">
|
||||||
<section class="flex-1 flex flex-col pt-20px justify-center relative px-16px">
|
<section class="flex-1 flex flex-col pt-20px justify-center relative px-16px">
|
||||||
@ -203,7 +221,7 @@ export default {
|
|||||||
v-model={searchValue.value}
|
v-model={searchValue.value}
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
data-ne='123'
|
data-ne="123"
|
||||||
/>
|
/>
|
||||||
<p class="cts !color-#939499 text-12px !lh-20px my-4px">内容由AI生成,仅供参考</p>
|
<p class="cts !color-#939499 text-12px !lh-20px my-4px">内容由AI生成,仅供参考</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -3,25 +3,21 @@ import { message } from 'ant-design-vue';
|
|||||||
import ExpandableTags from '@/components/expandable-tags/index.vue';
|
import ExpandableTags from '@/components/expandable-tags/index.vue';
|
||||||
import SenderInput from '../sender-input/index.vue';
|
import SenderInput from '../sender-input/index.vue';
|
||||||
|
|
||||||
import { useSharedDataStore } from '@/stores/modules/share-data';
|
import { useChatStore } from '@/stores/modules/chat';
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
import { handleUserHome } from '@/utils/user';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup(props, { emit, expose }) {
|
setup(props, { emit, expose }) {
|
||||||
const router = useRouter();
|
|
||||||
const senderRef = ref(null);
|
const senderRef = ref(null);
|
||||||
const searchValue = ref('');
|
const searchValue = ref('');
|
||||||
const sharedDataStore = useSharedDataStore();
|
const chatStore = useChatStore();
|
||||||
|
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
handleSearch();
|
handleSearch();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSearch = () => {
|
const handleSearch = async () => {
|
||||||
console.log('searchValue.value', searchValue.value);
|
chatStore.setSearchValue(searchValue.value);
|
||||||
// const conversationId = searchValue.value;
|
chatStore.onCreateSession();
|
||||||
// handleUserHome({conversationId})
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const tagList = [
|
const tagList = [
|
||||||
@ -48,13 +44,7 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const params = sharedDataStore.routeParams;
|
chatStore.clearSearchValue();
|
||||||
if (params) {
|
|
||||||
searchValue.value = params.keyWord;
|
|
||||||
sharedDataStore.clearRouteParams();
|
|
||||||
|
|
||||||
handleSearch();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { deleteTask, deleteBatchTasks } from '@/api/all/common';
|
import { deleteHistoryItem } from '@/api/all/chat';
|
||||||
import icon1 from '@/assets/img/media-account/icon-warn-1.png';
|
import icon1 from '@/assets/img/media-account/icon-warn-1.png';
|
||||||
|
|
||||||
const emits = defineEmits(['update', 'close', 'batchUpdate']);
|
const emits = defineEmits(['update', 'close', 'batchUpdate']);
|
||||||
@ -32,6 +32,7 @@ function onClose() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const open = (record) => {
|
const open = (record) => {
|
||||||
|
console.log({record})
|
||||||
const { id = null } = record;
|
const { id = null } = record;
|
||||||
chatId.value = id;
|
chatId.value = id;
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ const open = (record) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
async function onDelete() {
|
async function onDelete() {
|
||||||
const { code } = await deleteTask(chatId.value);
|
const { code } = await deleteHistoryItem(chatId.value);
|
||||||
if (code === 200) {
|
if (code === 200) {
|
||||||
AMessage.success('删除成功');
|
AMessage.success('删除成功');
|
||||||
emits('delete', chatId.value);
|
emits('delete', chatId.value);
|
||||||
|
|||||||
@ -1,41 +1,64 @@
|
|||||||
<script lang="jsx">
|
<script lang="jsx">
|
||||||
import { Drawer } from 'ant-design-vue';
|
import { Drawer, message } from 'ant-design-vue';
|
||||||
import TextoverTips from '@/components/text-over-tips';
|
import TextoverTips from '@/components/text-over-tips';
|
||||||
import Conversations from '@/components/xt-chat/xt-conversations';
|
import Conversations from '@/components/xt-chat/xt-conversations';
|
||||||
import SvgIcon from '@/components/svg-icon';
|
import SvgIcon from '@/components/svg-icon';
|
||||||
import { Button, Flex, Input } from 'ant-design-vue';
|
import { Button, Flex, Input } from 'ant-design-vue';
|
||||||
import DeleteChatModal from './delete-chat-modal.vue';
|
import DeleteChatModal from './delete-chat-modal.vue';
|
||||||
|
import NoData from '@/components/no-data/index.vue';
|
||||||
|
|
||||||
import { handleUserHome } from '@/utils/user';
|
import { handleUserHome } from '@/utils/user';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
import { getAgentHistory, postUpdateSessionTitle, postUpdateSessionSort } from '@/api/all/chat';
|
||||||
|
import { useChatStore } from '@/stores/modules/chat';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup(props, { emit, expose }) {
|
setup(props, { emit, expose }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const chatStore = useChatStore();
|
||||||
|
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
const dataSource = ref([]);
|
const dataSource = ref([]);
|
||||||
const activeKey = ref('');
|
const activeKey = ref('');
|
||||||
const deleteChatModalRef = ref(null);
|
const deleteChatModalRef = ref(null);
|
||||||
|
|
||||||
const showDrawer = () => {
|
const showDrawer = (id) => {
|
||||||
getData();
|
getData();
|
||||||
open.value = true;
|
open.value = true;
|
||||||
};
|
};
|
||||||
const getData = () => {
|
const getData = async () => {
|
||||||
dataSource.value = Array.from({ length: 4 }).map((conversation, index) => ({
|
const { code, data } = await getAgentHistory(chatStore.agentInfo.agent_id);
|
||||||
id: `${index + 1}`,
|
if (code === 200) {
|
||||||
key: `item${index + 1}`,
|
dataSource.value = data.map((item) => ({
|
||||||
label: `Conversation Item ${index + 1}Conversation Item 1`,
|
...item,
|
||||||
}));
|
key: item.id,
|
||||||
|
label: item.title,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const onPin = async (item) => {
|
||||||
|
const { id, sort } = item;
|
||||||
|
// sort大于0就是已置顶
|
||||||
|
const is_top = sort > 0 ? 0 : 1;
|
||||||
|
const { code } = await postUpdateSessionSort({
|
||||||
|
id,
|
||||||
|
is_top,
|
||||||
|
agent_id: chatStore.agentInfo.agent_id,
|
||||||
|
});
|
||||||
|
if (code === 200) {
|
||||||
|
message.success(is_top === 0 ? '取消置顶成功' : '置顶成功');
|
||||||
|
getData();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
|
activeKey.value = '';
|
||||||
|
dataSource.value = [];
|
||||||
open.value = false;
|
open.value = false;
|
||||||
};
|
};
|
||||||
const handleMenuClick = (menuInfo) => {
|
const handleMenuClick = async ({ menuInfo, item }) => {
|
||||||
const { item, key } = menuInfo;
|
switch (menuInfo.key) {
|
||||||
switch (key) {
|
|
||||||
case 'pin':
|
case 'pin':
|
||||||
console.log('置顶');
|
onPin(item);
|
||||||
break;
|
break;
|
||||||
case 'rename':
|
case 'rename':
|
||||||
item.editing = true;
|
item.editing = true;
|
||||||
@ -45,8 +68,15 @@ export default {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleRename = (item) => {
|
const handleRename = async (item) => {
|
||||||
console.log('handleRename', item);
|
const { id, label } = item;
|
||||||
|
const { code } = await postUpdateSessionTitle({
|
||||||
|
id,
|
||||||
|
title: label,
|
||||||
|
});
|
||||||
|
if (code === 200) {
|
||||||
|
message.success('重命名成功');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const handleActiveChange = (item) => {
|
const handleActiveChange = (item) => {
|
||||||
const { id } = item;
|
const { id } = item;
|
||||||
@ -60,18 +90,23 @@ export default {
|
|||||||
return () => (
|
return () => (
|
||||||
<Drawer width={240} rootClassName="ct-history-conversation-drawer" v-model:open={open.value} onClose={onClose}>
|
<Drawer width={240} rootClassName="ct-history-conversation-drawer" v-model:open={open.value} onClose={onClose}>
|
||||||
<header class="header h-40px px-12px flex justify-between items-center">
|
<header class="header h-40px px-12px flex justify-between items-center">
|
||||||
<span class="s1">历史对话</span>
|
<span class="text-16px font-400 color-#211F24 font-family-medium">历史对话</span>
|
||||||
<icon-close size={16} class="color-#211F24 cursor-pointer" onClick={onClose} />
|
<icon-close size={16} class="color-#211F24 cursor-pointer" onClick={onClose} />
|
||||||
</header>
|
</header>
|
||||||
<section class="flex-1 overflow-y-auto content p-12px">
|
{dataSource.value.length === 0 ? (
|
||||||
<Conversations
|
<NoData text="暂无历史对话" />
|
||||||
v-model={activeKey.value}
|
) : (
|
||||||
dataSource={dataSource.value}
|
<section class="flex-1 overflow-y-auto content p-12px">
|
||||||
onMenuClick={handleMenuClick}
|
<Conversations
|
||||||
onRename={handleRename}
|
v-model={activeKey.value}
|
||||||
onActiveChange={handleActiveChange}
|
dataSource={dataSource.value}
|
||||||
/>
|
onMenuClick={handleMenuClick}
|
||||||
</section>
|
onRename={handleRename}
|
||||||
|
onActiveChange={handleActiveChange}
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
)}
|
||||||
|
|
||||||
<DeleteChatModal ref={deleteChatModalRef} />
|
<DeleteChatModal ref={deleteChatModalRef} />
|
||||||
</Drawer>
|
</Drawer>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -18,7 +18,6 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 1px;
|
height: 1px;
|
||||||
margin: 0 16px;
|
|
||||||
background: #f2f3f5;
|
background: #f2f3f5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
<script lang="tsx">
|
<script lang="tsx">
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
|
import { getAgentInfo } from '@/api/all/chat';
|
||||||
|
import { useChatStore } from '@/stores/modules/chat';
|
||||||
|
|
||||||
import HistoryConversationDrawer from './components/history-conversation-drawer/index.vue';
|
import HistoryConversationDrawer from './components/history-conversation-drawer/index.vue';
|
||||||
import ConversationDetail from './components/conversation-detail/index.vue';
|
import ConversationDetail from './components/conversation-detail/index.vue';
|
||||||
@ -9,13 +11,24 @@ import ConversationCreate from './components/created/index.vue';
|
|||||||
export default {
|
export default {
|
||||||
setup(props, { emit, expose }) {
|
setup(props, { emit, expose }) {
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const chatStore = useChatStore();
|
||||||
const historyConversationDrawerRef = ref(null);
|
const historyConversationDrawerRef = ref(null);
|
||||||
|
|
||||||
const conversationId = computed(() => {
|
const conversationId = computed(() => {
|
||||||
return route.params.conversationId;
|
return route.params.conversationId;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const getAgentData = async () => {
|
||||||
|
const { code, data } = await getAgentInfo();
|
||||||
|
if (code === 200) {
|
||||||
|
chatStore.setAgentInfo(data);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getAgentData();
|
||||||
|
});
|
||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<div class="chat-wrap rounded-12px w-full h-full">
|
<div class="chat-wrap rounded-12px w-full h-full">
|
||||||
{conversationId.value ? <ConversationDetail /> : <ConversationCreate />}
|
{conversationId.value ? <ConversationDetail /> : <ConversationCreate />}
|
||||||
|
|||||||
Reference in New Issue
Block a user