diff --git a/modules/openvino_code/README.md b/modules/openvino_code/README.md index ea4541b18..6555e4369 100644 --- a/modules/openvino_code/README.md +++ b/modules/openvino_code/README.md @@ -23,9 +23,11 @@ To check the connection manually, use the `Check Connection` button located on t ### Code Completion +![code_completion](https://github.com/apaniukov/openvino_contrib/assets/51917466/c3ba73bf-106b-4045-a36e-96440f8c804f) + 1. Create a new Python file or open an existing one. 1. Type `def main():` or place the cursor where you'd like code suggestions to be generated. -1. Press the keyboard shortcut `Ctrl+Alt+Space` or click the `Generate Code Completion` button located in the side panel. +1. Press the keyboard shortcut `Ctrl+Alt+Space` (`Cmd+Alt+Space` for macOS) or click the `Generate Code Completion` button located in the side panel. 1. Use the `Tab` key to accept the entire suggestion or `Ctrl`+`Right Arrow` to accept it word by word. To decline the suggestion, press `Esc`. You can customize the length of the generated code by adjusting `Max New Tokens` and `Min New Tokens` parameters in the extension settings. @@ -36,6 +38,8 @@ This mode allows you to immediately receive model output and avoid problems with ### Summarization via Docstring Generation +![summarization](https://github.com/apaniukov/openvino_contrib/assets/51917466/1d066b0e-cff7-4353-90f9-a53343d60b59) + To generate function docstring start typing `"""` or `'''` right under function signature and choose `Generate Docstring`. You can select the desired type of quotes in the extension settings. diff --git a/modules/openvino_code/openvino-code-completion-0.0.4.vsix b/modules/openvino_code/openvino-code-completion-0.0.4.vsix deleted file mode 100644 index a0d8a1fad..000000000 Binary files a/modules/openvino_code/openvino-code-completion-0.0.4.vsix and /dev/null differ diff --git a/modules/openvino_code/package-lock.json b/modules/openvino_code/package-lock.json index e1075d5c5..f67719c9e 100644 --- a/modules/openvino_code/package-lock.json +++ b/modules/openvino_code/package-lock.json @@ -1,12 +1,12 @@ { "name": "openvino-code-completion", - "version": "0.0.4", + "version": "0.0.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "openvino-code-completion", - "version": "0.0.4", + "version": "0.0.5", "license": "https://github.com/openvinotoolkit/openvino_contrib/blob/master/LICENSE", "workspaces": [ "side-panel-ui" diff --git a/modules/openvino_code/package.json b/modules/openvino_code/package.json index 976f21f44..93476bff9 100644 --- a/modules/openvino_code/package.json +++ b/modules/openvino_code/package.json @@ -1,7 +1,7 @@ { "publisher": "OpenVINO", "name": "openvino-code-completion", - "version": "0.0.4", + "version": "0.0.5", "displayName": "OpenVINO Code Completion", "description": "VSCode extension for AI code completion with OpenVINO", "icon": "media/logo.png", diff --git a/modules/openvino_code/server/pyproject.toml b/modules/openvino_code/server/pyproject.toml index d8f98a281..5e857ec18 100644 --- a/modules/openvino_code/server/pyproject.toml +++ b/modules/openvino_code/server/pyproject.toml @@ -11,7 +11,7 @@ dependencies = [ 'torch @ https://download.pytorch.org/whl/cpu-cxx11-abi/torch-2.0.1%2Bcpu.cxx11.abi-cp310-cp310-linux_x86_64.whl ; sys_platform=="linux" and python_version == "3.10"', 'torch @ https://download.pytorch.org/whl/cpu-cxx11-abi/torch-2.0.1%2Bcpu.cxx11.abi-cp311-cp311-linux_x86_64.whl ; sys_platform=="linux" and python_version == "3.11"', 'torch ; sys_platform != "linux"', - 'openvino==2023.1.0.dev20230811', + 'openvino==2023.1.0', 'transformers==4.31.0', 'optimum==1.12.0', 'optimum-intel[openvino]==1.10.1', diff --git a/modules/openvino_code/shared/extension-state.ts b/modules/openvino_code/shared/extension-state.ts index 545e3a0ea..8e6d64594 100644 --- a/modules/openvino_code/shared/extension-state.ts +++ b/modules/openvino_code/shared/extension-state.ts @@ -20,4 +20,5 @@ export interface IExtensionState { get isServerAvailable(): boolean; get config(): ExtensionConfiguration; features: IStateFeatures; + platform: NodeJS.Platform; } diff --git a/modules/openvino_code/side-panel-ui/src/App.tsx b/modules/openvino_code/side-panel-ui/src/App.tsx index 52c32bddb..1120ae0a7 100644 --- a/modules/openvino_code/side-panel-ui/src/App.tsx +++ b/modules/openvino_code/side-panel-ui/src/App.tsx @@ -29,8 +29,10 @@ function App(): JSX.Element { {isServerStarted && ( <> - - {isSummarizationSupported && } + + {isSummarizationSupported && ( + + )} )} diff --git a/modules/openvino_code/side-panel-ui/src/components/sections/CompletionSection/CompletionSection.tsx b/modules/openvino_code/side-panel-ui/src/components/sections/CompletionSection/CompletionSection.tsx index 9237eb741..86fa5ec19 100644 --- a/modules/openvino_code/side-panel-ui/src/components/sections/CompletionSection/CompletionSection.tsx +++ b/modules/openvino_code/side-panel-ui/src/components/sections/CompletionSection/CompletionSection.tsx @@ -5,22 +5,24 @@ import { VscodeIcon } from '../../shared/VscodeIcon/VscodeIcon'; interface CompletionSectionProps { isLoading: boolean; + platform: NodeJS.Platform; } -export function CompletionSection({ isLoading }: CompletionSectionProps = { isLoading: false }): JSX.Element { +export function CompletionSection({ isLoading, platform }: CompletionSectionProps): JSX.Element { const handleGenerateClick = () => { vscode.postMessage({ type: SidePanelMessageTypes.GENERATE_COMPLETION_CLICK, }); }; + const platformKeyBinding = platform === 'darwin' ? 'Cmd+Alt+Space' : 'Ctrl+Alt+Space'; + return (

Code Completion

- {/* TODO Detect OS and show specific keybindings */} {/* TODO Consider getting keybinding from package.json */} - To generate inline code completion use combination Ctrl+Alt+Space or press the button below. + To generate inline code completion use combination {platformKeyBinding} or press the button below.