From e36be75754619e1887b25acee70dadf12731d071 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sun, 19 May 2024 10:07:43 -0700 Subject: [PATCH] Update CodeBlock.svelte --- .../components/chat/Messages/CodeBlock.svelte | 77 +------------------ 1 file changed, 1 insertion(+), 76 deletions(-) diff --git a/src/lib/components/chat/Messages/CodeBlock.svelte b/src/lib/components/chat/Messages/CodeBlock.svelte index 0adada519..4131fbd85 100644 --- a/src/lib/components/chat/Messages/CodeBlock.svelte +++ b/src/lib/components/chat/Messages/CodeBlock.svelte @@ -30,70 +30,17 @@ }; const checkPythonCode = (str) => { - // Check if the string contains typical Python keywords, syntax, or functions - const pythonKeywords = [ - 'def', - 'class', - 'import', - 'from', - 'if', - 'else', - 'elif', - 'for', - 'while', - 'try', - 'except', - 'finally', - 'return', - 'yield', - 'lambda', - 'assert', - 'pass', - 'break', - 'continue', - 'global', - 'nonlocal', - 'del', - 'True', - 'False', - 'None', - 'and', - 'or', - 'not', - 'in', - 'is', - 'as', - 'with' - ]; - - for (let keyword of pythonKeywords) { - if (str.includes(keyword)) { - return true; - } - } - // Check if the string contains typical Python syntax characters const pythonSyntax = [ 'def ', - 'class ', - 'import ', - 'from ', - 'if ', 'else:', 'elif ', - 'for ', - 'while ', 'try:', 'except:', 'finally:', - 'return ', 'yield ', 'lambda ', 'assert ', - 'pass', - 'break', - 'continue', - 'global ', 'nonlocal ', 'del ', 'True', @@ -104,29 +51,7 @@ ' not ', ' in ', ' is ', - ' as ', - ' with ', - ':', - '=', - '==', - '!=', - '>', - '<', - '>=', - '<=', - '+', - '-', - '*', - '/', - '%', - '**', - '//', - '(', - ')', - '[', - ']', - '{', - '}' + ' with ' ]; for (let syntax of pythonSyntax) {