continue icon indicating copy to clipboard operation
continue copied to clipboard

refactor: simplify nested map access and improve readability

Open lkk214 opened this issue 9 months ago • 3 comments

Description

  • Eliminate fragile type conversions and simplify access to nested properties
  • Fixed the issue that inline cannot get the model list bug0419

lkk214 avatar Apr 19 '25 13:04 lkk214

Deploy Preview for continuedev canceled.

Name Link
Latest commit 52b1704f3c0fe991b32959d04c660fe55e899b2c
Latest deploy log https://app.netlify.com/sites/continuedev/deploys/68150e9019de0500089cff2b

netlify[bot] avatar Apr 19 '25 13:04 netlify[bot]

@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 avatar Apr 24 '25 00:04 sestinj

@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.

  1. Does the drop-down menu option value in inline come from config.modelsByRole.edit, or from config.modelsByRole.chat, or config.modelsByRole.edit ?? config.modelsByRole.chat (Normally it should be config.modelsByRole.edit, and use config.modelsByRole.chat if config.modelsByRole.edit does not exist, but streamDiffLines only uses config.selectedModelByRole.chat, https://github.com/continuedev/continue/blob/8057b2ae73dbc49609520dbd4713ba87358b8f9a/core/core.ts#L77-L82 and is the edit role necessarily also the chat role?)

  2. 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

lkk214 avatar Apr 25 '25 07:04 lkk214

@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?

sestinj avatar Apr 29 '25 18:04 sestinj

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?

demo

lkk214 avatar Apr 30 '25 03:04 lkk214

Note using selectedModelByRole.chat is fixed here https://github.com/continuedev/continue/pull/5465

RomneyDa avatar May 02 '25 17:05 RomneyDa

@RomneyDa Got it.

config.modelsByRole.edit ?? config.modelsByRole.chat.

I've pushed the changes, please merge this PR now. Thanks!

lkk214 avatar May 02 '25 18:05 lkk214

Looks great, thanks @lkk214 !

sestinj avatar May 06 '25 23:05 sestinj

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!

sestinj avatar May 15 '25 18:05 sestinj

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

github-actions[bot] avatar May 15 '25 18:05 github-actions[bot]

I have read the CLA Document and I hereby sign the CLA

lkk214 avatar May 16 '25 01:05 lkk214