ai快捷输入

This commit is contained in:
无闻风
2026-06-16 15:22:28 +08:00
parent f712a50fed
commit 6ee664f33b
3 changed files with 36 additions and 2 deletions
+6 -1
View File
@@ -93,7 +93,12 @@
"delete_chat_failed": "Failed to delete chat", "delete_chat_failed": "Failed to delete chat",
"storage_full": "Browser storage is full; the chat may not be saved", "storage_full": "Browser storage is full; the chat may not be saved",
"login_to_sync": "Log in to save chats on the server", "login_to_sync": "Log in to save chats on the server",
"untitled_chat": "New chat" "untitled_chat": "New chat",
"quick_actions": "Quick actions",
"quick_calendar_label": "Summarize this month's schedule",
"quick_calendar_prompt": "Please summarize this month's schedule entries in chronological order.",
"quick_purchase_label": "Summarize this month's purchase spending",
"quick_purchase_prompt": "Please summarize this month's total purchase spending, broken down by category or supplier."
}, },
"aiconfig": { "aiconfig": {
"title": "AI Config", "title": "AI Config",
+6 -1
View File
@@ -93,7 +93,12 @@
"delete_chat_failed": "删除聊天失败", "delete_chat_failed": "删除聊天失败",
"storage_full": "浏览器存储空间不足,聊天可能无法保存", "storage_full": "浏览器存储空间不足,聊天可能无法保存",
"login_to_sync": "登录后可保存聊天到服务端", "login_to_sync": "登录后可保存聊天到服务端",
"untitled_chat": "新对话" "untitled_chat": "新对话",
"quick_actions": "快捷操作",
"quick_calendar_label": "统计本月日程安排",
"quick_calendar_prompt": "请帮我统计本月的日程安排,并按时间顺序汇总。",
"quick_purchase_label": "统计本月采购花费",
"quick_purchase_prompt": "请帮我统计本月的采购花费总额,并按类别或供应商分类汇总。"
}, },
"aiconfig": { "aiconfig": {
"title": "AI 配置", "title": "AI 配置",
@@ -609,6 +609,12 @@ function renderMarkdown(value) {
return rendered return rendered
} }
function sendQuickPrompt(prompt) {
if (pending.value) return
inputText.value = prompt
sendMessage()
}
async function sendMessage() { async function sendMessage() {
const text = inputText.value.trim() const text = inputText.value.trim()
const image = selectedImage.value const image = selectedImage.value
@@ -854,6 +860,24 @@ async function sendMessage() {
<p class="mt-2 text-sm text-gray-500 dark:text-dk-subtle"> <p class="mt-2 text-sm text-gray-500 dark:text-dk-subtle">
{{ t('aichat.empty_hint') }} {{ t('aichat.empty_hint') }}
</p> </p>
<div class="mt-5 flex flex-wrap items-center justify-center gap-2">
<button
type="button"
class="inline-flex items-center gap-2 rounded-full border border-blue-200 bg-blue-50 px-4 py-2 text-sm font-medium text-blue-700 transition-colors hover:bg-blue-100 disabled:cursor-not-allowed disabled:opacity-60 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-200 dark:hover:bg-blue-900/30"
:disabled="pending"
@click="sendQuickPrompt(t('aichat.quick_calendar_prompt'))"
>
{{ t('aichat.quick_calendar_label') }}
</button>
<button
type="button"
class="inline-flex items-center gap-2 rounded-full border border-blue-200 bg-blue-50 px-4 py-2 text-sm font-medium text-blue-700 transition-colors hover:bg-blue-100 disabled:cursor-not-allowed disabled:opacity-60 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-200 dark:hover:bg-blue-900/30"
:disabled="pending"
@click="sendQuickPrompt(t('aichat.quick_purchase_prompt'))"
>
{{ t('aichat.quick_purchase_label') }}
</button>
</div>
</div> </div>
</div> </div>