Commit 491141b5 authored by shirlyn.guo's avatar shirlyn.guo 👌🏻

feat: 记忆片段

parent 4b354333
import { request } from '@/utils/request'
export function fetchGetLongMemoryList<T>(agentId: string) {
return request.post<T>(`/agentApplicationInfoRest/getLongMemoryList.json?agentId=${agentId}`)
}
export function fetchDeleteLongMemoryByKey<T>(agentId: string, timestamp: string) {
return request.post<T>(
`/agentApplicationInfoRest/deleteLongMemoryByKey.json?agentId=${agentId}&timestamp=${timestamp}`,
)
}
export function fetchDeleteAllLongMemory<T>(agentId: string) {
return request.post<T>(`/agentApplicationInfoRest/deleteLongMemory.json?agentId=${agentId}`)
}
export function fetchGetMemoryVariableList<T>(agentId: string) {
return request.post<T>(`/agentApplicationInfoRest/getVariableList.json?agentId=${agentId}`)
}
......@@ -69,6 +69,10 @@ common_module:
collect_unsubscribed: '已取消收藏'
cancel: '取消'
preservation: '保存'
open: '开'
close: '关'
delete_tip_title: '删除提示'
wipe_data: '清空数据'
dialogue_module:
continue_question_message: '你可以继续提问'
......@@ -244,6 +248,11 @@ personal_space_module:
memory_variable_action_copy: '复制名称'
variable_name: '变量名称'
variable_value: '变量值'
memory_fragment: '记忆片段'
memory_fragment_message: '开启记忆片段功能,应用将根据对话内容存储用户提及的信息片段,并依据记忆片段答复。下面以「面试助手」为例:'
memory_fragment_content: '记录聊天对话中所有关于用户信息、用户偏好、用户计划的记忆片段。'
memory_variable_delete_tip_content: '删除后不可撤销。如应用已发布,更新发布后该应用的用户无法使用该记忆变量,是否继续?'
memory_fragment_delete_all_tip_content: '数据清空后不可撤销,确定要全部清空吗?'
memory_variable_modal:
edit_memory_variable: '编辑记忆变量'
......@@ -259,6 +268,9 @@ personal_space_module:
default_value_placeholder: '请输入'
name_placeholder: '请输入名称'
add_variable: '新增变量'
memory_variable_add_now: '立即添加'
none_memory_variable: '暂无记忆变量'
add_variable_message: '添加记忆变量,更好地记录用户特征、用户信息'
memory_variable_rules:
name_not_null: '请输入名称'
......
......@@ -69,6 +69,10 @@ common_module:
collect_unsubscribed: '已取消收藏'
cancel: '取消'
preservation: '保存'
open: '開'
close: '關'
delete_tip_title: '删除提示'
wipe_data: '清空數據'
dialogue_module:
continue_question_message: '你可以繼續提問'
......@@ -237,13 +241,18 @@ personal_space_module:
add_memory_variable: '添加記憶變數'
memory_variable: '記憶變量'
memory_message:
'开发者可根据应用设定记忆变量,应用用户在对话过程中可以录入变量内容,每个变量支持存储一维、单个数据
对话过程中,应用将依据存储的变量值进行答复。下面以「旅游助手」为例:'
memory_variable_message: '记录聊天对话中的一维、单个的应用信息或用户信息,能让智能体回答更加个性化。'
'開發者可根據應用設定記憶變數,應用用戶在對話過程中可以錄入變數內容,每個變數支持存儲一維、單個數據
對話過程中,應用將依據存儲的變數值進行答覆。 下面以「旅遊助手」為例:'
memory_variable_message: '記錄聊天對話中的一維、單個的應用資訊或用戶資訊,能讓智慧體回答更加個性化。'
memory_variable_action_edit: '編輯'
memory_variable_action_copy: '複製名稱'
variable_name: '变量名稱'
variable_value: '变量值'
memory_fragment: '記憶片段'
memory_fragment_message: '開啟記憶片段功能,應用將根據對話內容存儲用戶提及的資訊片段,並依據記憶片段答覆。 下面以「面試助手」為例'
memory_fragment_content: '記錄聊天對話中所有關於用戶資訊、用戶偏好、用戶計畫的記憶片段。'
memory_variable_delete_tip_content: '删除後不可撤銷。 如應用已發佈,更新發佈後該應用的用戶無法使用該記憶變數,是否繼續?'
memory_fragment_delete_all_tip_content: '數據清空後不可撤銷,確定要全部清空嗎?'
memory_variable_modal:
edit_memory_variable: '編輯記憶變數'
......@@ -259,6 +268,9 @@ personal_space_module:
default_value_placeholder: '請輸入'
name_placeholder: '請輸入名稱'
add_variable: '新增變數'
memory_variable_add_now: '立即添加'
none_memory_variable: '暫無記憶變數'
add_variable_message: '添加記憶變數,更好地記錄用戶特徵、用戶資訊'
memory_variable_rules:
name_not_null: '請求輸入名稱'
......
......@@ -18,6 +18,7 @@ export function defaultPersonalAppConfigState(): PersonalAppConfigState {
continuousQuestionSystem: '',
continuousQuestionTurn: 3,
variableStructure: [],
isLongMemory: 'N',
},
knowledgeConfig: {
knowledgeIds: [],
......
......@@ -18,7 +18,8 @@ export interface PersonalAppConfigState {
continuousQuestionStatus: 'default' | 'close' //追问状态
continuousQuestionSystem: string // 追问提示词 customizable时必填
continuousQuestionTurn: number // 追问轮次 1-5 customizable时必填
variableStructure: VariableStructureItem[]
variableStructure: VariableStructureItem[] | null
isLongMemory: string
}
knowledgeConfig: {
knowledgeIds: string[] //知识库ID
......
......@@ -24,6 +24,7 @@ const continuousQuestionStatus = ref<'default' | 'close'>(personalAppConfigStore
const continuousQuestionList = ref<string[]>([])
const isShowMemoryPreviewModal = ref(false)
const selectedMemoryTabName = ref('memoryVariable')
function handleAddMessageItem(messageItem: ConversationMessageItem) {
messageList.value.push(messageItem)
......@@ -82,7 +83,8 @@ function handleUpdateContinueQuestionStatus(status: 'default' | 'close') {
// })
// }
function handleMemoryVariable() {
function handleOpenMemoryPreviewModal(MemoryTabName: string) {
selectedMemoryTabName.value = MemoryTabName
isShowMemoryPreviewModal.value = true
}
</script>
......@@ -95,7 +97,13 @@ function handleMemoryVariable() {
{{ t('personal_space_module.agent_module.agent_setting_module.agent_config_module.preview') }}
</p>
<div v-show="personalAppConfigStore.commConfig.variableStructure !== null" class="cursor-pointer">
<div
v-show="
personalAppConfigStore.commConfig.variableStructure !== null ||
personalAppConfigStore.commConfig.isLongMemory === 'Y'
"
class="cursor-pointer"
>
<n-popover placement="bottom" trigger="hover" class="p-[4px]!" :show-arrow="false">
<template #trigger>
<div class="flex items-center justify-center px-5 text-[14px]">
......@@ -110,10 +118,17 @@ function handleMemoryVariable() {
<div
v-show="personalAppConfigStore.commConfig.variableStructure !== null"
class="cursor-pointer px-[8px] py-[5px] hover:bg-[#f2f5f9]"
@click="handleMemoryVariable"
@click="handleOpenMemoryPreviewModal('memoryVariable')"
>
{{ t('personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_variable') }}
</div>
<div
v-show="personalAppConfigStore.commConfig.isLongMemory === 'Y'"
class="cursor-pointer px-[8px] py-[5px] hover:bg-[#f2f5f9]"
@click="handleOpenMemoryPreviewModal('memoryFragment')"
>
{{ t('personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_fragment') }}
</div>
</div>
</n-popover>
</div>
......@@ -157,7 +172,7 @@ function handleMemoryVariable() {
@update-continuous-question-status="handleUpdateContinueQuestionStatus"
/>
<MemoryPreviewModal v-model="isShowMemoryPreviewModal" />
<MemoryPreviewModal v-model="isShowMemoryPreviewModal" :data="selectedMemoryTabName" />
</div>
</template>
......
......@@ -80,6 +80,7 @@ const generateAgentAvatarLoading = ref(false) // 是否正在生成图片
const generatePreambleLoading = ref(false) // 是否正在生成开场白
const generateFeaturedQuestionsLoading = ref(false) // 是否正在生成推荐词
const isShowMemoryVariableModal = ref(false) //是否显示记忆变量弹窗
const isOpenLongMemory = ref(personalAppConfigStore.commConfig.isLongMemory === 'Y')
const personalAppFormRef = ref<FormInst | null>(null)
const agentSystemInputRef = ref<InputInst | null>(null)
......@@ -141,6 +142,13 @@ watch(
{ deep: true },
)
watch(
() => personalAppConfigStore.commConfig.isLongMemory,
(newValue) => {
isOpenLongMemory.value = newValue === 'Y'
},
)
onMounted(async () => {
if (router.currentRoute.value.params.agentId) {
isInitGetAgentAppDetail.value = true
......@@ -473,25 +481,27 @@ function handleShowMemoryVariableModal() {
}
function handleDeleteMemoryVariableItem(memoryVariable: object) {
window.$dialog.warning({
title: '删除提示',
content: '删除后不可撤销。如应用已发布,更新发布后该应用的用户无法使用该记忆变量,是否继续?',
positiveText: '确定',
negativeText: '取消',
onPositiveClick: () => {
window.$message
.ctWarning(
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_variable_delete_tip_content',
),
t('common_module.delete_tip_title'),
)
.then(() => {
if (personalAppConfigStore.commConfig.variableStructure !== null) {
const updatedVariableStructure = personalAppConfigStore.commConfig.variableStructure.filter(
(variable) => variable !== memoryVariable,
)
personalAppConfigStore.updatePersonalAppConfigState({
commConfig: {
...personalAppConfigStore.commConfig,
variableStructure: personalAppConfigStore.commConfig.variableStructure.filter(
(variable) => variable !== memoryVariable,
),
variableStructure: updatedVariableStructure.length > 0 ? updatedVariableStructure : null,
},
})
window.$message.success('删除成功')
},
onNegativeClick: () => {
window.$message.success('已取消')
},
}
window.$message.success(t('common_module.delete_success_message'))
})
}
......@@ -505,7 +515,18 @@ function handleAddMemoryVariable() {
function handleCopyMemoryVariableName(memoryVariableItem: MemoryVariableForm) {
copyToClip(memoryVariableItem.key)
window.$message.success('成功复制名称')
window.$message.success(t('common_module.copy_success_message'))
}
function handleChangeMemoryFragmentState(value: boolean) {
const LongMemoryValue = value ? 'Y' : 'N'
personalAppConfigStore.updatePersonalAppConfigState({
commConfig: {
...personalAppConfigStore.commConfig,
isLongMemory: LongMemoryValue,
},
})
isOpenLongMemory.value = LongMemoryValue === 'Y'
}
</script>
......@@ -982,9 +1003,9 @@ function handleCopyMemoryVariableName(memoryVariableItem: MemoryVariableForm) {
<template #arrow>
<RightOne theme="multi-color" size="17" :fill="['#333', '#333', '#333', '#333']" />
</template>
<NCollapseItem name="preamble" class="my-[13px]!">
<NCollapseItem name="memoryVariable" class="my-[13px]!">
<template #header>
<span class="w-[60px]">{{
<span class="mr-[5px] w-[60px]">{{
t('personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_variable')
}}</span>
<n-popover trigger="hover" placement="top-start" class="p-[12px]! left-[-120px]!" :show-arrow="false">
......@@ -1094,6 +1115,55 @@ function handleCopyMemoryVariableName(memoryVariableItem: MemoryVariableForm) {
</div>
<div class="flex flex-1 flex-wrap items-center gap-[12px] overflow-hidden"></div>
</NCollapseItem>
<NCollapseItem name="memoryFragment" class="my-[13px]!">
<template #header>
<span class="mr-[5px] w-[60px]">
{{
t('personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_fragment')
}}
</span>
<n-popover trigger="hover" placement="top-start" class="p-[12px]! left-[-120px]!" :show-arrow="false">
<template #trigger>
<Help theme="outline" size="15" fill="#333" :stroke-width="2" class="mt-[2px]" />
</template>
<div class="w-[650px] text-[14px]">
<div class="m-w-[100%] mb-[16px] mt-[0px] leading-[22px]">
{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_fragment_message',
)
}}
</div>
<div>
<img src="@/assets/images/memory-fragment.png" width="650" height="206" />
</div>
</div>
</n-popover>
</template>
<template #header-extra>
<n-switch
v-model:value="isOpenLongMemory"
size="small"
@update:value="handleChangeMemoryFragmentState"
>
<template #checked> {{ t('common_module.open') }} </template>
<template #unchecked> {{ t('common_module.close') }} </template>
</n-switch>
</template>
<div>
<div class="mb-[16px] text-xs text-[#84868c]">
{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_fragment_content',
)
}}
</div>
<div class="flex flex-1 flex-wrap items-center gap-[12px] overflow-hidden"></div>
</div>
</NCollapseItem>
</NCollapse>
</div>
</section>
......
<script setup lang="ts">
import { usePersonalAppConfigStore } from '@/store/modules/personal-app-config'
import { Close } from '@icon-park/vue-next'
import { Close, Delete } from '@icon-park/vue-next'
import { DataTableColumns } from 'naive-ui'
import { ref, watch } from 'vue'
import { MemoryVariableForm } from './memory-variable-modal.vue'
import { useI18n } from 'vue-i18n'
import {
fetchDeleteAllLongMemory,
fetchDeleteLongMemoryByKey,
fetchGetLongMemoryList,
fetchGetMemoryVariableList,
} from '@/apis/memory'
interface MemoryVariable {
key: string
value: string
}
interface LongMemory {
date: string
longMemoryContent: { content: string; time: string }[]
}
interface LongMemoryItem {
timestamp: string
content: string
}
const isShowMemoryPreviewModal = defineModel<boolean>()
const props = defineProps<{
data: string
}>()
const { t } = useI18n()
const memoryVariableColumns = createColumns()
const personalAppConfigStore = usePersonalAppConfigStore()
const memoryVariableData = ref([])
const memoryVariableData = ref<MemoryVariable[]>([])
const longMemoryList = ref<LongMemory[]>([])
const isShowMemoryPreviewModal = defineModel<boolean>()
const isMemoryLoading = ref(false)
const memoryTabsInfo = ref([
{
id: 1,
name: 'memoryVariable',
tabName: t('personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_variable'),
},
])
watch(
() => personalAppConfigStore.commConfig.variableStructure,
(newValue) => {
if (newValue !== null) {
if (!memoryTabsInfo.value.some((tab) => tab.id === 1)) {
memoryTabsInfo.value.unshift({
id: 1,
name: 'memoryVariable',
tabName: t('personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_variable'),
})
}
} else {
memoryTabsInfo.value = memoryTabsInfo.value.filter((tab) => tab.id !== 1)
}
},
{ immediate: true },
)
watch(
() => personalAppConfigStore.commConfig.isLongMemory,
(newValue) => {
if (newValue === 'Y') {
if (!memoryTabsInfo.value.some((tab) => tab.id === 2)) {
memoryTabsInfo.value.push({
id: 2,
name: 'memoryFragment',
tabName: t('personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_fragment'),
})
}
} else {
memoryTabsInfo.value = memoryTabsInfo.value.filter((tab) => tab.id !== 2)
}
},
{ immediate: true },
)
function createColumns(): DataTableColumns<MemoryVariableForm> {
return [
......@@ -29,37 +100,154 @@ function createColumns(): DataTableColumns<MemoryVariableForm> {
]
}
watch(
() => personalAppConfigStore.commConfig.variableStructure,
(newValue) => {
if (newValue !== null) {
memoryVariableData.value = JSON.parse(JSON.stringify(newValue))
function handlePreviewModalClose() {
isShowMemoryPreviewModal.value = false
}
function handleDeleteLongMemoryRow(time: string, date: string) {
const agentId = personalAppConfigStore.baseInfo.agentId
const timestamp = date + ' ' + time
window.$message
.ctWarning(
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_fragment_delete_all_tip_content',
),
t('common_module.delete_tip_title'),
)
.then(() => {
fetchDeleteLongMemoryByKey(agentId, timestamp).then(() => {
longMemoryList.value = longMemoryList.value
.map((LongMemoryItem) => {
LongMemoryItem.longMemoryContent = LongMemoryItem.longMemoryContent.filter((item) => {
return item.time !== time || LongMemoryItem.date !== date
})
return LongMemoryItem
})
.filter((memory) => memory.longMemoryContent.length > 0)
window.$message.success(t('common_module.delete_success_message'))
})
})
}
function handleDeleteAllLongMemory() {
const agentId = personalAppConfigStore.baseInfo.agentId
window.$message.ctWarning('数据清空后不可撤销,确定要全部清空吗?', '清空数据提示').then(() => {
fetchDeleteAllLongMemory(agentId).then(() => {
window.$message.success('清空成功')
})
})
}
function handleGetLongMemoryList() {
if (personalAppConfigStore.commConfig.isLongMemory === 'Y') {
fetchGetLongMemoryList(personalAppConfigStore.baseInfo.agentId).then((res) => {
const updateDate = res.data as LongMemoryItem[]
const groupedData: { [key: string]: LongMemory } = updateDate.reduce(
(acc, item: LongMemoryItem) => {
const date = item.timestamp.split(' ')[0]
const time = item.timestamp.split(' ')[1]
const content = item.content
if (!acc[date]) {
acc[date] = { date: date, longMemoryContent: [] }
}
acc[date].longMemoryContent.push({ content: content, time: time })
return acc
},
{ immediate: true },
)
{} as { [key: string]: LongMemory },
)
longMemoryList.value = Object.values(groupedData)
})
}
}
function handlePreviewModalClose() {
isShowMemoryPreviewModal.value = false
function handleGetMemoryVariableList() {
isMemoryLoading.value = true
fetchGetMemoryVariableList(personalAppConfigStore.baseInfo.agentId).then((res) => {
memoryVariableData.value = res.data as MemoryVariable[]
isMemoryLoading.value = false
})
}
function handleModalOpenAfter() {
if (personalAppConfigStore.commConfig.variableStructure !== null) handleGetMemoryVariableList()
if (personalAppConfigStore.commConfig.isLongMemory === 'Y') handleGetLongMemoryList()
}
</script>
<template>
<n-modal v-model:show="isShowMemoryPreviewModal" class="h-auto max-h-[720px]" :mask-closable="false">
<n-modal
v-model:show="isShowMemoryPreviewModal"
class="h-auto max-h-[720px]"
:on-after-enter="handleModalOpenAfter"
:mask-closable="false"
>
<div class="flex flex-col items-center justify-center">
<div class="max-h-[720px] w-[880px] rounded-lg bg-white p-[24px]">
<div class="max-h-[720px] min-h-[500px] w-[880px] rounded-lg bg-white p-[24px]">
<div class="flex items-center justify-end text-[20px]">
<Close theme="outline" size="18" fill="#00000073" class="cursor-pointer" @click="handlePreviewModalClose" />
</div>
<div class="">
<n-tabs type="line" animated>
<n-tab-pane
name="oasis"
:tab="t('personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_variable')"
>
<div class="flex max-h-[490px] justify-center overflow-y-hidden bg-[#f3f4fb]">
<div>
<n-tabs type="line" :default-value="props.data" animated>
<n-tab-pane v-for="tabs in memoryTabsInfo" :key="tabs.id" :name="tabs.name" :tab="tabs.tabName">
<div v-show="isMemoryLoading" class="flex h-[370px] items-center justify-center">
<n-spin size="large" />
</div>
<div v-show="!isMemoryLoading">
<div v-if="tabs.name === 'memoryVariable'" class="flex max-h-[490px] justify-center overflow-y-hidden">
<n-data-table :columns="memoryVariableColumns" :max-height="440" :data="memoryVariableData" />
</div>
<div v-else>
<div v-show="longMemoryList.length !== 0" class="flex w-full justify-end">
<n-button
strong
secondary
class="text-theme-color! bg-[#eef3fe]! px-[11px]! py-[5px]! border-[1px]!"
@click="handleDeleteAllLongMemory"
>{{ t('common_module.wipe_data') }}</n-button
>
</div>
<n-scrollbar style="max-height: 458px">
<div
v-for="(longMemory, longMemoryIndex) in longMemoryList"
:key="longMemoryIndex"
class="border-b-[1px] border-[#0505050f] py-[12px]"
>
<div class="mb-[24px] mt-[12px] text-[16px] font-semibold">
{{ longMemory.date }}
</div>
<div
v-for="(longMemoryContent, longMemoryContentIndex) in longMemory.longMemoryContent"
:key="longMemoryContentIndex"
class="memoryFragmentContent mb-[16px] flex justify-between"
>
<div class="flex items-center">
<div class="w-[80px] text-[#84868c]">{{ longMemoryContent.time }}</div>
<div>{{ longMemoryContent.content }}</div>
</div>
<div class="DeleteBtn mr-[20px] pt-[3px] opacity-0 transition-opacity duration-200">
<n-tooltip trigger="hover">
<template #trigger>
<Delete
theme="outline"
size="15"
fill="#333"
:stroke-width="2"
class="cursor-pointer"
@click="handleDeleteLongMemoryRow(longMemoryContent.time, longMemory.date)"
/>
</template>
{{ t('common_module.delete') }}
</n-tooltip>
</div>
</div>
</div>
<div v-show="longMemoryList.length === 0" class="mt-[60px] flex h-[250px] flex-col items-center">
<img src="@/assets/images/empty.png" width="144px" height="100px" />
<div class="text-[14px]">{{ t('common_module.empty_data') }}</div>
</div>
</n-scrollbar>
</div>
</div>
</n-tab-pane>
</n-tabs>
</div>
......@@ -88,4 +276,10 @@ function handlePreviewModalClose() {
}
}
}
.memoryFragmentContent {
&:hover .DeleteBtn {
opacity: 1;
}
}
</style>
......@@ -4,6 +4,7 @@ import { nextTick, ref, shallowReadonly, watch } from 'vue'
import { usePersonalAppConfigStore } from '@/store/modules/personal-app-config'
import { FormInst, FormItemRule, FormRules } from 'naive-ui'
import { useI18n } from 'vue-i18n'
import { cloneDeep } from 'lodash-es'
export interface MemoryVariableForm {
key: string
......@@ -66,18 +67,28 @@ watch(
() => personalAppConfigStore.commConfig.variableStructure,
(newValue) => {
if (newValue !== null) {
memoryVariableTable.value = JSON.parse(JSON.stringify(newValue))
memoryVariableTable.value = cloneDeep(newValue)
} else {
memoryVariableTable.value = []
}
},
{ immediate: true },
)
function handlePreviewModalClose(refresh = false) {
function handleMemoryPreviewModalClose(refresh = false) {
isShowMemoryVariableModal.value = false
memoryVariableTable.value = refresh
? memoryVariableTable.value
: JSON.parse(JSON.stringify(personalAppConfigStore.commConfig.variableStructure))
: personalAppConfigStore.commConfig.variableStructure
? cloneDeep(personalAppConfigStore.commConfig.variableStructure)
: []
if (Array.isArray(memoryVariableTable.value)) {
memoryVariableTable.value = memoryVariableTable.value.filter((item) => item.key)
} else {
memoryVariableTable.value = []
}
}
function handleMemoryVariableFormSave() {
......@@ -99,7 +110,7 @@ function handleMemoryVariableFormSave() {
if (isAllValid) {
personalAppConfigStore.commConfig.variableStructure = memoryVariableTable.value
handlePreviewModalClose(true)
handleMemoryPreviewModalClose(true)
window.$message.success(t('common_module.save_success_message'))
} else {
window.$message.error(t('common_module.save_fail_message'))
......@@ -149,7 +160,13 @@ defineExpose({
)
}}</span
>
<Close theme="outline" size="18" fill="#00000073" class="cursor-pointer" @click="handlePreviewModalClose()" />
<Close
theme="outline"
size="18"
fill="#00000073"
class="cursor-pointer"
@click="handleMemoryPreviewModalClose()"
/>
</div>
<div
class="mb-[12px] mt-[16px] flex items-center justify-center rounded-[4px] bg-[#FFF4E6] px-[15px] pb-[3px] pt-[4px]"
......@@ -227,7 +244,7 @@ defineExpose({
</th>
</tr>
</thead>
<tbody>
<tbody v-if="memoryVariableTable.length !== 0">
<tr v-for="(item, index) in memoryVariableTable" :key="index">
<td class="pl-[12px]">
<n-form
......@@ -292,7 +309,7 @@ defineExpose({
/>
</n-form-item>
</td>
<td class="ml-[15px] mt-[10px] flex pl-[12px] pt-[10px]">
<td class="ml-[15px] mt-[5px] flex pl-[12px] pt-[10px]">
<n-tooltip trigger="hover">
<template #trigger>
<Delete
......@@ -309,10 +326,48 @@ defineExpose({
</td>
</tr>
</tbody>
<tbody v-else>
<tr>
<td colspan="3">
<div class="flex h-[286px] flex-col items-center">
<img src="@/assets/images/empty.png" width="235px" height="160px" />
<div class="text-[18px]">
{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_variable_modal.none_memory_variable',
)
}}
</div>
<div class="mt-[12px] text-[14px] text-[#84868c]">
{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_variable_modal.add_variable_message',
)
}}
</div>
<div
class="text-theme-color mt-[6px] flex w-[78px] cursor-pointer"
@click="handleAddMemoryVariableItem"
>
<Plus theme="outline" size="22" :stroke-width="2" class="text-theme-color" />
<span>{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_variable_modal.memory_variable_add_now',
)
}}</span>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</n-scrollbar>
<div class="text-theme-color mt-[16px] flex w-[78px] cursor-pointer" @click="handleAddMemoryVariableItem">
<div
v-show="memoryVariableTable.length !== 0"
class="text-theme-color mt-[16px] flex w-[78px] cursor-pointer"
@click="handleAddMemoryVariableItem"
>
<Plus theme="outline" size="22" :stroke-width="2" class="text-theme-color" />
<span>{{
t(
......@@ -323,7 +378,7 @@ defineExpose({
<div class="mt-[24px] flex justify-end">
<button
class="hover:text-theme-color hover:border-theme-color !mr-[12px] box-content !h-[38px] !w-[74px] cursor-pointer rounded-[6px] border-[1px] border-solid border-[#dde3f0] px-[10px] outline-none transition-all duration-300 hover:border-[theme-color]"
@click="handlePreviewModalClose()"
@click="handleMemoryPreviewModalClose()"
>
{{ t('common_module.cancel_btn_text') }}
</button>
......
......@@ -70,6 +70,10 @@ declare namespace I18n {
collect_unsubscribed: string
cancel: string
preservation: string
open: string
close: string
delete_tip_title: string
wipe_data: string
dialogue_module: {
continue_question_message: string
......@@ -244,6 +248,11 @@ declare namespace I18n {
memory_variable_action_copy: string
variable_name: string
variable_value: string
memory_fragment: string
memory_fragment_message: string
memory_fragment_content: string
memory_variable_delete_tip_content: string
memory_fragment_delete_all_tip_content: string
memory_variable_modal: {
edit_memory_variable: string
......@@ -259,6 +268,9 @@ declare namespace I18n {
default_value_placeholder: string
name_placeholder: string
add_variable: string
memory_variable_add_now: string
none_memory_variable: string
add_variable_message: string
memory_variable_rules: {
name_not_null: string
......
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