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
4 changes: 3 additions & 1 deletion chat-client/src/client/mynahUi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ describe('MynahUI', () => {
sinon.assert.calledThrice(updateStoreSpy)
})

it('should create a new tab if current tab is loading', () => {
it('should create a new tab if current tab is loading', function (done) {
this.timeout(8000)
// clear create tab stub since set up process calls it twice
createTabStub.resetHistory()
getAllTabsStub.returns({ 'tab-1': { store: { loadingChat: true } } })
Expand All @@ -274,6 +275,7 @@ describe('MynahUI', () => {

sinon.assert.calledOnceWithExactly(createTabStub, false)
sinon.assert.calledThrice(updateStoreSpy)
done()
})

it('should not create a new tab if one exists already', () => {
Expand Down
23 changes: 19 additions & 4 deletions chat-client/src/client/mynahUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,20 @@ export const handlePromptInputChange = (mynahUi: MynahUI, tabId: string, options
}
}

const updatedPromptInputOptions = promptInputOptions?.map(option => {
option.value = optionsValues[option.id]
return option
})

mynahUi.updateStore(tabId, {
promptInputOptions: promptInputOptions?.map(option => {
option.value = optionsValues[option.id]
return option
}),
promptInputOptions: updatedPromptInputOptions,
})

// Store the updated values in tab defaults for new tabs
mynahUi.updateTabDefaults({
store: {
promptInputOptions: updatedPromptInputOptions,
},
})
}

Expand Down Expand Up @@ -414,6 +423,12 @@ export const createMynahUi = (
}

const tabStore = mynahUi.getTabData(tabId).getStore()
const storedPromptInputOptions = mynahUi.getTabDefaults().store?.promptInputOptions

// Retrieve stored model selection and pair programming mode from defaults
if (storedPromptInputOptions) {
defaultTabConfig.promptInputOptions = storedPromptInputOptions
}

// Tabs can be opened through different methods, including server-initiated 'openTab' requests.
// The 'openTab' request is specifically used for loading historical chat sessions with pre-existing messages.
Expand Down
Loading