11<template >
22 <el-dialog
33 align-center
4- :title =" $t('长期记忆设置 ')"
4+ :title =" $t('views.application.longTermMemory.setting ')"
55 v-model =" dialogVisible"
66 style =" width : 550px "
77 append-to-body
1313 ref =" paramFormRef"
1414 :model =" form"
1515 require-asterisk-position =" right"
16- hide-required-asterisk
1716 @submit.prevent
1817 >
1918 <el-form-item
20- :label =" $t('触发方式 ')"
19+ :label =" $t('views.application.longTermMemory.triggerType ')"
2120 prop =" trigger_type"
2221 :rules =" {
2322 message: $t('common.selectPlaceholder'),
3332 >
3433 <div class =" flex align-center line-height-22" >
3534 <el-avatar shape =" square" class =" avatar-orange" :size =" 32" >
36- <img src =" @/assets/trigger/icon_event.svg" style =" width : 58% " alt =" " />
35+ <img src =" @/assets/trigger/icon_event.svg" style =" width : 58% " alt =" " />
3736 </el-avatar >
3837 <div class =" ml-12" >
39- <h5 >{{ $t('按轮次触发') }}</h5 >
40- <el-text type =" info" class =" color-secondary font-small" >{{
41- $t('累计到N轮后,自动提炼N轮对话,生成记忆')
42- }}
38+ <h5 >{{ $t('views.application.longTermMemory.roundTrigger') }}</h5 >
39+ <el-text type =" info" class =" color-secondary font-small"
40+ >{{ $t('views.application.longTermMemory.roundTriggerTip') }}
4341 </el-text >
4442 </div >
4543 </div >
4644 <el-card v-if =" form.trigger_type === 'ROUND'" shadow =" never" class =" card-never mt-16" >
47- <el-form-item :label =" $t('触发间隔')" >
48- <el-input-number v-model =" form.trigger_setting.rounds" />
45+ <el-form-item :label =" $t('views.application.longTermMemory.triggerInterval')" required >
46+ <el-input-number
47+ v-model =" form.trigger_setting.rounds"
48+ :value-on-clear =" 0"
49+ :min =" 5"
50+ :max =" 100"
51+ />
4952 </el-form-item >
5053 </el-card >
5154 </el-card >
5760 >
5861 <div class =" flex align-center line-height-22" >
5962 <el-avatar shape =" square" :size =" 32" >
60- <img src =" @/assets/trigger/icon_scheduled.svg" style =" width : 58% " alt =" " />
63+ <img src =" @/assets/trigger/icon_scheduled.svg" style =" width : 58% " alt =" " />
6164 </el-avatar >
6265 <div class =" ml-12" >
63- <h5 >{{ $t('按时间触发') }}</h5 >
64- <el-text type =" info" class =" color-secondary font-small" >{{
65- $t('到设定时间后,自动提炼周期内所有对话,生成记忆')
66- }}
66+ <h5 >{{ $t('views.application.longTermMemory.scheduledTrigger') }}</h5 >
67+ <el-text type =" info" class =" color-secondary font-small"
68+ >{{ $t('views.application.longTermMemory.scheduledTriggerTip') }}
6769 </el-text >
6870 </div >
6971 </div >
9294 >
9395 <el-button text @click.stop =" switchScheduleType" >
9496 <el-icon >
95- <Switch />
97+ <Switch />
9698 </el-icon >
9799 </el-button >
98100 </el-tooltip >
127129 </el-button >
128130 </span >
129131 </template >
130-
131132 </el-dialog >
132133</template >
133134
134135<script setup lang="ts">
135-
136-
137- import { computed , ref } from " vue" ;
138- import { triggerCycleOptions } from " @/utils/trigger.ts" ;
139- import { t } from " @/locales" ;
140- import { cloneDeep } from " lodash" ;
141- import { isValidCron } from " cron-validator" ;
136+ import { computed , ref } from ' vue'
137+ import { triggerCycleOptions } from ' @/utils/trigger.ts'
138+ import { t } from ' @/locales'
139+ import { cloneDeep } from ' lodash'
140+ import { isValidCron } from ' cron-validator'
142141
143142const emit = defineEmits ([' refresh' ])
144143const dialogVisible = ref (false )
@@ -147,7 +146,7 @@ const loading = ref(false)
147146const form = ref <any >({
148147 trigger_type: ' ROUND' ,
149148 trigger_setting: {
150- rounds: 10
149+ rounds: 10 ,
151150 },
152151})
153152
@@ -166,7 +165,7 @@ const validateCron = () => {
166165 }
167166 const fields = cron .split (/ \s + / )
168167 if (fields .length !== 5 || ! isValidCron (cron )) {
169- cronError .value = ' Cron表达式不合法 '
168+ cronError .value = t ( ' views.application.longTermMemory.cronExpressionInvalid ' )
170169 } else {
171170 cronError .value = ' '
172171 }
@@ -247,7 +246,7 @@ const scheduled = computed({
247246
248247const open = (trigger_type : any , trigger_setting : any ) => {
249248 dialogVisible .value = true
250- form .value .trigger_setting = trigger_setting ?? {rounds: 10 }
249+ form .value .trigger_setting = trigger_setting ?? { rounds: 10 }
251250 form .value .trigger_type = trigger_type ?? ' ROUND'
252251}
253252
@@ -260,7 +259,7 @@ const submit = () => {
260259 })
261260}
262261
263- defineExpose ({open })
262+ defineExpose ({ open })
264263 </script >
265264
266265<style lang="scss" scoped></style >
0 commit comments