enabled AI setting restore

pull/5370/head
Stéphane Tetsing 10 months ago
parent aecd0e6e44
commit 4ff229408a
  1. 8
      apps/remix-ide/src/app/tabs/settings-tab.tsx
  2. 4
      libs/remix-ui/settings/src/lib/remix-ui-settings.tsx
  3. 11
      libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx

@ -15,7 +15,7 @@ const _paq = (window._paq = window._paq || [])
const profile = {
name: 'settings',
displayName: 'Settings',
methods: ['get', 'updateCopilotChoice'],
methods: ['get', 'updateCopilotChoice', 'getCopilotSetting'],
events: [],
icon: 'assets/img/settings.webp',
description: 'Remix-IDE settings',
@ -52,7 +52,7 @@ module.exports = class SettingsTab extends ViewPlugin {
this.element = document.createElement('div')
this.element.setAttribute('id', 'settingsTab')
this.useMatomoAnalytics = null
this.useCopilot = false
this.useCopilot = this.get('settings/copilot/suggest/activate')
}
setDispatch(dispatch: React.Dispatch<any>) {
@ -102,6 +102,10 @@ module.exports = class SettingsTab extends ViewPlugin {
})
}
getCopilotSetting(){
return this.useCopilot
}
updateMatomoAnalyticsChoice(isChecked) {
this.config.set('settings/matomo-analytics', isChecked)
this.useMatomoAnalytics = isChecked

@ -56,7 +56,6 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
const [ipfsProtocol, setipfsProtocol] = useState('')
const [ipfsProjectId, setipfsProjectId] = useState('')
const [ipfsProjectSecret, setipfsProjectSecret] = useState('')
const copilotDownload = useRef(null)
const intl = useIntl()
const initValue = () => {
@ -143,8 +142,9 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
}
const startCopilot = async () => {
copilotActivate(props.config, true, dispatch)
copilotActivate(props.config, props.useCopilot, dispatch)
props.plugin.call('terminal', 'log', { type: 'typewriterlog', value: `Solidity copilot activated!` })
//props.plugin.call('settings', 'updateCopilotChoice', props.useCopilot)
}
startCopilot()

@ -64,7 +64,6 @@ export const TabsUI = (props: TabsUIProps) => {
const tabsRef = useRef({})
const tabsElement = useRef(null)
const [ai_switch, setAI_switch] = useState<boolean>(false)
const tabs = useRef(props.tabs)
tabs.current = props.tabs // we do this to pass the tabs list to the onReady callbacks
@ -77,6 +76,16 @@ export const TabsUI = (props: TabsUIProps) => {
}
}, [tabsState.selectedIndex])
const getAI = async() => {
try {
return await props.plugin.call('settings', 'getCopilotSetting')
} catch (e){
return false
}
}
getAI().then(value => setAI_switch(value)).catch(error => console.log(error))
const getFileDecorationClasses = (tab: any) => {
const fileDecoration = tabsState.fileDecorations.find((fileDecoration: fileDecoration) => {
if (`${fileDecoration.workspace.name}/${fileDecoration.path}` === tab.name) return true

Loading…
Cancel
Save