import re with open('C:/ScriptoriumAI/scriptoriumai-ui/src/pages/EditorSimplified.tsx', 'r', encoding='utf-8') as f: data = f.read() # 1. Add import import_str = "import { MemoryInspector } from '../components/memory/MemoryInspector'" if import_str not in data: data = data.replace( "import { Activity,", import_str + "\nimport { Activity," ) # 2. Add Tab button tab_old = ''' > Insights ''' tab_new = ''' > Insights ''' data = data.replace(tab_old, tab_new) # 3. Add Component Render render_old = ''' ) : activeRightPaneTab === 'native_pdf' ? ( ) : (
''' render_new = ''' ) : activeRightPaneTab === 'native_pdf' ? ( ) : activeRightPaneTab === 'memory' ? (
) : (
''' data = data.replace(render_old, render_new) with open('C:/ScriptoriumAI/scriptoriumai-ui/src/pages/EditorSimplified.tsx', 'w', encoding='utf-8') as f: f.write(data) print("Done")