diff --git a/src/components/ai/AiPanel.vue b/src/components/ai/AiPanel.vue index e63ec48..69b5a3c 100644 --- a/src/components/ai/AiPanel.vue +++ b/src/components/ai/AiPanel.vue @@ -9,6 +9,7 @@ import { store } from '../../core/store' import { generate, polish, chat, beautifyPage, isConfigured } from '../../core/ai' import { elementTypes } from '../../core/sample' import { renderMd } from '../../core/markdown' +import { appPrompt, appConfirm } from '../../core/dialog' import OutlinePanel from './OutlinePanel.vue' const emit = defineEmits<{ @@ -292,7 +293,7 @@ function onStop() { /* ---------- 生成整套 ---------- */ async function onGenerate() { if (busy.value) return - const topic = inputText.value.trim() || prompt('请输入演示主题,例如「远程办公的兴起与未来」') + const topic = inputText.value.trim() || await appPrompt('生成整套', { message: '请输入演示主题', placeholder: '例如「远程办公的兴起与未来」' }) if (!topic) return if (!isConfigured()) { toast('请先配置 API Key'); emit('open-settings'); return } inputText.value = '' @@ -345,9 +346,9 @@ async function onPolish() { } /* ---------- 清空 ---------- */ -function onClear() { +async function onClear() { if (!chatLog.value.length) { toast('对话已是空的'); return } - if (!confirm('清空当前 PPT 的对话记录?')) return + if (!(await appConfirm('清空对话记录?', '将清空当前 PPT 的对话记录', { danger: true, okText: '清空' }))) return chatLog.value = [] store.clearChat(currentChatId.value) renderMsgs.value = [] diff --git a/src/components/common/AppDialog.vue b/src/components/common/AppDialog.vue new file mode 100644 index 0000000..27f8581 --- /dev/null +++ b/src/components/common/AppDialog.vue @@ -0,0 +1,66 @@ + + + + + + + + {{ dialogState.options.value.title }} + {{ dialogState.options.value.message }} + + + + + 取消 + {{ dialogState.options.value.okText || '确定' }} + + + + + diff --git a/src/components/editor/ThumbBar.vue b/src/components/editor/ThumbBar.vue index e00d98a..344357e 100644 --- a/src/components/editor/ThumbBar.vue +++ b/src/components/editor/ThumbBar.vue @@ -4,6 +4,7 @@
{{ dialogState.options.value.message }}