feat: SEO web audit, URL fetching, auto web search for SEO mode (v1.6.0)
This commit is contained in:
31
fix_reviewcode.py
Normal file
31
fix_reviewcode.py
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Fix the broken reviewCode template literal."""
|
||||
|
||||
fp = '/home/uroma/promptarch/components/AIAssist.tsx'
|
||||
with open(fp, 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
# Find and replace the broken reviewPrompt line
|
||||
# The problem: backticks inside template literal need to be escaped with \`
|
||||
old_line = ' const reviewPrompt = `Please review this generated code for bugs, security issues, performance problems, and best practices. Provide specific improvements:\\n\\n\\\\`\\\\`\\\\`${previewData.language || "code"}\\n${previewData.data}\\n\\\\`\\\\`\\\\`';'
|
||||
|
||||
new_line = ' const reviewPrompt = "Please review this generated code for bugs, security issues, performance problems, and best practices. Provide specific improvements:\\n\\n\`\`\`" + (previewData.language || "code") + "\\n" + previewData.data + "\\n\`\`\`";'
|
||||
|
||||
if old_line in content:
|
||||
content = content.replace(old_line, new_line, 1)
|
||||
print("Fixed reviewCode template literal")
|
||||
else:
|
||||
# Try with the actual escaped content
|
||||
# Let's just find it by the function start and replace the whole function
|
||||
print("Trying line-by-line approach...")
|
||||
lines = content.split('\n')
|
||||
for i, line in enumerate(lines):
|
||||
if 'const reviewPrompt' in line and 'review this generated code' in line:
|
||||
print(f"Found at line {i+1}: {line[:80]}...")
|
||||
lines[i] = new_line
|
||||
print("Fixed")
|
||||
break
|
||||
content = '\n'.join(lines)
|
||||
|
||||
with open(fp, 'w') as f:
|
||||
f.write(content)
|
||||
Reference in New Issue
Block a user