diff --git a/apps/remix-ide/src/app/plugins/solcoderAI.tsx b/apps/remix-ide/src/app/plugins/solcoderAI.tsx index 298dcdde36..44fc8b43bd 100644 --- a/apps/remix-ide/src/app/plugins/solcoderAI.tsx +++ b/apps/remix-ide/src/app/plugins/solcoderAI.tsx @@ -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 { @@ -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', diff --git a/libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts b/libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts index ad2fdb7440..263fb39a12 100644 --- a/libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts @@ -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 }