Skip to content

Commit

Permalink
功能优化
Browse files Browse the repository at this point in the history
  • Loading branch information
classfang committed May 7, 2024
1 parent 5e33d9e commit c5f0642
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
4 changes: 1 addition & 3 deletions src/renderer/src/components/modal/Setting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -677,9 +677,7 @@ onMounted(() => {
v-for="m in chatModels[settingStore.aiCalendar.bigModel.provider]"
:key="m.name"
>
<a-option v-if="m['type'] === 'text'" :value="m.value">{{
m['name']
}}</a-option>
<a-option :value="m.value">{{ m['name'] }}</a-option>
</template>
</a-select>
</a-space>
Expand Down
35 changes: 25 additions & 10 deletions src/renderer/src/components/views/ai-calendar/AICalendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const calendarStore = useCalendarStore()
// i18n
const { t } = useI18n()
// 阻断控制
let abortCtr = new AbortController()
// 数据绑定
const data = reactive({
currentSessionId: randomUUID(),
Expand Down Expand Up @@ -233,6 +236,14 @@ const generateReport = async () => {
...otherOption
})
}
// 手动结束
const stopGenerateReport = () => {
data.currentSessionId = randomUUID()
systemStore.aiCalendarLoading = false
abortCtr.abort()
abortCtr = new AbortController()
}
</script>

<template>
Expand Down Expand Up @@ -356,16 +367,20 @@ const generateReport = async () => {
</div>
<template #footer>
<div style="display: flex; gap: 10px">
<a-button
v-if="reportModalType != 'day'"
:loading="systemStore.aiCalendarLoading"
@click="generateReport"
>
<span>{{ $t('aiCalendar.generate') }}</span>
<template #icon>
<icon-robot />
</template>
</a-button>
<template v-if="reportModalType != 'day'">
<a-button v-if="!systemStore.aiCalendarLoading" @click="generateReport">
<span>{{ $t('aiCalendar.generate') }}</span>
<template #icon>
<icon-robot />
</template>
</a-button>
<a-button v-else @click="stopGenerateReport">
<span>{{ $t('aiCalendar.stopGenerate') }}</span>
<template #icon>
<icon-record-stop />
</template>
</a-button>
</template>
<a-button style="margin-left: auto" @click="handleReportModalCancel"
>{{ $t('common.cancel') }}
</a-button>
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/i18n/local/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@
"aiCalendar": {
"name": "AI Calendar",
"generate": "AI generate",
"stopGenerate": "Stop generate",
"noDayReportError": "There are no daily papers available during the week",
"dayReport": {
"name": "Daily report",
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/i18n/local/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@
"aiCalendar": {
"name": "AI 日历",
"generate": "AI 生成",
"stopGenerate": "停止生成",
"noDayReportError": "该周期内暂无日报",
"dayReport": {
"name": "日报",
Expand Down

0 comments on commit c5f0642

Please sign in to comment.