Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First draft for an API to add models from other VSCode extensions. #827

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lupreCSC
Copy link

@lupreCSC lupreCSC commented Feb 6, 2024

Proof of concept draft for feature request #803

Exports functions "addExtensionModel" and "removeExtensionModel" through the VSCode extension API.

addExtensionModel accepts a CustomLLM object, as well as callbacks to the third-party extension to be notified when the model is added and removed.

Added field extensionModels to ContinueConfig, which holds the CustomLLM model specifications for models added by extensions. This field is not serialized to config.json. Config loading routines are adadpted to construct CustomLLMClass instances from all models declared in extensionModels and add them to models.

Also reworked vscode/src/loadConfig.ts:ConfigHandler to keep track of extension models on the VSCode extension side and improve configuration update event handling generally.

There seems to have been a bug/leak in earlier code where models removed by the user where removed in the webview / continue server configuration but not in the configuration object held by the VSCode extension: debugPanels handler for deleteModel would not remove the model from the config object and not trigger a config reload. This should be resolved by the changes.

Not sure if this would be the best way to handle this - it feels a bit hacky and there might be a better way to keep track of the extension models. The whole interaction of extension code with continue server(?)/webview code appears quite complex and I have missed a better way. Please consider this a proof of concept draft - any feedback welcome.

Copy link

netlify bot commented Feb 6, 2024

Deploy Preview for continuedev canceled.

Name Link
🔨 Latest commit 5091a06
🔍 Latest deploy log https://app.netlify.com/sites/continuedev/deploys/65c2026ca6bea50008f1d434

Exports functions "addExtensionModel" and
"removeExtensionModel" through the VSCode extension API.

`addExtensionModel` accepts a `CustomLLM` object, as well as
callbacks to the third-party extension to be notified
when the model is added and removed.

Added field `extensionModels` to `ContinueConfig`, which holds the `CustomLLM` model specifications for models added
by extensions. This field is not serialized to `config.json`. Config
loading routines are adadpted to construct `CustomLLMClass`
instances from all models declared in `extensionModels` and
add them to `models`.

Also reworked `vscode/src/loadConfig.ts:ConfigHandler` to
keep track of extension models on the VSCode extension side
and improve configuration update event handling generally.
@lupreCSC lupreCSC force-pushed the api_for_models_from_other_extensions branch from 63da101 to 5091a06 Compare February 6, 2024 09:56
@sestinj
Copy link
Contributor

sestinj commented Mar 17, 2024

@lupreCSC just wanted to make sure I also referenced other discussion in this PR: #803 (comment)

Questions there would be good to understand before moving forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants