Skip to content

Commit

Permalink
Merge branch 'master' into fixinganerror
Browse files Browse the repository at this point in the history
  • Loading branch information
LianaHus committed Nov 30, 2023
2 parents c957d09 + 42b30c1 commit 379f226
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 50 deletions.
16 changes: 12 additions & 4 deletions apps/circuit-compiler/src/app/components/container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,17 @@ import { PrimeValue } from '../types'
export function Container () {
const circuitApp = useContext(CircuitAppContext)

const showCompilerLicense = (message = 'License not available') => {
// @ts-ignore
circuitApp.plugin.call('notification', 'modal', { id: 'modal_circuit_compiler_license', title: 'Compiler License', message })
const showCompilerLicense = async (message = 'License not available') => {
try {
const response = await fetch('https://raw.githubusercontent.com/iden3/circom/master/COPYING')
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`)
const content = await response.text()
// @ts-ignore
circuitApp.plugin.call('notification', 'modal', { id: 'modal_circuit_compiler_license', title: 'Compiler License', message: content })
} catch (e) {
// @ts-ignore
circuitApp.plugin.call('notification', 'modal', { id: 'modal_circuit_compiler_license', title: 'Compiler License', message })
}
}

const handleVersionSelect = (version: string) => {
Expand Down Expand Up @@ -57,7 +65,7 @@ export function Container () {
<FormattedMessage id="circuit.compiler" />
</label>
<CustomTooltip
placement="top"
placement="bottom"
tooltipId="showCircumCompilerTooltip"
tooltipClasses="text-nowrap"
tooltipText='See compiler license'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ const _paq = (window._paq = window._paq || []) //eslint-disable-line
const profile = {
name: 'copilot-suggestion',
displayName: 'copilot-suggestion',
description: 'copilot-suggestion',
methods: ['suggest', 'init', 'uninstall', 'status', 'isActivate']
description: 'Get Solidity suggestions in editor',
methods: ['suggest', 'init', 'uninstall', 'status', 'isActivate'],
version: '0.1.0-alpha',
maintainedBy: "Remix"
}

export class CopilotSuggestion extends Plugin {
Expand Down Expand Up @@ -45,7 +47,6 @@ export class CopilotSuggestion extends Plugin {

const max_new_tokens = await this.call('settings', 'get', 'settings/copilot/suggest/max_new_tokens')
const temperature = await this.call('settings', 'get', 'settings/copilot/suggest/temperature')
console.log('suggest', max_new_tokens, temperature)
const options: SuggestOptions = {
do_sample: false,
top_k: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,31 @@ export class SuggestionService {
const onMessageReceived = (e) => {
switch (e.data.status) {
case 'initiate':
console.log(e.data)
this.events.emit(e.data.status, e.data)
// Model file start load: add a new progress item to the list.
break;

case 'progress':
this.events.emit(e.data.status, e.data)
console.log(e.data)
// Model file progress: update one of the progress items.
break;

case 'done':
this.events.emit(e.data.status, e.data)
console.log(e.data)
// Model file loaded: remove the progress item from the list.
break;

case 'ready':
this.events.emit(e.data.status, e.data)
console.log(e.data)
// Pipeline ready: the worker is ready to accept messages.
break;

case 'update':
this.events.emit(e.data.status, e.data)
console.log(e.data)
// Generation update: update the output text.
break;

case 'complete':
console.log(e.data)
if (this.responses[e.data.id]) {
if (this.current === e.data.id) {
this.responses[e.data.id](null, e.data)
Expand All @@ -67,8 +61,6 @@ export class SuggestionService {
}
delete this.responses[e.data.id]
this.current = null
} else {
console.log('no callback for', e.data)
}

// Generation complete: re-enable the "Generate" button
Expand Down
6 changes: 3 additions & 3 deletions apps/remix-ide/src/app/tabs/locales/en/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"home.learnMore": "Learn more",
"home.here": "here",
"home.featured": "Featured",
"home.jumpIntoWeb3": "WE NEED YOUR HELP",
"home.jumpIntoWeb3More": "Go to survey",
"home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix experience with this one-minute survey.",
"home.jumpIntoWeb3": "JUMP INTO WEB3",
"home.jumpIntoWeb3More": "More",
"home.jumpIntoWeb3Text": "Remix IDE is part of the Remix Project, a rich toolset that can be used for the entire journey of contract development by users of any knowledge level. Learn more on the Remix Project website.",
"home.remixYouTube": "WATCH TO LEARN",
"home.remixYouTubeText1": "Video Tips from the Remix Team",
"home.remixYouTubeMore": "Watch",
Expand Down
2 changes: 1 addition & 1 deletion apps/remix-ide/src/app/tabs/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
"settings.analyticsInRemix": "Analytics in Remix IDE",
"settings.copilot": "Solidity copilot - Alpha",
"settings.copilot.activate": "Load & Activate copilot",
"settings.copilot.max_new_tokens": "Maximum amount of new words to generate",
"settings.copilot.max_new_tokens": "Maximum number of words to generate",
"settings.copilot.temperature": "Temperature"
}
6 changes: 3 additions & 3 deletions apps/remix-ide/src/app/tabs/locales/es/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"home.learnMore": "Aprender más",
"home.here": "aquí",
"home.featured": "Destacado",
"home.jumpIntoWeb3": "NECESITAMOS TU AYUDA",
"home.jumpIntoWeb3More": "Ir a la encuesta",
"home.jumpIntoWeb3Text": "Remixers... ¿Tienes un momento libre? Por favor, ayúdanos a mejorar tu experiencia en Remix con esta encuesta de un minuto.",
"home.jumpIntoWeb3": "JUMP INTO WEB3",
"home.jumpIntoWeb3More": "More",
"home.jumpIntoWeb3Text": "Remix IDE is part of the Remix Project, a rich toolset that can be used for the entire journey of contract development by users of any knowledge level. Learn more on the Remix Project website.",
"home.remixYouTube": "MIRA PARA APRENDER",
"home.remixYouTubeText1": "Vídeo de consejos del equipo de Remix",
"home.remixYouTubeMore": "Mirar",
Expand Down
6 changes: 3 additions & 3 deletions apps/remix-ide/src/app/tabs/locales/fr/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"home.learnMore": "En savoir plus",
"home.here": "ici",
"home.featured": "Recommandé",
"home.jumpIntoWeb3": "NOUS AVONS BESOINS DE VOTRE AIDE",
"home.jumpIntoWeb3More": "Accéder au sondage",
"home.jumpIntoWeb3Text": "Remixers... Vous avez un moment? Aidez-nous à améliorer votre expérience de remix avec cette enquête d'une minute.",
"home.jumpIntoWeb3": "JUMP INTO WEB3",
"home.jumpIntoWeb3More": "More",
"home.jumpIntoWeb3Text": "Remix IDE is part of the Remix Project, a rich toolset that can be used for the entire journey of contract development by users of any knowledge level. Learn more on the Remix Project website.",
"home.remixYouTube": "REGARDER POUR APPRENDRE",
"home.remixYouTubeText1": "Conseils vidéo de l'équipe de Remix",
"home.remixYouTubeMore": "Regarder",
Expand Down
6 changes: 3 additions & 3 deletions apps/remix-ide/src/app/tabs/locales/it/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"home.learnMore": "Scopri di più",
"home.here": "qui",
"home.featured": "In Evidenza",
"home.jumpIntoWeb3": "ABBIAMO BISOGNO DEL TUO AIUTO",
"home.jumpIntoWeb3More": "Vai al sondaggio",
"home.jumpIntoWeb3Text": "Remixers... Hai un momento libero? Aiutaci a migliorare la tua esperienza Remix con questo sondaggio di un minuto.",
"home.jumpIntoWeb3": "JUMP INTO WEB3",
"home.jumpIntoWeb3More": "More",
"home.jumpIntoWeb3Text": "Remix IDE is part of the Remix Project, a rich toolset that can be used for the entire journey of contract development by users of any knowledge level. Learn more on the Remix Project website.",
"home.remixYouTube": "GUARDA PER IMPARARE",
"home.remixYouTubeText1": "Video di Suggerimenti dal Team di Remix",
"home.remixYouTubeMore": "Guarda",
Expand Down
6 changes: 3 additions & 3 deletions apps/remix-ide/src/app/tabs/locales/zh/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"home.learnMore": "了解更多",
"home.here": "这里",
"home.featured": "精选",
"home.jumpIntoWeb3": "我们需要你的帮助",
"home.jumpIntoWeb3More": "去填调查表",
"home.jumpIntoWeb3Text": "Remixers... 有空吗?请填写这份一分钟调查问卷,帮助我们改善您的 Remix 体验。",
"home.jumpIntoWeb3": "JUMP INTO WEB3",
"home.jumpIntoWeb3More": "More",
"home.jumpIntoWeb3Text": "Remix IDE is part of the Remix Project, a rich toolset that can be used for the entire journey of contract development by users of any knowledge level. Learn more on the Remix Project website.",
"home.remixYouTube": "观看学习",
"home.remixYouTubeText1": "来自 Remix 团队的视频小贴士",
"home.remixYouTubeMore": "观看",
Expand Down
4 changes: 3 additions & 1 deletion apps/remix-ide/src/remixAppManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ const requiredModules = [ // services + layout views + system views
'contractflattener',
'solidity-script',
'openaigpt',
'home'
'home',
'doc-viewer',
'doc-gen'
]

// dependentModules shouldn't be manually activated (e.g hardhat is activated by remixd)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli

async provideInlineCompletions(model: monacoTypes.editor.ITextModel, position: monacoTypes.Position, context: monacoTypes.languages.InlineCompletionContext, token: monacoTypes.CancellationToken): Promise<monacoTypes.languages.InlineCompletions<monacoTypes.languages.InlineCompletion>> {
if (context.selectedSuggestionInfo) {
console.log('return empty from provideInlineCompletions')
return;
}
// get text before the position of the completion
Expand All @@ -27,7 +26,6 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli
});

if (!word.endsWith(' ') && !word.endsWith('\n') && !word.endsWith(';') && !word.endsWith('.')) {
console.log('not a trigger char')
return;
}

Expand All @@ -40,13 +38,12 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli

try {
const split = word.split('\n')
if (!split.length) return
if (split.length < 2) return
const ask = split[split.length - 2].trimStart()
if (split[split.length - 1].trim() === '' && ask.startsWith('///')) {
// use the code generation model
const {data} = await axios.post('https://gpt-chat.remixproject.org/infer', {comment: ask.replace('///', '')})
const parsedData = JSON.parse(data).trimStart()
console.log('parsedData', parsedData)
const item: monacoTypes.languages.InlineCompletion = {
insertText: parsedData
};
Expand All @@ -61,7 +58,6 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli

// abort if there is a signal
if (token.isCancellationRequested) {
console.log('aborted')
return
}

Expand All @@ -81,7 +77,6 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli

// abort if there is a signal
if (token.isCancellationRequested) {
console.log('aborted')
return
}
return {
Expand Down
4 changes: 2 additions & 2 deletions libs/remix-ui/home-tab/src/lib/components/homeTabFeatured.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ function HomeTabFeatured() {
<h5>
<FormattedMessage id="home.jumpIntoWeb3" />
</h5>
<div style={{fontSize: '0.8rem'}} className="mb-3">
<div style={{fontSize: '0.8rem', lineHeight: '1.25rem'}} className="mb-3">
<FormattedMessage id="home.jumpIntoWeb3Text" />
</div>
<a
className="remixui_home_text btn-sm btn-secondary mt-2 text-decoration-none mb-3"
onClick={() => _paq.push(['trackEvent', 'hometab', 'featuredSection', 'jumpIntoWeb3'])}
target="__blank"
href="https://us8.list-manage.com/survey?u=5a84beb6d688fe180c0da482a&id=1148d10f8c"
href="https://remix-project.org/"
>
<FormattedMessage id="home.jumpIntoWeb3More" />
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ function HomeTabGetStarted({plugin}: HomeTabGetStartedProps) {
return (
<div className="pl-2" id="hTGetStartedSection">
<label style={{fontSize: '1.2rem'}}>
<span className="mr-2">
<FormattedMessage id="home.getStarted" />
</span>
- <FormattedMessage id="home.projectTemplates" />
<FormattedMessage id="home.projectTemplates" />
</label>
<div ref={carouselRefDiv} className="w-100 d-flex flex-column">
<ThemeContext.Provider value={themeFilter}>
Expand Down
6 changes: 3 additions & 3 deletions libs/remix-ui/settings/src/lib/remix-ui-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
})
const modalActivate: AppModal = {
id: 'loadcopilotActivate',
title: 'Downloading Solidity copilot',
title: 'Download Solidity copilot',
modalType: ModalTypes.default,
okLabel: 'Close',
message,
Expand Down Expand Up @@ -466,7 +466,7 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
<div className="text-secondary mb-0 h6">
<div>
<div className="mb-1">
<label className={`align-middle ${getTextClass('settings/copilot/suggest/max_new_tokens')}`} htmlFor="copilot-activate">
<label className={`form-check-label align-middle ${getTextClass('settings/copilot/suggest/max_new_tokens')}`} htmlFor="copilot-activate">
<FormattedMessage id="settings.copilot.max_new_tokens" /> - <span>{copilotMaxnewToken}</span>
</label>
<input onChange={onchangeCopilotMaxNewToken} id="copilot-max-new-token" value={copilotMaxnewToken} min='1' max='150' type="range" className="custom-range" />
Expand All @@ -479,7 +479,7 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
<div className="text-secondary mb-0 h6">
<div>
<div className="mb-1">
<label className={`align-middle ${getTextClass('settings/copilot/suggest/temperature')}`} htmlFor="copilot-activate">
<label className={`form-check-label align-middle ${getTextClass('settings/copilot/suggest/temperature')}`} htmlFor="copilot-activate">
<FormattedMessage id="settings.copilot.temperature" /> - <span>{copilotTemperatureValue / 100}</span>
</label>
<input onChange={onchangeCopilotTemperature} id="copilot-temperature" value={copilotTemperatureValue} min='0' max='100' type="range" className="custom-range" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -766,14 +766,19 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
<FormattedMessage id="solidity.compiler" />
</label>
<CustomTooltip
placement="top"
placement="bottom"
tooltipId="promptCompilerTooltip"
tooltipClasses="text-nowrap"
tooltipText={<FormattedMessage id="solidity.addACustomCompilerWithURL" />}
>
<span className="far fa-plus border-0 p-0 ml-3" onClick={() => promptCompiler()}></span>
</CustomTooltip>
<CustomTooltip placement="top" tooltipId="showCompilerTooltip" tooltipClasses="text-nowrap" tooltipText={<FormattedMessage id="solidity.seeCompilerLicense" />}>
<CustomTooltip
placement="bottom"
tooltipId="showCompilerTooltip"
tooltipClasses="text-nowrap"
tooltipText={<FormattedMessage id="solidity.seeCompilerLicense" />}
>
<span className="far fa-file-certificate border-0 p-0 ml-2" onClick={() => showCompilerLicense()}></span>
</CustomTooltip>
<select
Expand Down
2 changes: 1 addition & 1 deletion libs/remix-ui/terminal/src/lib/terminalWelcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const TerminalWelcomeMessage = ({packageJson, storage}) => {
</a>{' '}
</li>
<li key="ethers-console">
gpt <i>your question</i> {' '}
gpt <i>&lt;your question here&gt;</i> {' '}
</li>
</ul>
<div>
Expand Down

0 comments on commit 379f226

Please sign in to comment.