Commit 1c5fafcb authored by nick zheng's avatar nick zheng

chore: 应用配置记忆、对话模块抽离

parent 1e433485
export interface DiversityModeItem {
label: string
value: string
topP: number
temperature: number
communicationTurn: number
}
export const diversityModeList: DiversityModeItem[] = [
{
label: 'personal_space_module.agent_module.agent_setting_module.agent_config_module.accurate_mode',
value: 'accurate',
topP: 0.1,
temperature: 0.1,
communicationTurn: 3,
},
{
label: 'personal_space_module.agent_module.agent_setting_module.agent_config_module.balance_mode',
value: 'balance',
topP: 0.7,
temperature: 0.5,
communicationTurn: 3,
},
{
label: 'personal_space_module.agent_module.agent_setting_module.agent_config_module.creative_mode',
value: 'creative',
topP: 0.7,
temperature: 0.95,
communicationTurn: 3,
},
{
label: 'common_module.custom',
value: 'custom',
topP: 0.5,
temperature: 0.8,
communicationTurn: 3,
},
]
<script setup lang="ts">
import { computed, h } from 'vue'
import { useI18n } from 'vue-i18n'
import { Help, Down, RightOne } from '@icon-park/vue-next'
import { PersonalAppConfigState } from '@/store/types/personal-app-config'
const { t } = useI18n()
const emit = defineEmits<{
generatePreamble: []
generateFeaturedQuestions: []
}>()
const commConfigExpandedNames = defineModel<string[]>('commConfigExpandedNames', { required: true })
const commConfig = defineModel<PersonalAppConfigState['commConfig']>('commConfig', { required: true })
const generatePreambleLoading = defineModel<boolean>('generatePreambleLoading', { required: true })
const generateFeaturedQuestionsLoading = defineModel<boolean>('generateFeaturedQuestionsLoading', { required: true })
const questionSettingOptions = [
{
label: () =>
h(
'span',
{},
t('personal_space_module.agent_module.agent_setting_module.agent_config_module.continuous_question_default'),
),
value: 'default',
style: { fontSize: '12px' },
},
{
label: () =>
h(
'span',
{},
t('personal_space_module.agent_module.agent_setting_module.agent_config_module.continuous_question_close'),
),
value: 'close',
style: { fontSize: '12px' },
},
]
const continuousQuestionStatusText = computed(() => {
return commConfig.value.continuousQuestionStatus === 'default'
? t('personal_space_module.agent_module.agent_setting_module.agent_config_module.continuous_question_default')
: t('personal_space_module.agent_module.agent_setting_module.agent_config_module.continuous_question_close')
})
function handleUpdateCommConfigExpandedNames(expandedNames: string[]) {
commConfigExpandedNames.value = expandedNames
}
function handleAIGeneratePreamble() {
emit('generatePreamble')
}
function handleAIGenerateFeaturedQuestions() {
emit('generateFeaturedQuestions')
}
</script>
<template>
<section class="border-b border-[#e8e9eb] px-5">
<div class="pt-4">
<h2 class="my-3 text-[#84868c]">
{{ t('personal_space_module.agent_module.agent_setting_module.agent_config_module.dialogue') }}
</h2>
<NCollapse
:expanded-names="commConfigExpandedNames"
:trigger-areas="['main', 'arrow']"
@update:expanded-names="handleUpdateCommConfigExpandedNames"
>
<template #arrow>
<RightOne theme="multi-color" size="17" :fill="['#333', '#333', '#333', '#333']" />
</template>
<NCollapseItem
:title="t('personal_space_module.agent_module.agent_setting_module.agent_config_module.preamble')"
name="preamble"
class="my-[13px]!"
>
<template #header-extra>
<NTooltip trigger="hover">
<template #trigger>
<div
class="h-4 w-4 bg-[length:100%_100%]"
:class="
generatePreambleLoading
? 'bg-[url(@/assets/images/loading.gif)]'
: 'bg-[url(@/assets/svgs/star.svg)]'
"
@click="handleAIGeneratePreamble"
/>
</template>
{{ t('common_module.ai_generate') }}
</NTooltip>
</template>
<NInput
v-model:value="commConfig.preamble"
type="textarea"
:rows="5"
:disabled="generatePreambleLoading"
class="text-xs! rounded-md!"
:placeholder="
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.preamble_input_placeholder',
)
"
/>
</NCollapseItem>
<NCollapseItem
:title="t('personal_space_module.agent_module.agent_setting_module.agent_config_module.featured_questions')"
name="featuredQuestions"
class="my-[13px]!"
>
<template #header-extra>
<NTooltip trigger="hover">
<template #trigger>
<div
class="h-4 w-4 bg-[length:100%_100%]"
:class="
generateFeaturedQuestionsLoading
? 'bg-[url(@/assets/images/loading.gif)]'
: 'bg-[url(@/assets/svgs/star.svg)]'
"
@click="handleAIGenerateFeaturedQuestions"
/>
</template>
{{ t('common_module.ai_generate') }}
</NTooltip>
</template>
<NDynamicInput
v-model:value="commConfig.featuredQuestions"
:placeholder="
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.featured_questions_input_placeholder',
)
"
class="rounded-md"
:min="1"
:max="3"
:disabled="generateFeaturedQuestionsLoading"
>
<template #create-button-default> {{ t('common_module.add') }} </template>
</NDynamicInput>
</NCollapseItem>
<NCollapseItem name="continuousQuestion" class="my-[13px]!">
<template #header>
<div class="flex items-center">
<span>
{{
t('personal_space_module.agent_module.agent_setting_module.agent_config_module.continuous_question')
}}
</span>
<NPopover trigger="hover">
<template #trigger>
<Help
theme="outline"
size="15"
fill="#333"
:stroke-width="3"
class="ml-1 cursor-pointer text-base text-[#999] outline-none"
/>
</template>
<span class="text-xs">
{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.continuous_question_popover_message',
)
}}
</span>
</NPopover>
</div>
</template>
<template #header-extra>
<NPopselect
v-model:value="commConfig.continuousQuestionStatus"
:options="questionSettingOptions"
trigger="click"
content-class="text-xs"
>
<div class="text-theme-color flex cursor-pointer items-center justify-between text-xs">
<span> {{ continuousQuestionStatusText }}</span>
<Down theme="outline" size="16" class="text-theme-color ml-1 text-base" />
</div>
</NPopselect>
</template>
<div>
<span v-show="commConfig.continuousQuestionStatus === 'default'" class="text-xs text-[#84868c]">
{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.continuous_question_default_desc',
)
}}
</span>
<span v-show="commConfig.continuousQuestionStatus === 'close'" class="text-xs text-[#84868c]">
{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.continuous_question_close_desc',
)
}}
</span>
</div>
</NCollapseItem>
</NCollapse>
</div>
</section>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { Plus, Help, MoreOne, Edit, Copy, ReduceOne, RightOne } from '@icon-park/vue-next'
import MemoryVariableModal, { MemoryVariableForm } from './memory-variable-modal.vue'
import { VariableStructureItem } from '@/store/types/personal-app-config'
import { copyToClip } from '@/utils/copy'
const { t } = useI18n()
const variableStructure = defineModel<VariableStructureItem[] | null>('variableStructure', { required: true })
const isLongMemory = defineModel<string>('isLongMemory', { required: true })
const memoryExpandedNames = ref<string[]>([])
const isOpenLongMemory = ref(false)
const isShowMemoryVariableModal = ref(false)
const memoryVariableModal = ref<InstanceType<typeof MemoryVariableModal> | null>(null)
watch(
() => isLongMemory.value,
(newValue) => {
isOpenLongMemory.value = newValue === 'Y'
},
{ once: true },
)
watch(
() => variableStructure.value,
(newValue) => {
newValue?.length && (memoryExpandedNames.value = ['memoryVariable'])
},
)
function handleUpdateMemoryExpandedNames(expandedNames: string[]) {
memoryExpandedNames.value = expandedNames
}
function handleShowMemoryVariableModal() {
isShowMemoryVariableModal.value = true
}
function handleAddMemoryVariable() {
isShowMemoryVariableModal.value = true
if (memoryVariableModal.value) {
memoryVariableModal.value.handleAddMemoryVariableItem()
}
}
function handleCopyMemoryVariableName(memoryVariableItem: MemoryVariableForm) {
copyToClip(memoryVariableItem.key)
window.$message.success(t('common_module.copy_success_message'))
}
function handleDeleteMemoryVariableItem(memoryVariable: object) {
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 (variableStructure.value !== null) {
const updatedVariableStructure = variableStructure.value.filter((variable) => variable !== memoryVariable)
variableStructure.value = updatedVariableStructure.length > 0 ? updatedVariableStructure : null
}
window.$message.success(t('common_module.delete_success_message'))
})
}
function handleChangeMemoryFragmentState(value: boolean) {
isOpenLongMemory.value = value
}
</script>
<template>
<section class="border-b border-[#e8e9eb] px-5">
<div class="pt-4">
<h2 class="my-3 text-[#84868c]">
{{ t('personal_space_module.agent_module.agent_setting_module.agent_config_module.memory') }}
</h2>
<NCollapse
:expanded-names="memoryExpandedNames"
:trigger-areas="['main', 'arrow']"
@update:expanded-names="handleUpdateMemoryExpandedNames"
>
<template #arrow>
<RightOne theme="multi-color" size="17" :fill="['#333', '#333', '#333', '#333']" />
</template>
<NCollapseItem name="memoryVariable" class="my-[13px]!">
<template #header>
<span class="mr-[5px] min-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">
<template #trigger>
<Help theme="outline" size="15" fill="#333" :stroke-width="3" 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_message') }}
</div>
<div>
<img src="@/assets/images/memory-variableLabels.png" width="650" height="206" />
</div>
</div>
</n-popover>
</template>
<template #header-extra>
<NTooltip trigger="hover">
<template #trigger>
<Plus
theme="outline"
size="22"
:stroke-width="3"
class="text-theme-color cursor-pointer"
@click="handleAddMemoryVariable"
/>
</template>
{{ t('personal_space_module.agent_module.agent_setting_module.agent_config_module.add_memory_variable') }}
</NTooltip>
</template>
<div class="text-xs text-[#84868c]">
{{
t('personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_variable_message')
}}
</div>
<div
v-show="variableStructure !== null"
class="mt-4 flex flex-1 flex-wrap items-center gap-[12px] overflow-hidden"
>
<div
v-for="(memoryVariableItem, index) in variableStructure"
:key="index"
class="font-400 line-height-[20px] flex cursor-pointer items-center rounded-[4px] bg-[#f2f5f9] py-[2px] pl-[8px] text-[12px] hover:bg-[#e3e8f0]"
@click="handleShowMemoryVariableModal"
>
<n-popover v-if="memoryVariableItem.key.length > 8" trigger="hover" class="max-w-[250px]!">
<template #trigger>
<div class="max-w-[105px] truncate text-[#151b26]">{{ memoryVariableItem.key }}</div>
</template>
{{ memoryVariableItem.key }}
</n-popover>
<div v-else class="max-w-[105px] truncate text-[#151b26]">{{ memoryVariableItem.key }}</div>
<n-popover placement="bottom" trigger="hover" :show-arrow="false" class="p-[4px]!">
<template #trigger>
<MoreOne theme="outline" size="14" fill="#333" :stroke-width="3" class="mr-[4px] mt-[2px]" />
</template>
<div class="text-[12px]">
<div
class="flex h-[30px] w-[90px] cursor-pointer items-center justify-start px-[8px] py-[5px] hover:rounded-[4px] hover:bg-[#f2f5f9]"
@click="handleShowMemoryVariableModal"
>
<Edit theme="outline" size="16" fill="#333" :stroke-width="3" /><span class="ml-[4px]">
{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_variable_action_edit',
)
}}
</span>
</div>
<div
class="flex h-[30px] w-[90px] cursor-pointer items-center justify-start px-[8px] py-[5px] hover:rounded-[4px] hover:bg-[#f2f5f9]"
@click="handleCopyMemoryVariableName(memoryVariableItem)"
>
<Copy theme="outline" size="16" fill="#333" :stroke-width="3" />
<span class="ml-[4px]">
{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_variable_action_copy',
)
}}
</span>
</div>
<n-space>
<div
class="flex h-[30px] w-[90px] cursor-pointer items-center justify-start px-[8px] py-[5px] hover:rounded-[4px] hover:bg-[#f2f5f9]"
@click="handleDeleteMemoryVariableItem(memoryVariableItem)"
>
<ReduceOne theme="outline" size="16" fill="#333" :stroke-width="3" />
<span class="ml-[4px]">
{{ t('common_module.delete') }}
</span>
</div>
</n-space>
</div>
</n-popover>
</div>
</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] min-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="3" 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="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>
<MemoryVariableModal ref="memoryVariableModal" v-model="isShowMemoryVariableModal" />
</template>
<script setup lang="ts">
import { computed, h, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
import { useRouter } from 'vue-router'
import { FormInst, InputInst } from 'naive-ui'
import { useI18n } from 'vue-i18n'
import { useThrottleFn } from '@vueuse/core'
import CustomIcon from '@/components/custom-icon/custom-icon.vue'
import { Plus, Help, MoreOne, Edit, Copy, ReduceOne, Down, People, RightOne } from '@icon-park/vue-next'
import { Help, People, RightOne } from '@icon-park/vue-next'
import UploadImage from '@/components/upload-image/upload-image.vue'
import AutoConfigModal from './auto-config-modal.vue'
import OptimizeSystemModal from './optimize-system-modal.vue'
......@@ -21,11 +21,10 @@ import {
fetchSaveAgentApplication,
} from '@/apis/agent-application'
import { fetchCustomEventSource } from '@/composables/useEventSource'
import MemoryVariableModal from './memory-variable-modal.vue'
import type { MemoryVariableForm } from './memory-variable-modal.vue'
import AgentModelSetting from './agent-model-setting.vue'
import AgentAssociatedKnowledge from './agent-associated-knowledge.vue'
import { copyToClip } from '@/utils/copy'
import AgentMemorySetting from './agent-memory-setting.vue'
import AgentDialogueSetting from './agent-dialogue-setting.vue'
const { t } = useI18n()
......@@ -37,29 +36,6 @@ const defaultPrompt = t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.agent_system_template_message',
)
const questionSettingOptions = [
{
label: () =>
h(
'span',
{},
t('personal_space_module.agent_module.agent_setting_module.agent_config_module.continuous_question_default'),
),
value: 'default',
style: { fontSize: '12px' },
},
{
label: () =>
h(
'span',
{},
t('personal_space_module.agent_module.agent_setting_module.agent_config_module.continuous_question_close'),
),
value: 'close',
style: { fontSize: '12px' },
},
]
const currentLargeModelIcon = ref('') // 当前大模型icon
const commConfigExpandedNames = ref<string[]>(['continuousQuestion'])
......@@ -75,12 +51,9 @@ const isShowOptimizeAgentSystemModal = ref(false) // 是否显示优化角色指
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)
const memoryVariableModal = ref<InstanceType<typeof MemoryVariableModal> | null>(null)
const personalAppRules = {
baseInfo: {
......@@ -108,12 +81,6 @@ const personalAppConfig = computed(() => {
return personalAppConfigStore.$state
})
const continuousQuestionStatusText = computed(() => {
return personalAppConfig.value.commConfig.continuousQuestionStatus === 'default'
? t('personal_space_module.agent_module.agent_setting_module.agent_config_module.continuous_question_default')
: t('personal_space_module.agent_module.agent_setting_module.agent_config_module.continuous_question_close')
})
const isUpdatePersonalAgentConfig = computed(() => {
return !isInitGetAgentAppDetail.value
})
......@@ -134,13 +101,6 @@ watch(
{ deep: true },
)
watch(
() => personalAppConfigStore.commConfig.isLongMemory,
(newValue) => {
isOpenLongMemory.value = newValue === 'Y'
},
)
onMounted(async () => {
if (router.currentRoute.value.params.agentId) {
isInitGetAgentAppDetail.value = true
......@@ -245,10 +205,6 @@ function handleUploadAvatarOversize() {
)
}
function handleUpdateCommConfigExpandedNames(expandedNames: string[]) {
commConfigExpandedNames.value = expandedNames
}
async function handleAIGenerateAgentAvatar() {
generateAgentAvatarLoading.value = true
generateAgentAvatarController = new AbortController()
......@@ -413,59 +369,6 @@ function handleStopGenerate() {
generateAgentSystemController?.abort()
isFullScreenLoading.value = false
}
function handleShowMemoryVariableModal() {
isShowMemoryVariableModal.value = true
}
function handleDeleteMemoryVariableItem(memoryVariable: object) {
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: updatedVariableStructure.length > 0 ? updatedVariableStructure : null,
},
})
}
window.$message.success(t('common_module.delete_success_message'))
})
}
function handleAddMemoryVariable() {
isShowMemoryVariableModal.value = true
if (memoryVariableModal.value) {
memoryVariableModal.value.handleAddMemoryVariableItem()
}
}
function handleCopyMemoryVariableName(memoryVariableItem: MemoryVariableForm) {
copyToClip(memoryVariableItem.key)
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>
<template>
......@@ -705,341 +608,19 @@ function handleChangeMemoryFragmentState(value: boolean) {
<AgentAssociatedKnowledge v-model:knowledge-config="personalAppConfig.knowledgeConfig" />
<section class="border-b border-[#e8e9eb] px-5">
<div class="pt-4">
<h2 class="my-3 text-[#84868c]">
{{ t('personal_space_module.agent_module.agent_setting_module.agent_config_module.memory') }}
</h2>
<NCollapse
:expanded-names="commConfigExpandedNames"
:trigger-areas="['main', 'arrow']"
@update:expanded-names="handleUpdateCommConfigExpandedNames"
>
<template #arrow>
<RightOne theme="multi-color" size="17" :fill="['#333', '#333', '#333', '#333']" />
</template>
<NCollapseItem name="memoryVariable" class="my-[13px]!">
<template #header>
<span class="mr-[5px] min-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">
<template #trigger>
<Help theme="outline" size="15" fill="#333" :stroke-width="3" 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_message',
)
}}
</div>
<div>
<img src="@/assets/images/memory-variableLabels.png" width="650" height="206" />
</div>
</div>
</n-popover>
</template>
<template #header-extra>
<NTooltip trigger="hover">
<template #trigger>
<Plus
theme="outline"
size="22"
:stroke-width="3"
class="text-theme-color cursor-pointer"
@click="handleAddMemoryVariable"
/>
</template>
{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.add_memory_variable',
)
}}
</NTooltip>
</template>
<div class="mb-[16px] text-xs text-[#84868c]">
{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_variable_message',
)
}}
</div>
<div
v-show="personalAppConfigStore.commConfig.variableStructure !== null"
class="flex flex-1 flex-wrap items-center gap-[12px] overflow-hidden"
>
<div
v-for="(memoryVariableItem, index) in personalAppConfigStore.commConfig.variableStructure"
:key="index"
class="font-400 line-height-[20px] flex cursor-pointer items-center rounded-[4px] bg-[#f2f5f9] py-[2px] pl-[8px] text-[12px] hover:bg-[#e3e8f0]"
@click="handleShowMemoryVariableModal"
>
<n-popover v-if="memoryVariableItem.key.length > 8" trigger="hover" class="max-w-[250px]!">
<template #trigger>
<div class="max-w-[105px] truncate text-[#151b26]">{{ memoryVariableItem.key }}</div>
</template>
{{ memoryVariableItem.key }}
</n-popover>
<div v-else class="max-w-[105px] truncate text-[#151b26]">{{ memoryVariableItem.key }}</div>
<n-popover placement="bottom" trigger="hover" :show-arrow="false" class="p-[4px]!">
<template #trigger>
<MoreOne theme="outline" size="14" fill="#333" :stroke-width="3" class="mr-[4px] mt-[2px]" />
</template>
<div class="text-[12px]">
<div
class="flex h-[30px] w-[90px] cursor-pointer items-center justify-start px-[8px] py-[5px] hover:rounded-[4px] hover:bg-[#f2f5f9]"
@click="handleShowMemoryVariableModal"
>
<Edit theme="outline" size="16" fill="#333" :stroke-width="3" /><span class="ml-[4px]">
{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_variable_action_edit',
)
}}
</span>
</div>
<div
class="flex h-[30px] w-[90px] cursor-pointer items-center justify-start px-[8px] py-[5px] hover:rounded-[4px] hover:bg-[#f2f5f9]"
@click="handleCopyMemoryVariableName(memoryVariableItem)"
>
<Copy theme="outline" size="16" fill="#333" :stroke-width="3" />
<span class="ml-[4px]">
{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.memory_variable_action_copy',
)
}}
</span>
</div>
<n-space>
<div
class="flex h-[30px] w-[90px] cursor-pointer items-center justify-start px-[8px] py-[5px] hover:rounded-[4px] hover:bg-[#f2f5f9]"
@click="handleDeleteMemoryVariableItem(memoryVariableItem)"
>
<ReduceOne theme="outline" size="16" fill="#333" :stroke-width="3" /><span class="ml-[4px]">
{{ t('common_module.delete') }}
</span>
</div>
</n-space>
</div>
</n-popover>
</div>
</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] min-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="3" 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>
<section class="border-b border-[#e8e9eb] px-5">
<div class="pt-4">
<h2 class="my-3 text-[#84868c]">
{{ t('personal_space_module.agent_module.agent_setting_module.agent_config_module.dialogue') }}
</h2>
<NCollapse
:expanded-names="commConfigExpandedNames"
:trigger-areas="['main', 'arrow']"
@update:expanded-names="handleUpdateCommConfigExpandedNames"
>
<template #arrow>
<RightOne theme="multi-color" size="17" :fill="['#333', '#333', '#333', '#333']" />
</template>
<NCollapseItem
:title="t('personal_space_module.agent_module.agent_setting_module.agent_config_module.preamble')"
name="preamble"
class="my-[13px]!"
>
<template #header-extra>
<NTooltip trigger="hover">
<template #trigger>
<div
class="h-4 w-4 bg-[length:100%_100%]"
:class="
generatePreambleLoading
? 'bg-[url(@/assets/images/loading.gif)]'
: 'bg-[url(@/assets/svgs/star.svg)]'
"
@click="handleAIGeneratePreamble"
/>
</template>
{{ t('common_module.ai_generate') }}
</NTooltip>
</template>
<NInput
v-model:value="personalAppConfig.commConfig.preamble"
type="textarea"
:rows="5"
:disabled="generatePreambleLoading"
class="text-xs! rounded-md!"
:placeholder="
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.preamble_input_placeholder',
)
"
/>
</NCollapseItem>
<NCollapseItem
:title="
t('personal_space_module.agent_module.agent_setting_module.agent_config_module.featured_questions')
"
name="featuredQuestions"
class="my-[13px]!"
>
<template #header-extra>
<NTooltip trigger="hover">
<template #trigger>
<div
class="h-4 w-4 bg-[length:100%_100%]"
:class="
generateFeaturedQuestionsLoading
? 'bg-[url(@/assets/images/loading.gif)]'
: 'bg-[url(@/assets/svgs/star.svg)]'
"
@click="handleAIGenerateFeaturedQuestions"
/>
</template>
{{ t('common_module.ai_generate') }}
</NTooltip>
</template>
<NDynamicInput
v-model:value="personalAppConfig.commConfig.featuredQuestions"
:placeholder="
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.featured_questions_input_placeholder',
)
"
class="rounded-md"
:min="1"
:max="3"
:disabled="generateFeaturedQuestionsLoading"
/>
</NCollapseItem>
<NCollapseItem name="continuousQuestion" class="my-[13px]!">
<template #header>
<div class="flex items-center">
<span>
{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.continuous_question',
)
}}
</span>
<NPopover trigger="hover">
<template #trigger>
<Help
theme="outline"
size="15"
fill="#333"
:stroke-width="3"
class="ml-1 cursor-pointer text-base text-[#999] outline-none"
/>
</template>
<span class="text-xs">
{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.continuous_question_popover_message',
)
}}
</span>
</NPopover>
</div>
</template>
<template #header-extra>
<NPopselect
v-model:value="personalAppConfig.commConfig.continuousQuestionStatus"
:options="questionSettingOptions"
trigger="click"
content-class="text-xs"
>
<div class="text-theme-color flex cursor-pointer items-center justify-between text-xs">
<span> {{ continuousQuestionStatusText }}</span>
<Down theme="outline" size="16" class="text-theme-color ml-1 text-base" />
</div>
</NPopselect>
</template>
<div>
<span
v-show="personalAppConfig.commConfig.continuousQuestionStatus === 'default'"
class="text-xs text-[#84868c]"
>
{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.continuous_question_default_desc',
)
}}
</span>
<span
v-show="personalAppConfig.commConfig.continuousQuestionStatus === 'close'"
class="text-xs text-[#84868c]"
>
{{
t(
'personal_space_module.agent_module.agent_setting_module.agent_config_module.continuous_question_close_desc',
)
}}
</span>
</div>
</NCollapseItem>
</NCollapse>
</div>
</section>
<AgentMemorySetting
v-model:variable-structure="personalAppConfig.commConfig.variableStructure"
v-model:is-long-memory="personalAppConfig.commConfig.isLongMemory"
/>
<AgentDialogueSetting
v-model:comm-config-expanded-names="commConfigExpandedNames"
v-model:comm-config="personalAppConfig.commConfig"
v-model:generate-featured-questions-loading="generateFeaturedQuestionsLoading"
v-model:generate-preamble-loading="generatePreambleLoading"
@generate-preamble="handleAIGeneratePreamble"
@generate-featured-questions="handleAIGenerateFeaturedQuestions"
/>
</div>
</div>
</div>
......@@ -1084,8 +665,6 @@ function handleChangeMemoryFragmentState(value: boolean) {
"
@confirm="handleSettingAgentSystem"
/>
<MemoryVariableModal ref="memoryVariableModal" v-model="isShowMemoryVariableModal" />
</template>
<style lang="scss" scoped>
......
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