Skip to content

Commit 439e859

Browse files
fix: Revert stop text align (#1397)
* Revert "fix: remove the unused center stop message and add comment" This reverts commit 654a25a. * Revert "fix: when user input a prompt, it wont have stop message before the new prompt" This reverts commit f6e9904.
1 parent 6b12b54 commit 439e859

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

chat-client/src/client/mynahUi.ts

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export const handlePromptInputChange = (mynahUi: MynahUI, tabId: string, options
9494
}
9595
}
9696

97-
export const handleChatPrompt = async (
97+
export const handleChatPrompt = (
9898
mynahUi: MynahUI,
9999
tabId: string,
100100
prompt: ChatPrompt,
@@ -104,25 +104,7 @@ export const handleChatPrompt = async (
104104
agenticMode?: boolean
105105
) => {
106106
let userPrompt = prompt.escapedPrompt
107-
108-
const tabStore = mynahUi.getTabData(tabId)?.getStore()
109-
const isLoading = tabStore?.loadingChat === true
110-
if (isLoading) {
111-
messager.onStopChatResponse(tabId)
112-
mynahUi.addChatItem(tabId, {
113-
type: ChatItemType.DIRECTIVE,
114-
messageId: `stopped-${Date.now()}`,
115-
})
116-
mynahUi.updateStore(tabId, {
117-
loadingChat: false,
118-
cancelButtonWhenLoading: true,
119-
promptInputDisabledState: false,
120-
})
121-
122-
// Add a slight delay to make sure the stop message would render before the new prompt
123-
await new Promise(resolve => setTimeout(resolve, 50))
124-
}
125-
107+
messager.onStopChatResponse(tabId)
126108
if (prompt.command) {
127109
// Temporary solution to handle clear quick actions on the client side
128110
if (prompt.command === '/clear') {
@@ -923,6 +905,8 @@ export const createMynahUi = (
923905
const processedButtons: ChatItemButton[] | undefined = toMynahButtons(message.buttons)?.map(button =>
924906
button.id === 'undo-all-changes' ? { ...button, position: 'outside' } : button
925907
)
908+
// Adding this conditional check to show the stop message in the center.
909+
const contentHorizontalAlignment: ChatItem['contentHorizontalAlignment'] = undefined
926910

927911
// If message.header?.status?.text is Stopped or Rejected or Ignored or Completed etc.. card should be in disabled state.
928912
const shouldMute = message.header?.status?.text !== undefined
@@ -935,6 +919,7 @@ export const createMynahUi = (
935919
// file diffs in the header need space
936920
fullWidth: message.type === 'tool' && message.header?.buttons ? true : undefined,
937921
padding,
922+
contentHorizontalAlignment,
938923
wrapCodes: message.type === 'tool',
939924
codeBlockActions:
940925
message.type === 'tool'

0 commit comments

Comments
 (0)