mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-04 23:18:44 +08:00
Improve assistant input and choice handling
This commit is contained in:
@@ -235,7 +235,7 @@ const slashCommandQuery = computed(() => {
|
|||||||
// 根据输入内容过滤可用斜杠命令。
|
// 根据输入内容过滤可用斜杠命令。
|
||||||
const filteredSlashCommands = computed(() => {
|
const filteredSlashCommands = computed(() => {
|
||||||
const query = slashCommandQuery.value
|
const query = slashCommandQuery.value
|
||||||
if (!query) return slashCommands.value.slice(0, 8)
|
if (!query) return slashCommands.value
|
||||||
|
|
||||||
return slashCommands.value
|
return slashCommands.value
|
||||||
.filter(command => {
|
.filter(command => {
|
||||||
@@ -243,7 +243,6 @@ const filteredSlashCommands = computed(() => {
|
|||||||
|
|
||||||
return haystack.includes(query)
|
return haystack.includes(query)
|
||||||
})
|
})
|
||||||
.slice(0, 8)
|
|
||||||
})
|
})
|
||||||
// 判断是否展示命令建议浮层。
|
// 判断是否展示命令建议浮层。
|
||||||
const showSlashCommandMenu = computed(
|
const showSlashCommandMenu = computed(
|
||||||
@@ -253,6 +252,10 @@ const showSlashCommandMenu = computed(
|
|||||||
!recording.value &&
|
!recording.value &&
|
||||||
(filteredSlashCommands.value.length > 0 || slashCommandsLoading.value),
|
(filteredSlashCommands.value.length > 0 || slashCommandsLoading.value),
|
||||||
)
|
)
|
||||||
|
// 根据智能体处理状态切换输入框背景提示。
|
||||||
|
const inputPlaceholder = computed(() =>
|
||||||
|
sending.value ? t('agentAssistant.processingPlaceholder') : t('agentAssistant.placeholder'),
|
||||||
|
)
|
||||||
const recordingTimeText = computed(() => {
|
const recordingTimeText = computed(() => {
|
||||||
const seconds = Math.max(0, recordingDuration.value)
|
const seconds = Math.max(0, recordingDuration.value)
|
||||||
const minutes = Math.floor(seconds / 60)
|
const minutes = Math.floor(seconds / 60)
|
||||||
@@ -1616,6 +1619,7 @@ async function handleChoiceClick(message: AgentChatMessage, choice: AgentChoiceC
|
|||||||
refreshMessageList()
|
refreshMessageList()
|
||||||
persistState()
|
persistState()
|
||||||
await streamAgentMessage(agentMessage, [], [], [], [], {
|
await streamAgentMessage(agentMessage, [], [], [], [], {
|
||||||
|
echoUser: false,
|
||||||
displayText: choiceSelection.selected_label || choiceSelection.selected_description,
|
displayText: choiceSelection.selected_label || choiceSelection.selected_description,
|
||||||
choiceSelection,
|
choiceSelection,
|
||||||
originalMessageId: String(result.data?.original_message_id || message.id),
|
originalMessageId: String(result.data?.original_message_id || message.id),
|
||||||
@@ -1641,6 +1645,7 @@ async function handleChoiceClick(message: AgentChatMessage, choice: AgentChoiceC
|
|||||||
persistState()
|
persistState()
|
||||||
|
|
||||||
await streamAgentMessage(agentMessage, [], [], [], [], {
|
await streamAgentMessage(agentMessage, [], [], [], [], {
|
||||||
|
echoUser: false,
|
||||||
displayText: choiceSelection.selected_label || choiceSelection.selected_description,
|
displayText: choiceSelection.selected_label || choiceSelection.selected_description,
|
||||||
choiceSelection,
|
choiceSelection,
|
||||||
})
|
})
|
||||||
@@ -2159,7 +2164,7 @@ onScopeDispose(() => {
|
|||||||
class="agent-assistant-textarea"
|
class="agent-assistant-textarea"
|
||||||
rows="1"
|
rows="1"
|
||||||
:disabled="sending || recording"
|
:disabled="sending || recording"
|
||||||
:placeholder="t('agentAssistant.placeholder')"
|
:placeholder="inputPlaceholder"
|
||||||
@input="handleInputChange"
|
@input="handleInputChange"
|
||||||
@keydown="handleInputKeydown"
|
@keydown="handleInputKeydown"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -723,6 +723,7 @@ export default {
|
|||||||
emptyTitle: 'What should we handle today?',
|
emptyTitle: 'What should we handle today?',
|
||||||
emptySubtitle: 'Ask about sites, subscriptions, downloads, or organization tasks.',
|
emptySubtitle: 'Ask about sites, subscriptions, downloads, or organization tasks.',
|
||||||
placeholder: 'Ask MoviePilot, Type / for commands',
|
placeholder: 'Ask MoviePilot, Type / for commands',
|
||||||
|
processingPlaceholder: 'MoviePilot is working, please wait...',
|
||||||
commandLoading: 'Loading commands...',
|
commandLoading: 'Loading commands...',
|
||||||
commandLoadFailed: 'Failed to load commands',
|
commandLoadFailed: 'Failed to load commands',
|
||||||
stop: 'Stop generating',
|
stop: 'Stop generating',
|
||||||
|
|||||||
@@ -719,6 +719,7 @@ export default {
|
|||||||
emptyTitle: '今天想处理什么?',
|
emptyTitle: '今天想处理什么?',
|
||||||
emptySubtitle: '站点、订阅、下载、整理任务,都可以直接问我。',
|
emptySubtitle: '站点、订阅、下载、整理任务,都可以直接问我。',
|
||||||
placeholder: '询问 MoviePilot,输入 / 使用命令',
|
placeholder: '询问 MoviePilot,输入 / 使用命令',
|
||||||
|
processingPlaceholder: '智能体正在处理,请稍候...',
|
||||||
commandLoading: '正在加载命令...',
|
commandLoading: '正在加载命令...',
|
||||||
commandLoadFailed: '命令列表加载失败',
|
commandLoadFailed: '命令列表加载失败',
|
||||||
stop: '停止生成',
|
stop: '停止生成',
|
||||||
|
|||||||
@@ -719,6 +719,7 @@ export default {
|
|||||||
emptyTitle: '今天想處理什麼?',
|
emptyTitle: '今天想處理什麼?',
|
||||||
emptySubtitle: '站點、訂閱、下載、整理任務,都可以直接問我。',
|
emptySubtitle: '站點、訂閱、下載、整理任務,都可以直接問我。',
|
||||||
placeholder: '詢問 MoviePilot,輸入 / 使用命令',
|
placeholder: '詢問 MoviePilot,輸入 / 使用命令',
|
||||||
|
processingPlaceholder: '智能體正在處理,請稍候...',
|
||||||
commandLoading: '正在載入命令...',
|
commandLoading: '正在載入命令...',
|
||||||
commandLoadFailed: '命令列表載入失敗',
|
commandLoadFailed: '命令列表載入失敗',
|
||||||
stop: '停止生成',
|
stop: '停止生成',
|
||||||
|
|||||||
Reference in New Issue
Block a user