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() { ...@@ -112,8 +112,13 @@ function questionSubmit() {
content: questionContent.value.trim(), content: questionContent.value.trim(),
timestamp: Date.now(), timestamp: Date.now(),
isAnswerLoading: false, isAnswerLoading: false,
avatar: '',
name: '',
}) })
const agentAvatar = currentAgentApplication.value.agentAvatar
const agentName = currentAgentApplication.value.agentTitle
nextTick(() => { nextTick(() => {
emit('addMessageItem', latestAssistantMessageKey, { emit('addMessageItem', latestAssistantMessageKey, {
role: 'assistant', role: 'assistant',
...@@ -121,6 +126,8 @@ function questionSubmit() { ...@@ -121,6 +126,8 @@ function questionSubmit() {
content: '', content: '',
timestamp: Date.now(), timestamp: Date.now(),
isAnswerLoading: true, isAnswerLoading: true,
avatar: agentAvatar,
name: agentName,
}) })
emit('messageListScrollToBottom') emit('messageListScrollToBottom')
......
...@@ -14,25 +14,29 @@ const props = defineProps<Props>() ...@@ -14,25 +14,29 @@ const props = defineProps<Props>()
const { t } = useI18n() const { t } = useI18n()
const userStore = useUserStore() 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(() => { const isAgentMessage = computed(() => {
return props.messageItem.role === 'assistant' 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> </script>
<template> <template>
<div class="mb-[20px] last:mb-0"> <div class="mb-[20px] last:mb-0">
<div class="flex"> <div class="flex">
<img <img class="h-[36px] w-[36px]" :src="avatarUrl" alt="Avatar" />
class="h-[36px] w-[36px]"
:src="isAgentMessage ? agentAvatarUrl.url : userStore.userInfo.avatarUrl"
alt="Avatar"
/>
<div class="ml-[11px]"> <div class="ml-[11px]">
<div class="mb-[7px] text-[12px] text-[#999]"> <div class="mb-[7px] text-[12px] text-[#999]">
{{ isAgentMessage ? 'AI助理' : userStore.userInfo.nickName }} {{ name }}
</div> </div>
<div <div
class="box-content min-h-[21px] min-w-[10px] rounded-[10px] border border-[#9EA3FF] px-[15px] py-[14px] text-justify" 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) { ...@@ -152,11 +152,31 @@ function onGetMessageRecordList(recordId: string) {
const loadingCtl = window.$message.loading(t('home_module.switching_over')) 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) => { .then((res) => {
if (res.data && Array.isArray(res.data)) { if (res.data && Array.isArray(res.data)) {
const messageListDraft = res.data.map((recordItem) => { const messageListDraft: (string | MessageItemInterface)[][] = res.data.map((recordItem) => {
return [nanoid(), { ...recordItem, isAnswerLoading: false }] 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) messageList.value = new Map(messageListDraft as any)
......
...@@ -13,4 +13,6 @@ export interface MessageItemInterface { ...@@ -13,4 +13,6 @@ export interface MessageItemInterface {
content: string content: string
timestamp: number timestamp: number
isAnswerLoading: boolean isAnswerLoading: boolean
avatar: string
name: string
} }
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import { ref } from 'vue' import { ref } from 'vue'
import Preamble from './preamble.vue' import Preamble from './preamble.vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import MessageList from './message-list.vue' import MessageList from './message-list.vue'
import FooterInput from './footer-input.vue' import FooterInput from './footer-input.vue'
import { fetchCreateContinueQuestions } from '@/apis/agent-application' import { fetchCreateContinueQuestions } from '@/apis/agent-application'
...@@ -11,7 +12,7 @@ import MemoryPreviewModal from './memory-preview-modal.vue' ...@@ -11,7 +12,7 @@ import MemoryPreviewModal from './memory-preview-modal.vue'
const { t } = useI18n() const { t } = useI18n()
// const router = useRouter() const router = useRouter()
const personalAppConfigStore = usePersonalAppConfigStore() const personalAppConfigStore = usePersonalAppConfigStore()
...@@ -74,14 +75,14 @@ function handleUpdateContinueQuestionStatus(status: 'default' | 'close') { ...@@ -74,14 +75,14 @@ function handleUpdateContinueQuestionStatus(status: 'default' | 'close') {
continuousQuestionList.value = [] continuousQuestionList.value = []
} }
// function handleTurnMultiModelDialogue() { function handleTurnMultiModelDialogue() {
// router.push({ router.push({
// name: 'MultiModelDialogue', name: 'MultiModelDialogue',
// params: { params: {
// agentId: personalAppConfigStore.baseInfo.agentId, agentId: personalAppConfigStore.baseInfo.agentId,
// }, },
// }) })
// } }
function handleOpenMemoryPreviewModal(MemoryTabName: string) { function handleOpenMemoryPreviewModal(MemoryTabName: string) {
selectedMemoryTabName.value = MemoryTabName selectedMemoryTabName.value = MemoryTabName
...@@ -97,6 +98,16 @@ function handleOpenMemoryPreviewModal(MemoryTabName: string) { ...@@ -97,6 +98,16 @@ function handleOpenMemoryPreviewModal(MemoryTabName: string) {
{{ t('personal_space_module.agent_module.agent_setting_module.agent_config_module.preview') }} {{ t('personal_space_module.agent_module.agent_setting_module.agent_config_module.preview') }}
</p> </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 <div
v-show=" v-show="
personalAppConfigStore.commConfig.variableStructure !== null || personalAppConfigStore.commConfig.variableStructure !== null ||
...@@ -133,15 +144,7 @@ function handleOpenMemoryPreviewModal(MemoryTabName: string) { ...@@ -133,15 +144,7 @@ function handleOpenMemoryPreviewModal(MemoryTabName: string) {
</n-popover> </n-popover>
</div> </div>
</div> </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"> <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