Improve assistant input and choice handling

This commit is contained in:
jxxghp
2026-06-26 13:43:47 +08:00
parent 2d92315e17
commit deb9b103da
4 changed files with 11 additions and 3 deletions

View File

@@ -235,7 +235,7 @@ const slashCommandQuery = computed(() => {
// 根据输入内容过滤可用斜杠命令。
const filteredSlashCommands = computed(() => {
const query = slashCommandQuery.value
if (!query) return slashCommands.value.slice(0, 8)
if (!query) return slashCommands.value
return slashCommands.value
.filter(command => {
@@ -243,7 +243,6 @@ const filteredSlashCommands = computed(() => {
return haystack.includes(query)
})
.slice(0, 8)
})
// 判断是否展示命令建议浮层。
const showSlashCommandMenu = computed(
@@ -253,6 +252,10 @@ const showSlashCommandMenu = computed(
!recording.value &&
(filteredSlashCommands.value.length > 0 || slashCommandsLoading.value),
)
// 根据智能体处理状态切换输入框背景提示。
const inputPlaceholder = computed(() =>
sending.value ? t('agentAssistant.processingPlaceholder') : t('agentAssistant.placeholder'),
)
const recordingTimeText = computed(() => {
const seconds = Math.max(0, recordingDuration.value)
const minutes = Math.floor(seconds / 60)
@@ -1616,6 +1619,7 @@ async function handleChoiceClick(message: AgentChatMessage, choice: AgentChoiceC
refreshMessageList()
persistState()
await streamAgentMessage(agentMessage, [], [], [], [], {
echoUser: false,
displayText: choiceSelection.selected_label || choiceSelection.selected_description,
choiceSelection,
originalMessageId: String(result.data?.original_message_id || message.id),
@@ -1641,6 +1645,7 @@ async function handleChoiceClick(message: AgentChatMessage, choice: AgentChoiceC
persistState()
await streamAgentMessage(agentMessage, [], [], [], [], {
echoUser: false,
displayText: choiceSelection.selected_label || choiceSelection.selected_description,
choiceSelection,
})
@@ -2159,7 +2164,7 @@ onScopeDispose(() => {
class="agent-assistant-textarea"
rows="1"
:disabled="sending || recording"
:placeholder="t('agentAssistant.placeholder')"
:placeholder="inputPlaceholder"
@input="handleInputChange"
@keydown="handleInputKeydown"
/>

View File

@@ -723,6 +723,7 @@ export default {
emptyTitle: 'What should we handle today?',
emptySubtitle: 'Ask about sites, subscriptions, downloads, or organization tasks.',
placeholder: 'Ask MoviePilot, Type / for commands',
processingPlaceholder: 'MoviePilot is working, please wait...',
commandLoading: 'Loading commands...',
commandLoadFailed: 'Failed to load commands',
stop: 'Stop generating',

View File

@@ -719,6 +719,7 @@ export default {
emptyTitle: '今天想处理什么?',
emptySubtitle: '站点、订阅、下载、整理任务,都可以直接问我。',
placeholder: '询问 MoviePilot输入 / 使用命令',
processingPlaceholder: '智能体正在处理,请稍候...',
commandLoading: '正在加载命令...',
commandLoadFailed: '命令列表加载失败',
stop: '停止生成',

View File

@@ -719,6 +719,7 @@ export default {
emptyTitle: '今天想處理什麼?',
emptySubtitle: '站點、訂閱、下載、整理任務,都可以直接問我。',
placeholder: '詢問 MoviePilot輸入 / 使用命令',
processingPlaceholder: '智能體正在處理,請稍候...',
commandLoading: '正在載入命令...',
commandLoadFailed: '命令列表載入失敗',
stop: '停止生成',