Commit ea9e68b2 authored by shirlyn.guo's avatar shirlyn.guo 👌🏻

Merge branch 'master' of https://gitlab.gsstcloud.com/poc/poc-fe into shirlyn

parents 491141b5 e1e55d9f
......@@ -112,8 +112,13 @@ function questionSubmit() {
content: questionContent.value.trim(),
timestamp: Date.now(),
isAnswerLoading: false,
avatar: '',
name: '',
})
const agentAvatar = currentAgentApplication.value.agentAvatar
const agentName = currentAgentApplication.value.agentTitle
nextTick(() => {
emit('addMessageItem', latestAssistantMessageKey, {
role: 'assistant',
......@@ -121,6 +126,8 @@ function questionSubmit() {
content: '',
timestamp: Date.now(),
isAnswerLoading: true,
avatar: agentAvatar,
name: agentName,
})
emit('messageListScrollToBottom')
......
......@@ -14,25 +14,29 @@ const props = defineProps<Props>()
const { t } = useI18n()
const userStore = useUserStore()
const agentAvatarUrl = readonly({ url: 'https://gsst-poe-sit.gz.bcebos.com/icon/agent-avatar.png' })
const agentDefaultAvatarUrl = readonly({ url: 'https://gsst-poe-sit.gz.bcebos.com/icon/agent-avatar.png' })
const isAgentMessage = computed(() => {
return props.messageItem.role === 'assistant'
})
const avatarUrl = computed(() => {
return isAgentMessage.value ? props.messageItem.avatar || agentDefaultAvatarUrl.url : userStore.userInfo.avatarUrl
})
const name = computed(() => {
return isAgentMessage.value ? props.messageItem.name || 'AI助理' : userStore.userInfo.nickName
})
</script>
<template>
<div class="mb-[20px] last:mb-0">
<div class="flex">
<img
class="h-[36px] w-[36px]"
:src="isAgentMessage ? agentAvatarUrl.url : userStore.userInfo.avatarUrl"
alt="Avatar"
/>
<img class="h-[36px] w-[36px]" :src="avatarUrl" alt="Avatar" />
<div class="ml-[11px]">
<div class="mb-[7px] text-[12px] text-[#999]">
{{ isAgentMessage ? 'AI助理' : userStore.userInfo.nickName }}
{{ name }}
</div>
<div
class="box-content min-h-[21px] min-w-[10px] rounded-[10px] border border-[#9EA3FF] px-[15px] py-[14px] text-justify"
......
......@@ -152,11 +152,31 @@ function onGetMessageRecordList(recordId: string) {
const loadingCtl = window.$message.loading(t('home_module.switching_over'))
fetchMessageRecordList<MessageItemInterface[]>(recordId)
fetchMessageRecordList<
{
role: 'user' | 'assistant'
agentId: string
agentAvatar: string
agentTitle: string
content: string
timestamp: number
}[]
>(recordId)
.then((res) => {
if (res.data && Array.isArray(res.data)) {
const messageListDraft = res.data.map((recordItem) => {
return [nanoid(), { ...recordItem, isAnswerLoading: false }]
const messageListDraft: (string | MessageItemInterface)[][] = res.data.map((recordItem) => {
return [
nanoid(),
{
role: recordItem.role,
agentId: recordItem.agentId,
content: recordItem.content,
isAnswerLoading: false,
name: recordItem.agentTitle,
avatar: recordItem.agentAvatar,
timestamp: recordItem.timestamp,
},
]
})
messageList.value = new Map(messageListDraft as any)
......
......@@ -13,4 +13,6 @@ export interface MessageItemInterface {
content: string
timestamp: number
isAnswerLoading: boolean
avatar: string
name: string
}
......@@ -2,6 +2,7 @@
import { ref } from 'vue'
import Preamble from './preamble.vue'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import MessageList from './message-list.vue'
import FooterInput from './footer-input.vue'
import { fetchCreateContinueQuestions } from '@/apis/agent-application'
......@@ -11,7 +12,7 @@ import MemoryPreviewModal from './memory-preview-modal.vue'
const { t } = useI18n()
// const router = useRouter()
const router = useRouter()
const personalAppConfigStore = usePersonalAppConfigStore()
......@@ -74,14 +75,14 @@ function handleUpdateContinueQuestionStatus(status: 'default' | 'close') {
continuousQuestionList.value = []
}
// function handleTurnMultiModelDialogue() {
// router.push({
// name: 'MultiModelDialogue',
// params: {
// agentId: personalAppConfigStore.baseInfo.agentId,
// },
// })
// }
function handleTurnMultiModelDialogue() {
router.push({
name: 'MultiModelDialogue',
params: {
agentId: personalAppConfigStore.baseInfo.agentId,
},
})
}
function handleOpenMemoryPreviewModal(MemoryTabName: string) {
selectedMemoryTabName.value = MemoryTabName
......@@ -97,6 +98,16 @@ function handleOpenMemoryPreviewModal(MemoryTabName: string) {
{{ t('personal_space_module.agent_module.agent_setting_module.agent_config_module.preview') }}
</p>
<div class="flex items-center">
<div
v-show="personalAppConfigStore.baseInfo.agentId"
class="text-font-color hover:text-theme-color cursor-pointer"
@click="handleTurnMultiModelDialogue"
>
<i class="iconfont icon-moxing mr-1 text-sm" />
<span>{{ t('common_module.multi_model_debug') }}</span>
</div>
<div
v-show="
personalAppConfigStore.commConfig.variableStructure !== null ||
......@@ -133,15 +144,7 @@ function handleOpenMemoryPreviewModal(MemoryTabName: string) {
</n-popover>
</div>
</div>
<!-- <div
v-show="personalAppConfigStore.baseInfo.agentId"
class="text-font-color hover:text-theme-color cursor-pointer"
@click="handleTurnMultiModelDialogue"
>
<i class="iconfont icon-moxing mr-1 text-sm" />
<span>{{ t('common_module.multi_model_debug') }}</span>
</div> -->
</div>
</div>
<div class="flex w-full flex-1 overflow-hidden">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment