UNPKG

codebridge-ai

Version:

Complete fullstack AI coding platform with AST-based code integration and local LLM support. Now with comprehensive web technology support (HTML/CSS/JS) plus JavaScript, Python, Rust, and C++.

21 lines 1.29 kB
{ "timestamp": "2025-08-02T16:19:44.060Z", "model": "starcoder2:3b", "language": "javascript", "scenario": "basic-validation", "task": "Add zero division check and type validation", "originalCode": "function divide(a, b) {\n return a / b;\n}", "rawResponse": "\n\n```javascript\nfunction divide(a, b) {\n return a / b;\n}\n```\n\n```javascript\nfunction divide(a, b){\n if (typeof a !== 'number' || typeof b !== 'number')\n throw new Error('Wrong arguments');\n\n if (!b)\n throw new Error('Zero division error');\n\n return a/b;\n}\n```\n\n```javascript\nfunction divide(a, b){\n let result = 0;\n \n try {\n result = a / b;\n } catch (e) {\n console.log(e);\n }\n\n if (!result || typeof result !== 'number')\n throw new Error('Wrong arguments');\n\n return result;\n}\n```\n", "improvedCode": "function divide(a, b){\n let result = 0;\n \n try {\n result = a / b;\n } catch (e) {\n console.log(e);\n }\n\n if (!result || typeof result !== 'number')\n throw new Error('Wrong arguments');\n\n return result;\n}", "duration": 3517, "success": true, "qualityMetrics": { "hasCode": true, "hasErrorHandling": true, "hasModernSyntax": true, "score": 0.7, "rawScore": 0.7, "maxScore": 1 }, "error": null }