|
|
|
@ -9,6 +9,7 @@ enum CONSENT { |
|
|
|
|
NOT_GIVEN, |
|
|
|
|
NOT_ASKED |
|
|
|
|
} |
|
|
|
|
let consentGivenForAI = CONSENT.NOT_ASKED |
|
|
|
|
|
|
|
|
|
import './remix-ui-settings.css' |
|
|
|
|
import { |
|
|
|
@ -62,7 +63,6 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => { |
|
|
|
|
const [ipfsProjectSecret, setipfsProjectSecret] = useState('') |
|
|
|
|
const copilotDownload = useRef(null) |
|
|
|
|
|
|
|
|
|
let consentGivenForAI = CONSENT.NOT_ASKED |
|
|
|
|
const intl = useIntl() |
|
|
|
|
const initValue = () => { |
|
|
|
|
const metadataConfig = props.config.get('settings/generate-contract-metadata') |
|
|
|
@ -151,21 +151,18 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => { |
|
|
|
|
if (!props.useCopilot) { |
|
|
|
|
copilotActivate(props.config, props.useCopilot, dispatch) |
|
|
|
|
props.plugin.call('copilot-suggestion', 'uninstall') |
|
|
|
|
props.plugin.call('terminal', 'log', {type: 'typewriterlog', value: `Solidity copilot deactivated` }) |
|
|
|
|
return |
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const message = <div>Please wait while the copilot is downloaded. <span ref={copilotDownload}>0</span>/100 .</div> |
|
|
|
|
props.plugin.on('copilot-suggestion', 'loading', (data) => { |
|
|
|
|
if (!copilotDownload.current) return |
|
|
|
|
const loaded = ((data.loaded / data.total) * 100).toString() |
|
|
|
|
const dot = loaded.match(/(.*)\./g) |
|
|
|
|
copilotDownload.current.innerText = dot ? dot[0].replace('.', '') : loaded |
|
|
|
|
props.plugin.call('terminal', 'log', {type: 'typewriterlog', value: `loading Solidity copilot: ${(data.loaded / data.total) * 100}% done.` }) |
|
|
|
|
}) |
|
|
|
|
const startCopilot = async () => { |
|
|
|
|
await props.plugin.call('copilot-suggestion', 'init') |
|
|
|
|
props.plugin.off('copilot-suggestion', 'loading') |
|
|
|
|
if (await props.plugin.call('copilot-suggestion', 'status')) { |
|
|
|
|
copilotActivate(props.config, true, dispatch)
|
|
|
|
|
<<<<<<< HEAD |
|
|
|
|
} else { |
|
|
|
|
props.plugin.call('copilot-suggestion', 'uninstall') |
|
|
|
|
copilotActivate(props.config, false, dispatch) |
|
|
|
@ -204,13 +201,29 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (props.plugin.call('copilot-suggestion', 'status')) { |
|
|
|
|
======= |
|
|
|
|
}
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
props.plugin.on('copilot-suggestion', 'ready', (data) => {
|
|
|
|
|
copilotActivate(props.config, true, dispatch)
|
|
|
|
|
props.plugin.call('terminal', 'log', {type: 'typewriterlog', value: `Solidity Copilot activated` }) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
if (await props.plugin.call('copilot-suggestion', 'status')) { |
|
|
|
|
>>>>>>> f63484701 (removed user consens) |
|
|
|
|
copilotActivate(props.config, true, dispatch)
|
|
|
|
|
} else { |
|
|
|
|
props.plugin.call('copilot-suggestion', 'uninstall') |
|
|
|
|
copilotActivate(props.config, false, dispatch) |
|
|
|
|
}else { |
|
|
|
|
startCopilot() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
if (props.useCopilot !== null) copilotActivate(props.config, props.useCopilot, dispatch) |
|
|
|
|
onchangeCopilotActivate() |
|
|
|
|
}, [props.useCopilot]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const onchangeCopilotMaxNewToken = (event) => { |
|
|
|
|
copilotMaxNewToken(props.config, parseInt(event.target.value), dispatch) |
|
|
|
|
} |
|
|
|
|