|
|
@ -137,48 +137,48 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => { |
|
|
|
return |
|
|
|
return |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const message = <div>Please wait while the copilot is downloaded. <span ref={copilotDownload}>0</span>/100 .</div> |
|
|
|
const message = <div>Please wait while the copilot is downloaded. <span ref={copilotDownload}>0</span>/100 .</div> |
|
|
|
props.plugin.on('copilot-suggestion', 'loading', (data) => { |
|
|
|
props.plugin.on('copilot-suggestion', 'loading', (data) => { |
|
|
|
if (!copilotDownload.current) return |
|
|
|
if (!copilotDownload.current) return |
|
|
|
const loaded = ((data.loaded / data.total) * 100).toString() |
|
|
|
const loaded = ((data.loaded / data.total) * 100).toString() |
|
|
|
const dot = loaded.match(/(.*)\./g) |
|
|
|
const dot = loaded.match(/(.*)\./g) |
|
|
|
copilotDownload.current.innerText = dot ? dot[0].replace('.', '') : loaded |
|
|
|
copilotDownload.current.innerText = dot ? dot[0].replace('.', '') : loaded |
|
|
|
}) |
|
|
|
}) |
|
|
|
const modalActivate: AppModal = { |
|
|
|
const modalActivate: AppModal = { |
|
|
|
id: 'loadcopilotActivate', |
|
|
|
id: 'loadcopilotActivate', |
|
|
|
title: 'Download Solidity copilot', |
|
|
|
title: 'Download Solidity copilot', |
|
|
|
modalType: ModalTypes.default, |
|
|
|
modalType: ModalTypes.default, |
|
|
|
okLabel: 'Close', |
|
|
|
okLabel: 'Close', |
|
|
|
message, |
|
|
|
message, |
|
|
|
okFn: async() => { |
|
|
|
okFn: async() => { |
|
|
|
props.plugin.off('copilot-suggestion', 'loading') |
|
|
|
props.plugin.off('copilot-suggestion', 'loading') |
|
|
|
if (await props.plugin.call('copilot-suggestion', 'status')) { |
|
|
|
if (await props.plugin.call('copilot-suggestion', 'status')) { |
|
|
|
copilotActivate(props.config, true, dispatch)
|
|
|
|
copilotActivate(props.config, true, dispatch)
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
props.plugin.call('copilot-suggestion', 'uninstall') |
|
|
|
props.plugin.call('copilot-suggestion', 'uninstall') |
|
|
|
copilotActivate(props.config, false, dispatch) |
|
|
|
copilotActivate(props.config, false, dispatch) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
hideFn: async () => { |
|
|
|
hideFn: async () => { |
|
|
|
props.plugin.off('copilot-suggestion', 'loading') |
|
|
|
props.plugin.off('copilot-suggestion', 'loading') |
|
|
|
if (await props.plugin.call('copilot-suggestion', 'status')) { |
|
|
|
if (await props.plugin.call('copilot-suggestion', 'status')) { |
|
|
|
copilotActivate(props.config, true, dispatch)
|
|
|
|
copilotActivate(props.config, true, dispatch)
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
props.plugin.call('copilot-suggestion', 'uninstall') |
|
|
|
props.plugin.call('copilot-suggestion', 'uninstall') |
|
|
|
copilotActivate(props.config, false, dispatch) |
|
|
|
copilotActivate(props.config, false, dispatch) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (await props.plugin.call('copilot-suggestion', 'status')) { |
|
|
|
if (await props.plugin.call('copilot-suggestion', 'status')) { |
|
|
|
copilotActivate(props.config, true, dispatch)
|
|
|
|
copilotActivate(props.config, true, dispatch)
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
props.plugin.call('copilot-suggestion', 'uninstall') |
|
|
|
props.plugin.call('copilot-suggestion', 'uninstall') |
|
|
|
copilotActivate(props.config, false, dispatch) |
|
|
|
copilotActivate(props.config, false, dispatch) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
props.plugin.call('copilot-suggestion', 'init') |
|
|
|
props.plugin.call('copilot-suggestion', 'init') |
|
|
|
props.plugin.call('notification', 'modal', modalActivate) |
|
|
|
props.plugin.call('notification', 'modal', modalActivate) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const onchangeCopilotMaxNewToken = (event) => { |
|
|
|
const onchangeCopilotMaxNewToken = (event) => { |
|
|
|