From 68cf65a72a0d39cb8aebf3392d8b07b09d4fccf3 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 10 Oct 2024 11:45:18 +0200 Subject: [PATCH] ai vyper code --- apps/remix-ide/src/app/tabs/locales/en/vyper.json | 3 +++ apps/vyper/src/app/app.tsx | 1 + libs/remix-ui/renderer/src/lib/renderer.tsx | 5 +++-- .../remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx | 5 +++-- 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 apps/remix-ide/src/app/tabs/locales/en/vyper.json diff --git a/apps/remix-ide/src/app/tabs/locales/en/vyper.json b/apps/remix-ide/src/app/tabs/locales/en/vyper.json new file mode 100644 index 0000000000..093a185c79 --- /dev/null +++ b/apps/remix-ide/src/app/tabs/locales/en/vyper.json @@ -0,0 +1,3 @@ +{ + "vyper.openaigptMessage": "vyper code: {content}\n error message: {messageText}\n explain why the error occurred and how to fix it." +} diff --git a/apps/vyper/src/app/app.tsx b/apps/vyper/src/app/app.tsx index 8e8c69eca1..773af51f68 100644 --- a/apps/vyper/src/app/app.tsx +++ b/apps/vyper/src/app/app.tsx @@ -184,6 +184,7 @@ const App = () => { return { +export const Renderer = ({ message, opt, plugin, context }: RendererProps) => { const intl = useIntl() const [messageText, setMessageText] = useState(null) const [editorOptions, setEditorOptions] = useState({ @@ -88,7 +89,7 @@ export const Renderer = ({ message, opt, plugin }: RendererProps) => { const askGtp = async () => { try { const content = await plugin.call('fileManager', 'readFile', editorOptions.errFile) - const message = intl.formatMessage({ id: 'solidity.openaigptMessage' }, { content, messageText }) + const message = intl.formatMessage({ id: `${context || 'solidity' }.openaigptMessage` }, { content, messageText }) await plugin.call('remixAI', 'error_explaining', message) _paq.push(['trackEvent', 'ai', 'remixAI', 'error_explaining_SolidityError']) } catch (err) { diff --git a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx index 4d6f5773d6..de2f3285ec 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx @@ -299,6 +299,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => { { compileErrors[currentFile].errors.map((err, index) => { if (hideWarnings) { if (err.severity !== 'warning') { - return + return } } else { - return + return } })}