Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions chat-client/src/client/mcpMynahUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,17 @@ export class McpMynahUi {
private mynahUi: MynahUI
private messager: Messager
private isMcpServersListActive = false
private mcpDetailedList: { close: () => void } | undefined

constructor(mynahUi: MynahUI, messager: Messager) {
this.mynahUi = mynahUi
this.messager = messager
}

close() {
this.mcpDetailedList?.close()
}

/**
* Processes filter options by converting icons to Mynah icons
*/
Expand Down Expand Up @@ -397,15 +402,15 @@ export class McpMynahUi {
;(detailedList.filterOptions[0] as any).autoFocus = true
}

const mcpSheet = this.mynahUi.openDetailedList({
this.mcpDetailedList = this.mynahUi.openDetailedList({
detailedList: detailedList,
events: {
onFilterValueChange: (filterValues: Record<string, any>) => {
this.messager.onListMcpServers(filterValues)
},
onKeyPress: (e: KeyboardEvent) => {
if (e.key === 'Escape') {
mcpSheet.close()
this.mcpDetailedList?.close()
}
},
onItemSelect: (item: DetailedListItem) => {
Expand All @@ -426,6 +431,7 @@ export class McpMynahUi {
},
onClose: () => {
this.isMcpServersListActive = false
this.mcpDetailedList = undefined
},
onTitleActionClick: button => {
this.messager.onMcpServerClick(button.id)
Expand Down
6 changes: 4 additions & 2 deletions chat-client/src/client/mynahUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,8 @@ export const createMynahUi = (
const sendToPrompt = (params: SendToPromptParams) => {
const tabId = getOrCreateTabId()
if (!tabId) return

chatHistoryList.close()
mcpMynahUi.close()
if (params.autoSubmit && params.prompt) {
messager.onChatPrompt({ prompt: params.prompt, tabId, context: undefined }, 'contextMenu')
initializeChatResponse(mynahUi, tabId, params.prompt.prompt, agenticMode)
Expand All @@ -1431,7 +1432,8 @@ export const createMynahUi = (
let tabId = getOrCreateTabId()

if (!tabId) return

chatHistoryList.close()
mcpMynahUi.close()
// send to a new tab if the current tab is loading
if (getTabStore(tabId)?.loadingChat) {
tabId = createTabId()
Expand Down
Loading