disabled inline completion on comment

inlinecompletion_update
Stéphane Tetsing 9 months ago
parent 201b1cff03
commit 59ea0ac9aa
  1. 8
      apps/remix-ide/src/app/plugins/solcoderAI.tsx
  2. 7
      libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts

@ -13,8 +13,10 @@ const profile = {
}
export class SolCoder extends Plugin {
api_url: string
constructor() {
super(profile)
this.api_url = "https://hkfll35zthu6e2-7861.proxy.runpod.net/api/"
}
async code_generation(prompt): Promise<any> {
@ -23,7 +25,7 @@ export class SolCoder extends Plugin {
let result
try {
result = await(
await fetch("https://hkfll35zthu6e2-7861.proxy.runpod.net/api/code_generation", {
await fetch(this.api_url.concat("code_generation"), {
method: 'POST',
headers: {
Accept: 'application/json',
@ -45,7 +47,7 @@ export class SolCoder extends Plugin {
let result
try {
result = await(
await fetch("https://hkfll35zthu6e2-7861.proxy.runpod.net/api/solidity_answer", {
await fetch(this.api_url.concat("solidity_answer"), {
method: 'POST',
headers: {
Accept: 'application/json',
@ -71,7 +73,7 @@ export class SolCoder extends Plugin {
let result
try {
result = await(
await fetch("https://hkfll35zthu6e2-7861.proxy.runpod.net/api/code_completion", {
await fetch(this.api_url.concat("code_completion"), {
method: 'POST',
headers: {
Accept: 'application/json',

@ -1,6 +1,7 @@
/* eslint-disable no-control-regex */
import { EditorUIProps, monacoTypes } from '@remix-ui/editor';
import axios, {AxiosResponse} from 'axios'
import { slice } from 'lodash';
const controller = new AbortController();
const { signal } = controller;
const result: string = ''
@ -68,11 +69,15 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli
let result
try {
if (!this.running){
if (word.split('\n').at(-1).trimStart().startsWith('//')){
return // disable completion on comment -> current lie
}else if (!this.running){
console.log('last line', word.split('\n').at(-1))
result = await this.props.plugin.call('copilot-suggestion', 'suggest', word)
this.running = true
}
} catch (err) {
this.running=false
return
}

Loading…
Cancel
Save