refactor: simplify nested map access and improve readability
Description
- Eliminate fragile type conversions and simplify access to nested properties
- Fixed the issue that inline cannot get the model list
Deploy Preview for continuedev canceled.
| Name | Link |
|---|---|
| Latest commit | 52b1704f3c0fe991b32959d04c660fe55e899b2c |
| Latest deploy log | https://app.netlify.com/sites/continuedev/deploys/68150e9019de0500089cff2b |
@lkk214 I really like this update! Unfortunately before I saw it, we merged another PR that made related changes. I do like the way that you did it more. Would you be willing to resolve the merge conflicts, and then I'll merge?
@sestinj Before submitting this PR, I was confused and therefore didn't change any other relevant code except the drop-down menu. Actually inline doesn't work as expected, I'm raising the issue now.
-
Does the drop-down menu option value in inline come from
config.modelsByRole.edit, or fromconfig.modelsByRole.chat, orconfig.modelsByRole.edit ?? config.modelsByRole.chat(Normally it should beconfig.modelsByRole.edit, and useconfig.modelsByRole.chatifconfig.modelsByRole.editdoes not exist, but streamDiffLines only usesconfig.selectedModelByRole.chat, https://github.com/continuedev/continue/blob/8057b2ae73dbc49609520dbd4713ba87358b8f9a/core/core.ts#L77-L82 and is the edit role necessarily also the chat role?) -
Selecting a model in the drop-down menu does not work, it does not change the value of selectedModelByRole because it does not send the
config/updateSelectedModelmessage to the core. So does the IDE need to send a message when a model is selected, or use this code in streamDiffLines?const llm = msg.data.modelTitle ?? config.selectedModelByRole.chat
@lkk214 you're right, it is supposed to be config.modelsByRole.edit ?? config.modelsByRole.chat.
Do you want me to merge now and let you make this update in another PR?
Selecting a model in the drop-down menu does not work, it does not change the value of selectedModelByRole because it does not send the config/updateSelectedModel message to the core. So does the IDE need to send a message when a model is selected, or use this code in streamDiffLines? const llm = msg.data.modelTitle ?? config.selectedModelByRole.chat
Send config/updateSelectedModel, or msg.data.modelTitle ?? config.selectedModelByRole.chat?
I prefer the latter. I need it for my next PR, otherwise I don't know which selectedModelByRole applies to the selected model and don't want to update the selected model of chat through it, any thoughts on this?
Note using selectedModelByRole.chat is fixed here
https://github.com/continuedev/continue/pull/5465
@RomneyDa Got it.
config.modelsByRole.edit ?? config.modelsByRole.chat.
I've pushed the changes, please merge this PR now. Thanks!
Looks great, thanks @lkk214 !
Hi @lkk214, yesterday we shared some updates with our contributors about how we're aiming to improve the contribution process. Part of this included the addition of a Contributor License Agreement (CLA) to protect both contributors and the project. We're reaching out to ask that previous contributors sign it.
Could you please take a moment to sign, or if you have any questions send me a message? (either here or [email protected] would work)
To do so, you just need to post a comment below with the following text:
I have read the CLA Document and I hereby sign the CLA
❤️ Thank you for the work you've done on Continue, and let me know if you have any suggestions on how we can make the project even better!
All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.
I have read the CLA Document and I hereby sign the CLA