@astii/monaco-copilot
v0.0.1
Published
monaco-editor code copilot
Downloads
68
Readme
@astii/monaco-copilot
monaco-editor code completions tool with AI power
Install
$ npm install @astii/monaco-copilot
Usage
import { registerCopilot } from "@astii/monaco-copilot";
useEffect(() => {
if (!monaco || !editor) return;
const dispose = registerCopilot(monaco, editor, {
language: "typescript",
request: new Request("AI model service", {
method: "POST",
headers: {
"x-dmo-provider": "model name",
"x-dmo-username": "username",
authorization: "auth",
"Content-Type": "application/json",
},
body: JSON.stringify({
//custom params
}),
}),
getCompletions(res) {
//custom response resolver
},
onAcceptCompletion(params) {
console.log("accept", params);
},
onFreeCompletion(params) {
console.log("free", params);
},
});
return () => {
dispose();
};
}, [monaco, editor]);
LICENSE
MIT