新增: UX队列三件套(打断保留续发+队列编辑+立即发送)
This commit is contained in:
@@ -515,9 +515,29 @@
|
||||
</div>
|
||||
<div class="ai-queue-list">
|
||||
<div v-for="(item, idx) in store.state.queue" :key="idx" class="ai-queue-item">
|
||||
<span v-if="item.skill" class="ai-queue-skill">/{{ item.skill }}</span>
|
||||
<span class="ai-queue-text">{{ item.text }}</span>
|
||||
<button class="ai-queue-x" @click="store.cancelQueued(idx)" :title="$t('common.cancel')">×</button>
|
||||
<!-- UX-260616-06 决策只编 text:编辑态切 inline input,回车/失焦写回,ESC 取消 -->
|
||||
<template v-if="editingQueueIdx === idx">
|
||||
<span v-if="item.skill" class="ai-queue-skill">/{{ item.skill }}</span>
|
||||
<input
|
||||
v-model="editingQueueText"
|
||||
class="ai-queue-edit-input"
|
||||
type="text"
|
||||
@keydown.enter.prevent="saveEditQueued"
|
||||
@keydown.esc.prevent="cancelEditQueued"
|
||||
@blur="saveEditQueued"
|
||||
/>
|
||||
<button class="ai-queue-btn" @mousedown.prevent="saveEditQueued" :title="$t('aiChat.queueSave')">✓</button>
|
||||
<button class="ai-queue-btn" @mousedown.prevent="cancelEditQueued" :title="$t('aiChat.queueCancel')">✕</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span v-if="item.skill" class="ai-queue-skill">/{{ item.skill }}</span>
|
||||
<span class="ai-queue-text">{{ item.text }}</span>
|
||||
<!-- UX-260616-06:编辑按钮 -->
|
||||
<button class="ai-queue-btn" @click="startEditQueued(idx)" :title="$t('aiChat.queueEdit')">{{ $t('aiChat.queueEdit') }}</button>
|
||||
<!-- UX-260616-07 决策 a:立即发送(打断当前+发本条) -->
|
||||
<button class="ai-queue-btn" @click="handleSendQueuedNow(idx)" :title="$t('aiChat.queueSendNow')">{{ $t('aiChat.queueSendNow') }}</button>
|
||||
<button class="ai-queue-x" @click="store.cancelQueued(idx)" :title="$t('common.cancel')">×</button>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1541,6 +1561,40 @@ async function handleForceSend() {
|
||||
await store.tryForceSend(confirmDialog)
|
||||
}
|
||||
|
||||
// ── UX-260616-06 队列消息编辑(决策只编 text)+ UX-260616-07 立即发送(决策 a 插队)──
|
||||
|
||||
/** 当前正在编辑的队列项 index;null=非编辑态 */
|
||||
const editingQueueIdx = ref<number | null>(null)
|
||||
/** 编辑态输入框文本(回车写回 / ESC 取消还原) */
|
||||
const editingQueueText = ref('')
|
||||
|
||||
/** 进入编辑态:记录 index + 快照当前 text */
|
||||
function startEditQueued(idx: number) {
|
||||
const item = store.state.queue[idx]
|
||||
if (!item) return
|
||||
editingQueueIdx.value = idx
|
||||
editingQueueText.value = item.text
|
||||
}
|
||||
|
||||
/** 取消编辑:还原非编辑态,不写回 */
|
||||
function cancelEditQueued() {
|
||||
editingQueueIdx.value = null
|
||||
editingQueueText.value = ''
|
||||
}
|
||||
|
||||
/** 保存编辑:回车/失焦触发,委托 store.editQueued 写回 text */
|
||||
function saveEditQueued() {
|
||||
if (editingQueueIdx.value === null) return
|
||||
store.editQueued(editingQueueIdx.value, editingQueueText.value)
|
||||
editingQueueIdx.value = null
|
||||
editingQueueText.value = ''
|
||||
}
|
||||
|
||||
/** UX-260616-07 立即发送:委托 store.sendQueuedNow(splice+stop+sendMessage) */
|
||||
async function handleSendQueuedNow(idx: number) {
|
||||
await store.sendQueuedNow(idx)
|
||||
}
|
||||
|
||||
// 用户是否已在底部附近(上滑查看历史时不强制拉回)
|
||||
function isNearBottom(): boolean {
|
||||
const el = messagesContainer.value
|
||||
@@ -2919,6 +2973,19 @@ body.ai-sidebar-resizing * {
|
||||
}
|
||||
.ai-queue-x { background: none; border: none; color: var(--df-text-dim); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; flex-shrink: 0; }
|
||||
.ai-queue-x:hover { color: var(--df-danger); }
|
||||
/* UX-260616-06 队列项编辑/立即发送按钮 + 编辑态 input */
|
||||
.ai-queue-btn {
|
||||
background: none; border: none; color: var(--df-text-dim); cursor: pointer;
|
||||
font-size: 11px; line-height: 1; padding: 0 4px; flex-shrink: 0;
|
||||
}
|
||||
.ai-queue-btn:hover { color: var(--df-accent); }
|
||||
.ai-queue-edit-input {
|
||||
flex: 1; min-width: 0; font-size: 12px; padding: 1px 4px;
|
||||
background: var(--df-bg-card); color: var(--df-text);
|
||||
border: 0.5px solid var(--df-accent);
|
||||
border-radius: calc(var(--df-radius) - 2px);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* ── 技能 chip / 联想浮层 ── */
|
||||
.ai-skill-chip {
|
||||
|
||||
Reference in New Issue
Block a user